Merge branches 'release', 'button-sysfs', 'misc', 'mismatch', 'randconfig' and 'toshi...
[sfrench/cifs-2.6.git] / fs / cifs / sess.c
index d0cb469daab7337b8285abc907e2740a5ef3abd8..ed150efbe27c93fbec1834767262453c47619e14 100644 (file)
@@ -417,10 +417,6 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
 
                calc_lanman_hash(ses, lnm_session_key);
                ses->flags |= CIFS_SES_LANMAN;
-/* #ifdef CONFIG_CIFS_DEBUG2
-               cifs_dump_mem("cryptkey: ",ses->server->cryptKey,
-                       CIFS_SESS_KEY_SIZE);
-#endif */
                memcpy(bcc_ptr, (char *)lnm_session_key, CIFS_SESS_KEY_SIZE);
                bcc_ptr += CIFS_SESS_KEY_SIZE;
 
@@ -528,9 +524,11 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
                        rc = -EOVERFLOW;
                        goto ssetup_exit;
                }
-               ses->server->mac_signing_key.len = msg->sesskey_len;
-               memcpy(ses->server->mac_signing_key.data.krb5, msg->data,
-                       msg->sesskey_len);
+               if (first_time) {
+                       ses->server->mac_signing_key.len = msg->sesskey_len;
+                       memcpy(ses->server->mac_signing_key.data.krb5,
+                               msg->data, msg->sesskey_len);
+               }
                pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
                capabilities |= CAP_EXTENDED_SECURITY;
                pSMB->req.Capabilities = cpu_to_le32(capabilities);
@@ -540,7 +538,7 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
 
                if (ses->capabilities & CAP_UNICODE) {
                        /* unicode strings must be word aligned */
-                       if (iov[0].iov_len % 2) {
+                       if ((iov[0].iov_len + iov[1].iov_len) % 2) {
                                *bcc_ptr = 0;
                                bcc_ptr++;
                        }