aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2007-10-16 13:57:55 -0400
committerSteve French <sfrench@us.ibm.com>2007-10-16 13:57:55 -0400
commit6345a3a88012b0060ddeca8874e51cb442e1fb20 (patch)
tree0cb1b4ae8f0190f8c2b504bd2a10358810dae374 /fs/cifs/connect.c
parent0d3a01fadacef5901005dc8f61688a8f0471dc79 (diff)
[CIFS] formatting fixes
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c57
1 files changed, 26 insertions, 31 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index c0cd3ce56e9f..494455ed4352 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -1468,7 +1468,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1468 if (psin_server->sin_port) { /* user overrode default port */ 1468 if (psin_server->sin_port) { /* user overrode default port */
1469 rc = (*csocket)->ops->connect(*csocket, 1469 rc = (*csocket)->ops->connect(*csocket,
1470 (struct sockaddr *) psin_server, 1470 (struct sockaddr *) psin_server,
1471 sizeof (struct sockaddr_in), 0); 1471 sizeof(struct sockaddr_in), 0);
1472 if (rc >= 0) 1472 if (rc >= 0)
1473 connected = 1; 1473 connected = 1;
1474 } 1474 }
@@ -1484,7 +1484,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1484 1484
1485 rc = (*csocket)->ops->connect(*csocket, 1485 rc = (*csocket)->ops->connect(*csocket,
1486 (struct sockaddr *) psin_server, 1486 (struct sockaddr *) psin_server,
1487 sizeof (struct sockaddr_in), 0); 1487 sizeof(struct sockaddr_in), 0);
1488 if (rc >= 0) 1488 if (rc >= 0)
1489 connected = 1; 1489 connected = 1;
1490 } 1490 }
@@ -1493,7 +1493,7 @@ ipv4_connect(struct sockaddr_in *psin_server, struct socket **csocket,
1493 psin_server->sin_port = htons(RFC1001_PORT); 1493 psin_server->sin_port = htons(RFC1001_PORT);
1494 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *) 1494 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *)
1495 psin_server, 1495 psin_server,
1496 sizeof (struct sockaddr_in), 0); 1496 sizeof(struct sockaddr_in), 0);
1497 if (rc >= 0) 1497 if (rc >= 0)
1498 connected = 1; 1498 connected = 1;
1499 } 1499 }
@@ -1601,7 +1601,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1601 if (psin_server->sin6_port) { /* user overrode default port */ 1601 if (psin_server->sin6_port) { /* user overrode default port */
1602 rc = (*csocket)->ops->connect(*csocket, 1602 rc = (*csocket)->ops->connect(*csocket,
1603 (struct sockaddr *) psin_server, 1603 (struct sockaddr *) psin_server,
1604 sizeof (struct sockaddr_in6), 0); 1604 sizeof(struct sockaddr_in6), 0);
1605 if (rc >= 0) 1605 if (rc >= 0)
1606 connected = 1; 1606 connected = 1;
1607 } 1607 }
@@ -1617,7 +1617,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1617 1617
1618 rc = (*csocket)->ops->connect(*csocket, 1618 rc = (*csocket)->ops->connect(*csocket,
1619 (struct sockaddr *) psin_server, 1619 (struct sockaddr *) psin_server,
1620 sizeof (struct sockaddr_in6), 0); 1620 sizeof(struct sockaddr_in6), 0);
1621 if (rc >= 0) 1621 if (rc >= 0)
1622 connected = 1; 1622 connected = 1;
1623 } 1623 }
@@ -1625,7 +1625,7 @@ ipv6_connect(struct sockaddr_in6 *psin_server, struct socket **csocket)
1625 if (!connected) { 1625 if (!connected) {
1626 psin_server->sin6_port = htons(RFC1001_PORT); 1626 psin_server->sin6_port = htons(RFC1001_PORT);
1627 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *) 1627 rc = (*csocket)->ops->connect(*csocket, (struct sockaddr *)
1628 psin_server, sizeof (struct sockaddr_in6), 0); 1628 psin_server, sizeof(struct sockaddr_in6), 0);
1629 if (rc >= 0) 1629 if (rc >= 0)
1630 connected = 1; 1630 connected = 1;
1631 } 1631 }
@@ -1920,7 +1920,7 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
1920 return rc; 1920 return rc;
1921 } else { 1921 } else {
1922 memcpy(&srvTcp->addr.sockAddr, &sin_server, 1922 memcpy(&srvTcp->addr.sockAddr, &sin_server,
1923 sizeof (struct sockaddr_in)); 1923 sizeof(struct sockaddr_in));
1924 atomic_set(&srvTcp->inFlight, 0); 1924 atomic_set(&srvTcp->inFlight, 0);
1925 /* BB Add code for ipv6 case too */ 1925 /* BB Add code for ipv6 case too */
1926 srvTcp->ssocket = csocket; 1926 srvTcp->ssocket = csocket;
@@ -2557,7 +2557,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2557 int remaining_words = 0; 2557 int remaining_words = 0;
2558 int bytes_returned = 0; 2558 int bytes_returned = 0;
2559 int len; 2559 int len;
2560 int SecurityBlobLength = sizeof (NEGOTIATE_MESSAGE); 2560 int SecurityBlobLength = sizeof(NEGOTIATE_MESSAGE);
2561 PNEGOTIATE_MESSAGE SecurityBlob; 2561 PNEGOTIATE_MESSAGE SecurityBlob;
2562 PCHALLENGE_MESSAGE SecurityBlob2; 2562 PCHALLENGE_MESSAGE SecurityBlob2;
2563 __u32 negotiate_flags, capabilities; 2563 __u32 negotiate_flags, capabilities;
@@ -2881,8 +2881,8 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
2881} 2881}
2882static int 2882static int
2883CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses, 2883CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2884 char *ntlm_session_key, int ntlmv2_flag, 2884 char *ntlm_session_key, int ntlmv2_flag,
2885 const struct nls_table *nls_codepage) 2885 const struct nls_table *nls_codepage)
2886{ 2886{
2887 struct smb_hdr *smb_buffer; 2887 struct smb_hdr *smb_buffer;
2888 struct smb_hdr *smb_buffer_response; 2888 struct smb_hdr *smb_buffer_response;
@@ -2895,7 +2895,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2895 int remaining_words = 0; 2895 int remaining_words = 0;
2896 int bytes_returned = 0; 2896 int bytes_returned = 0;
2897 int len; 2897 int len;
2898 int SecurityBlobLength = sizeof (AUTHENTICATE_MESSAGE); 2898 int SecurityBlobLength = sizeof(AUTHENTICATE_MESSAGE);
2899 PAUTHENTICATE_MESSAGE SecurityBlob; 2899 PAUTHENTICATE_MESSAGE SecurityBlob;
2900 __u32 negotiate_flags, capabilities; 2900 __u32 negotiate_flags, capabilities;
2901 __u16 count; 2901 __u16 count;
@@ -2910,8 +2910,8 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2910 return -ENOMEM; 2910 return -ENOMEM;
2911 } 2911 }
2912 smb_buffer_response = smb_buffer; 2912 smb_buffer_response = smb_buffer;
2913 pSMB = (SESSION_SETUP_ANDX *) smb_buffer; 2913 pSMB = (SESSION_SETUP_ANDX *)smb_buffer;
2914 pSMBr = (SESSION_SETUP_ANDX *) smb_buffer_response; 2914 pSMBr = (SESSION_SETUP_ANDX *)smb_buffer_response;
2915 2915
2916 /* send SMBsessionSetup here */ 2916 /* send SMBsessionSetup here */
2917 header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX, 2917 header_assemble(smb_buffer, SMB_COM_SESSION_SETUP_ANDX,
@@ -2930,7 +2930,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2930 smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE; 2930 smb_buffer->Flags2 |= SMBFLG2_SECURITY_SIGNATURE;
2931 2931
2932 capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS | 2932 capabilities = CAP_LARGE_FILES | CAP_NT_SMBS | CAP_LEVEL_II_OPLOCKS |
2933 CAP_EXTENDED_SECURITY; 2933 CAP_EXTENDED_SECURITY;
2934 if (ses->capabilities & CAP_UNICODE) { 2934 if (ses->capabilities & CAP_UNICODE) {
2935 smb_buffer->Flags2 |= SMBFLG2_UNICODE; 2935 smb_buffer->Flags2 |= SMBFLG2_UNICODE;
2936 capabilities |= CAP_UNICODE; 2936 capabilities |= CAP_UNICODE;
@@ -2945,15 +2945,14 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
2945 } 2945 }
2946 pSMB->req.Capabilities = cpu_to_le32(capabilities); 2946 pSMB->req.Capabilities = cpu_to_le32(capabilities);
2947 2947
2948 bcc_ptr = (char *) &pSMB->req.SecurityBlob; 2948 bcc_ptr = (char *)&pSMB->req.SecurityBlob;
2949 SecurityBlob = (PAUTHENTICATE_MESSAGE) bcc_ptr; 2949 SecurityBlob = (PAUTHENTICATE_MESSAGE)bcc_ptr;
2950 strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8); 2950 strncpy(SecurityBlob->Signature, NTLMSSP_SIGNATURE, 8);
2951 SecurityBlob->MessageType = NtLmAuthenticate; 2951 SecurityBlob->MessageType = NtLmAuthenticate;
2952 bcc_ptr += SecurityBlobLength; 2952 bcc_ptr += SecurityBlobLength;
2953 negotiate_flags = 2953 negotiate_flags = NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_REQUEST_TARGET |
2954 NTLMSSP_NEGOTIATE_UNICODE | NTLMSSP_REQUEST_TARGET | 2954 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO |
2955 NTLMSSP_NEGOTIATE_NTLM | NTLMSSP_NEGOTIATE_TARGET_INFO | 2955 0x80000000 | NTLMSSP_NEGOTIATE_128;
2956 0x80000000 | NTLMSSP_NEGOTIATE_128;
2957 if (sign_CIFS_PDUs) 2956 if (sign_CIFS_PDUs)
2958 negotiate_flags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN; 2957 negotiate_flags |= /* NTLMSSP_NEGOTIATE_ALWAYS_SIGN |*/ NTLMSSP_NEGOTIATE_SIGN;
2959 if (ntlmv2_flag) 2958 if (ntlmv2_flag)
@@ -3104,12 +3103,11 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3104 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response, 3103 rc = SendReceive(xid, ses, smb_buffer, smb_buffer_response,
3105 &bytes_returned, 1); 3104 &bytes_returned, 1);
3106 if (rc) { 3105 if (rc) {
3107/* rc = map_smb_to_linux_error(smb_buffer_response); *//* done in SendReceive now */ 3106/* rc = map_smb_to_linux_error(smb_buffer_response) done in SendReceive now */
3108 } else if ((smb_buffer_response->WordCount == 3) 3107 } else if ((smb_buffer_response->WordCount == 3) ||
3109 || (smb_buffer_response->WordCount == 4)) { 3108 (smb_buffer_response->WordCount == 4)) {
3110 __u16 action = le16_to_cpu(pSMBr->resp.Action); 3109 __u16 action = le16_to_cpu(pSMBr->resp.Action);
3111 __u16 blob_len = 3110 __u16 blob_len = le16_to_cpu(pSMBr->resp.SecurityBlobLength);
3112 le16_to_cpu(pSMBr->resp.SecurityBlobLength);
3113 if (action & GUEST_LOGIN) 3111 if (action & GUEST_LOGIN)
3114 cFYI(1, (" Guest login")); /* BB Should we set anything 3112 cFYI(1, (" Guest login")); /* BB Should we set anything
3115 in SesInfo struct ? */ 3113 in SesInfo struct ? */
@@ -3263,22 +3261,19 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
3263 bcc_ptr[0] = 0; 3261 bcc_ptr[0] = 0;
3264 bcc_ptr++; 3262 bcc_ptr++;
3265 } else 3263 } else
3266 cFYI(1, 3264 cFYI(1, ("field of length %d "
3267 ("field of length %d "
3268 "extends beyond end of smb ", 3265 "extends beyond end of smb ",
3269 len)); 3266 len));
3270 } 3267 }
3271 } else { 3268 } else {
3272 cERROR(1, 3269 cERROR(1, ("Security Blob extends beyond end "
3273 (" Security Blob extends beyond end "
3274 "of SMB")); 3270 "of SMB"));
3275 } 3271 }
3276 } else { 3272 } else {
3277 cERROR(1, ("No session structure passed in.")); 3273 cERROR(1, ("No session structure passed in."));
3278 } 3274 }
3279 } else { 3275 } else {
3280 cERROR(1, 3276 cERROR(1, ("Invalid Word count %d: ",
3281 (" Invalid Word count %d: ",
3282 smb_buffer_response->WordCount)); 3277 smb_buffer_response->WordCount));
3283 rc = -EIO; 3278 rc = -EIO;
3284 } 3279 }