Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 24991
b: refs/heads/master
c: e9917a0
h: refs/heads/master
i:
  24989: b273418
  24987: 05ce5d0
  24983: be2f3c4
  24975: 2d83faa
  24959: 45705f4
v: v3
  • Loading branch information
Steve French committed Mar 31, 2006
1 parent c8f6d9e commit a62f1db
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f1682e94a38b66ee2551f3a5e4b36259a561c411
refs/heads/master: e9917a000fcc370408c8b7b83f2e85dba5fffbd4
36 changes: 23 additions & 13 deletions trunk/fs/cifs/cifsencrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server,
int rc = 0;
char smb_signature[20];

/* BB remember to initialize sequence number elsewhere and initialize mac_signing key elsewhere BB */
/* BB remember to add code to save expected sequence number in midQ entry BB */

if((cifs_pdu == NULL) || (server == NULL))
return -EINVAL;

Expand All @@ -86,20 +83,33 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct TCP_Server_Info * server,
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;
struct MD5Context context;
int i;

MD5Init(&context);
MD5Update(&context,key,CIFS_SESSION_KEY_SIZE+16);
if((iov == NULL) || (signature == NULL))
return -EINVAL;

/* MD5Update(&context,cifs_pdu->Protocol,cifs_pdu->smb_buf_length); */ /* BB FIXME BB */
MD5Init(&context);
MD5Update(&context,key,CIFS_SESSION_KEY_SIZE+16);
for(i=0;i<n_vec;i++) {
if(iov[i].iov_base == NULL) {
cERROR(1,("null iovec entry"));
return -EIO;
} else if(iov[i].iov_len == 0)
break; /* bail out if we are sent nothing to sign */
/* The first entry includes a length field (which does not get
signed that occupies the first 4 bytes before the header */
if(i==0) {
if (iov[0].iov_len <= 8 ) /* cmd field at offset 9 */
break; /* nothing to sign or corrupt header */
MD5Update(&context,iov[0].iov_base+4, iov[0].iov_len-4);
} else
MD5Update(&context,iov[i].iov_base, iov[i].iov_len);
}

MD5Final(signature,&context);
MD5Final(signature,&context);

return -EOPNOTSUPP;
/* return 0; */
return 0;
}


Expand Down

0 comments on commit a62f1db

Please sign in to comment.