]> err.no Git - linux-2.6/blobdiff - fs/cifs/sess.c
Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik...
[linux-2.6] / fs / cifs / sess.c
index 7737edd1baf1a2ace5eeb50c7ef0bf041504a461..7202d534ef0bde1d4bcea1d3f61f47bec74f6533 100644 (file)
@@ -83,11 +83,11 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
        /* BB FIXME add check that strings total less
        than 335 or will need to send them as arrays */
 
-       /* align unicode strings, must be word aligned */
-       if ((long) bcc_ptr % 2) {
+       /* unicode strings, must be word aligned before the call */
+/*     if ((long) bcc_ptr % 2) {
                *bcc_ptr = 0;
                bcc_ptr++;
-       }
+       } */
        /* copy user */
        if(ses->userName == NULL) {
                /* BB what about null user mounts - check that we do this BB */
@@ -323,11 +323,12 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
        __u16 action;
        int bytes_remaining;
 
-       cFYI(1,("new sess setup"));
        if(ses == NULL)
                return -EINVAL;
 
        type = ses->server->secType;
+
+       cFYI(1,("sess setup type %d",type));
        if(type == LANMAN) {
 #ifndef CONFIG_CIFS_WEAK_PW_HASH
                /* LANMAN and plaintext are less secure and off by default.
@@ -416,9 +417,14 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
                bcc_ptr += CIFS_SESS_KEY_SIZE;
                memcpy(bcc_ptr, (char *)ntlm_session_key,CIFS_SESS_KEY_SIZE);
                bcc_ptr += CIFS_SESS_KEY_SIZE;
-               if(ses->capabilities & CAP_UNICODE)
+               if(ses->capabilities & CAP_UNICODE) {
+                       /* unicode strings must be word aligned */
+                       if (iov[0].iov_len % 2) {
+                               *bcc_ptr = 0;
+                               bcc_ptr++;              
+                       }       
                        unicode_ssetup_strings(&bcc_ptr, ses, nls_cp);
-               else
+               else
                        ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
        } else if (type == NTLMv2) {
                char * v2_sess_key = 
@@ -455,9 +461,12 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
                memcpy(bcc_ptr, (char *)v2_sess_key, sizeof(struct ntlmv2_resp));
                bcc_ptr += sizeof(struct ntlmv2_resp);
                kfree(v2_sess_key);
-               if(ses->capabilities & CAP_UNICODE)
+               if(ses->capabilities & CAP_UNICODE) {
+                       if(iov[0].iov_len % 2) {
+                               *bcc_ptr = 0;
+                       }       bcc_ptr++;
                        unicode_ssetup_strings(&bcc_ptr, ses, nls_cp);
-               else
+               else
                        ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
        } else /* NTLMSSP or SPNEGO */ {
                pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;