Commit 26b994fa authored by Steve French's avatar Steve French

[CIFS] Code cleanup in old sessionsetup code

Remove some long lines
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 95089910
Version 1.54
------------
Fix premature write failure on congested networks (we would give up
on EAGAIN from the socket too quickly on large writes).
Cifs_mkdir and cifs_create now respect the setgid bit on parent dir.
Fix endian problems in acl (mode from/to cifs acl) on bigendian
architectures.
Version 1.53 Version 1.53
------------ ------------
DFS support added (Microsoft Distributed File System client support needed DFS support added (Microsoft Distributed File System client support needed
......
...@@ -3620,97 +3620,91 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo, ...@@ -3620,97 +3620,91 @@ int cifs_setup_session(unsigned int xid, struct cifsSesInfo *pSesInfo,
} }
first_time = 1; first_time = 1;
} }
if (!rc) {
pSesInfo->flags = 0; if (rc)
pSesInfo->capabilities = pSesInfo->server->capabilities; goto ss_err_exit;
if (linuxExtEnabled == 0)
pSesInfo->capabilities &= (~CAP_UNIX); pSesInfo->flags = 0;
pSesInfo->capabilities = pSesInfo->server->capabilities;
if (linuxExtEnabled == 0)
pSesInfo->capabilities &= (~CAP_UNIX);
/* pSesInfo->sequence_number = 0;*/ /* pSesInfo->sequence_number = 0;*/
cFYI(1, cFYI(1, ("Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d",
("Security Mode: 0x%x Capabilities: 0x%x TimeAdjust: %d", pSesInfo->server->secMode,
pSesInfo->server->secMode, pSesInfo->server->capabilities,
pSesInfo->server->capabilities, pSesInfo->server->timeAdj));
pSesInfo->server->timeAdj)); if (experimEnabled < 2)
if (experimEnabled < 2) rc = CIFS_SessSetup(xid, pSesInfo, first_time, nls_info);
rc = CIFS_SessSetup(xid, pSesInfo, else if (extended_security
first_time, nls_info); && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY)
else if (extended_security && (pSesInfo->server->secType == NTLMSSP)) {
&& (pSesInfo->capabilities rc = -EOPNOTSUPP;
& CAP_EXTENDED_SECURITY) } else if (extended_security
&& (pSesInfo->server->secType == NTLMSSP)) { && (pSesInfo->capabilities & CAP_EXTENDED_SECURITY)
rc = -EOPNOTSUPP; && (pSesInfo->server->secType == RawNTLMSSP)) {
} else if (extended_security cFYI(1, ("NTLMSSP sesssetup"));
&& (pSesInfo->capabilities & CAP_EXTENDED_SECURITY) rc = CIFSNTLMSSPNegotiateSessSetup(xid, pSesInfo, &ntlmv2_flag,
&& (pSesInfo->server->secType == RawNTLMSSP)) { nls_info);
cFYI(1, ("NTLMSSP sesssetup")); if (!rc) {
rc = CIFSNTLMSSPNegotiateSessSetup(xid, if (ntlmv2_flag) {
pSesInfo, char *v2_response;
&ntlmv2_flag, cFYI(1, ("more secure NTLM ver2 hash"));
nls_info); if (CalcNTLMv2_partial_mac_key(pSesInfo,
if (!rc) { nls_info)) {
if (ntlmv2_flag) { rc = -ENOMEM;
char *v2_response; goto ss_err_exit;
cFYI(1, ("more secure NTLM ver2 hash")); } else
if (CalcNTLMv2_partial_mac_key(pSesInfo, v2_response = kmalloc(16 + 64 /* blob*/,
nls_info)) { GFP_KERNEL);
rc = -ENOMEM; if (v2_response) {
goto ss_err_exit; CalcNTLMv2_response(pSesInfo,
} else v2_response);
v2_response = kmalloc(16 + 64 /* blob */, GFP_KERNEL); /* if (first_time)
if (v2_response) { cifs_calculate_ntlmv2_mac_key */
CalcNTLMv2_response(pSesInfo, kfree(v2_response);
v2_response);
/* if (first_time)
cifs_calculate_ntlmv2_mac_key(
pSesInfo->server->mac_signing_key,
response, ntlm_session_key,*/
kfree(v2_response);
/* BB Put dummy sig in SessSetup PDU? */ /* BB Put dummy sig in SessSetup PDU? */
} else {
rc = -ENOMEM;
goto ss_err_exit;
}
} else { } else {
SMBNTencrypt(pSesInfo->password, rc = -ENOMEM;
pSesInfo->server->cryptKey, goto ss_err_exit;
ntlm_session_key);
if (first_time)
cifs_calculate_mac_key(
&pSesInfo->server->mac_signing_key,
ntlm_session_key,
pSesInfo->password);
} }
} else {
SMBNTencrypt(pSesInfo->password,
pSesInfo->server->cryptKey,
ntlm_session_key);
if (first_time)
cifs_calculate_mac_key(
&pSesInfo->server->mac_signing_key,
ntlm_session_key,
pSesInfo->password);
}
/* for better security the weaker lanman hash not sent /* for better security the weaker lanman hash not sent
in AuthSessSetup so we no longer calculate it */ in AuthSessSetup so we no longer calculate it */
rc = CIFSNTLMSSPAuthSessSetup(xid, rc = CIFSNTLMSSPAuthSessSetup(xid, pSesInfo,
pSesInfo, ntlm_session_key,
ntlm_session_key, ntlmv2_flag,
ntlmv2_flag, nls_info);
nls_info); }
} } else { /* old style NTLM 0.12 session setup */
} else { /* old style NTLM 0.12 session setup */ SMBNTencrypt(pSesInfo->password, pSesInfo->server->cryptKey,
SMBNTencrypt(pSesInfo->password, ntlm_session_key);
pSesInfo->server->cryptKey,
ntlm_session_key);
if (first_time) if (first_time)
cifs_calculate_mac_key( cifs_calculate_mac_key(
&pSesInfo->server->mac_signing_key, &pSesInfo->server->mac_signing_key,
ntlm_session_key, pSesInfo->password); ntlm_session_key, pSesInfo->password);
rc = CIFSSessSetup(xid, pSesInfo, rc = CIFSSessSetup(xid, pSesInfo, ntlm_session_key, nls_info);
ntlm_session_key, nls_info); }
} if (rc) {
if (rc) { cERROR(1, ("Send error in SessSetup = %d", rc));
cERROR(1, ("Send error in SessSetup = %d", rc)); } else {
} else { cFYI(1, ("CIFS Session Established successfully"));
cFYI(1, ("CIFS Session Established successfully"));
pSesInfo->status = CifsGood; pSesInfo->status = CifsGood;
}
} }
ss_err_exit: ss_err_exit:
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment