forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge master.kernel.org:/pub/scm/linux/kernel/git/sfrench/cifs-2.6
- Loading branch information
Showing
21 changed files
with
729 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* fs/cifs/cifsacl.h | ||
* | ||
* Copyright (c) International Business Machines Corp., 2005 | ||
* Author(s): Steve French ([email protected]) | ||
* | ||
* This library is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published | ||
* by the Free Software Foundation; either version 2.1 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See | ||
* the GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with this library; if not, write to the Free Software | ||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
*/ | ||
|
||
#ifndef _CIFSACL_H | ||
#define _CIFSACL_H | ||
|
||
struct cifs_sid { | ||
__u8 revision; /* revision level */ | ||
__u8 num_subauths; | ||
__u8 authority[6]; | ||
__u32 sub_auth[4]; | ||
/* next sub_auth if any ... */ | ||
} __attribute__((packed)); | ||
|
||
/* everyone */ | ||
extern const struct cifs_sid sid_everyone; | ||
/* group users */ | ||
extern const struct cifs_sid sid_user; | ||
|
||
#endif /* _CIFSACL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* fs/cifs/cifsencrypt.c | ||
* | ||
* Copyright (C) International Business Machines Corp., 2003 | ||
* Copyright (C) International Business Machines Corp., 2005 | ||
* Author(s): Steve French ([email protected]) | ||
* | ||
* This library is free software; you can redistribute it and/or modify | ||
|
@@ -82,6 +82,59 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server, | |
return rc; | ||
} | ||
|
||
static int cifs_calc_signature2(const struct kvec * iov, int n_vec, | ||
const char * key, char * signature) | ||
{ | ||
struct MD5Context context; | ||
|
||
if((iov == NULL) || (signature == NULL)) | ||
return -EINVAL; | ||
|
||
MD5Init(&context); | ||
MD5Update(&context,key,CIFS_SESSION_KEY_SIZE+16); | ||
|
||
/* MD5Update(&context,cifs_pdu->Protocol,cifs_pdu->smb_buf_length); */ /* BB FIXME BB */ | ||
|
||
MD5Final(signature,&context); | ||
|
||
return -EOPNOTSUPP; | ||
/* return 0; */ | ||
} | ||
|
||
|
||
int cifs_sign_smb2(struct kvec * iov, int n_vec, struct TCP_Server_Info *server, | ||
__u32 * pexpected_response_sequence_number) | ||
{ | ||
int rc = 0; | ||
char smb_signature[20]; | ||
struct smb_hdr * cifs_pdu = iov[0].iov_base; | ||
|
||
if((cifs_pdu == NULL) || (server == NULL)) | ||
return -EINVAL; | ||
|
||
if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) | ||
return rc; | ||
|
||
spin_lock(&GlobalMid_Lock); | ||
cifs_pdu->Signature.Sequence.SequenceNumber = | ||
cpu_to_le32(server->sequence_number); | ||
cifs_pdu->Signature.Sequence.Reserved = 0; | ||
|
||
*pexpected_response_sequence_number = server->sequence_number++; | ||
server->sequence_number++; | ||
spin_unlock(&GlobalMid_Lock); | ||
|
||
rc = cifs_calc_signature2(iov, n_vec, server->mac_signing_key, | ||
smb_signature); | ||
if(rc) | ||
memset(cifs_pdu->Signature.SecuritySignature, 0, 8); | ||
else | ||
memcpy(cifs_pdu->Signature.SecuritySignature, smb_signature, 8); | ||
|
||
return rc; | ||
|
||
} | ||
|
||
int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, | ||
__u32 expected_sequence_number) | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.