X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=fs%2Fcifs%2Fcifsencrypt.c;h=17823106208d317810d63f10e10fc734c6a70dec;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=8fdf3d79b76b900268d292619e3c413bd4302dde;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c index 8fdf3d79b..178231062 100755 --- a/fs/cifs/cifsencrypt.c +++ b/fs/cifs/cifsencrypt.c @@ -61,7 +61,7 @@ int cifs_sign_smb(struct smb_hdr * cifs_pdu, struct cifsSesInfo * ses, if((cifs_pdu == NULL) || (ses == NULL)) return -EINVAL; - if((le32_to_cpu(cifs_pdu->Flags2) & SMBFLG2_SECURITY_SIGNATURE) == 0) + if((cifs_pdu->Flags2 & SMBFLG2_SECURITY_SIGNATURE) == 0) return rc; spin_lock(&GlobalMid_Lock); @@ -107,13 +107,11 @@ int cifs_verify_signature(struct smb_hdr * cifs_pdu, const char * mac_key, if(memcmp(cifs_pdu->Signature.SecuritySignature,"BSRSPYL ",8)==0) cFYI(1,("dummy signature received for smb command 0x%x",cifs_pdu->Command)); - expected_sequence_number = cpu_to_le32(expected_sequence_number); - /* save off the origiginal signature so we can modify the smb and check its signature against what the server sent */ memcpy(server_response_sig,cifs_pdu->Signature.SecuritySignature,8); - cifs_pdu->Signature.Sequence.SequenceNumber = expected_sequence_number; + cifs_pdu->Signature.Sequence.SequenceNumber = cpu_to_le32(expected_sequence_number); cifs_pdu->Signature.Sequence.Reserved = 0; rc = cifs_calculate_signature(cifs_pdu, mac_key, @@ -153,7 +151,7 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_ wchar_t * unicode_buf; unsigned int i,user_name_len,dom_name_len; - if(ses) + if(ses == NULL) return -EINVAL; E_md4hash(ses->password, temp_hash); @@ -167,7 +165,13 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_ return -EINVAL; ucase_buf = kmalloc((MAX_USERNAME_SIZE+1), GFP_KERNEL); + if(ucase_buf == NULL) + return -ENOMEM; unicode_buf = kmalloc((MAX_USERNAME_SIZE+1)*4, GFP_KERNEL); + if(unicode_buf == NULL) { + kfree(ucase_buf); + return -ENOMEM; + } for(i=0;icharset2upper[(int)ses->userName[i]];