aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/sess.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-04-20 23:50:45 -0400
committerSteve French <sfrench@us.ibm.com>2010-04-20 23:50:45 -0400
commitb6b38f704a8193daba520493ebdaf7e819962fc8 (patch)
treec38f4557b51b33573e36817888afa2accf3da9ca /fs/cifs/sess.c
parent315e995c63a15cb4d4efdbfd70fe2db191917f7a (diff)
[CIFS] Neaten cERROR and cFYI macros, reduce text space
Neaten cERROR and cFYI macros, reduce text space ~2.5K Convert '__FILE__ ": " fmt' to '"%s: " fmt', __FILE__' to save text space Surround macros with do {} while Add parentheses to macros Make statement expression macro from macro with assign Remove now unnecessary parentheses from cFYI and cERROR uses defconfig with CIFS support old $ size fs/cifs/built-in.o text data bss dec hex filename 156012 1760 148 157920 268e0 fs/cifs/built-in.o defconfig with CIFS support old $ size fs/cifs/built-in.o text data bss dec hex filename 153508 1760 148 155416 25f18 fs/cifs/built-in.o allyesconfig old: $ size fs/cifs/built-in.o text data bss dec hex filename 309138 3864 74824 387826 5eaf2 fs/cifs/built-in.o allyesconfig new $ size fs/cifs/built-in.o text data bss dec hex filename 305655 3864 74824 384343 5dd57 fs/cifs/built-in.o Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/sess.c')
-rw-r--r--fs/cifs/sess.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/fs/cifs/sess.c b/fs/cifs/sess.c
index 7c3fd7463f44..da9729da03e0 100644
--- a/fs/cifs/sess.c
+++ b/fs/cifs/sess.c
@@ -284,7 +284,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
284 int len; 284 int len;
285 char *data = *pbcc_area; 285 char *data = *pbcc_area;
286 286
287 cFYI(1, ("bleft %d", bleft)); 287 cFYI(1, "bleft %d", bleft);
288 288
289 /* 289 /*
290 * Windows servers do not always double null terminate their final 290 * Windows servers do not always double null terminate their final
@@ -301,7 +301,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
301 301
302 kfree(ses->serverOS); 302 kfree(ses->serverOS);
303 ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp); 303 ses->serverOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp);
304 cFYI(1, ("serverOS=%s", ses->serverOS)); 304 cFYI(1, "serverOS=%s", ses->serverOS);
305 len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2; 305 len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2;
306 data += len; 306 data += len;
307 bleft -= len; 307 bleft -= len;
@@ -310,7 +310,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
310 310
311 kfree(ses->serverNOS); 311 kfree(ses->serverNOS);
312 ses->serverNOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp); 312 ses->serverNOS = cifs_strndup_from_ucs(data, bleft, true, nls_cp);
313 cFYI(1, ("serverNOS=%s", ses->serverNOS)); 313 cFYI(1, "serverNOS=%s", ses->serverNOS);
314 len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2; 314 len = (UniStrnlen((wchar_t *) data, bleft / 2) * 2) + 2;
315 data += len; 315 data += len;
316 bleft -= len; 316 bleft -= len;
@@ -319,7 +319,7 @@ decode_unicode_ssetup(char **pbcc_area, int bleft, struct cifsSesInfo *ses,
319 319
320 kfree(ses->serverDomain); 320 kfree(ses->serverDomain);
321 ses->serverDomain = cifs_strndup_from_ucs(data, bleft, true, nls_cp); 321 ses->serverDomain = cifs_strndup_from_ucs(data, bleft, true, nls_cp);
322 cFYI(1, ("serverDomain=%s", ses->serverDomain)); 322 cFYI(1, "serverDomain=%s", ses->serverDomain);
323 323
324 return; 324 return;
325} 325}
@@ -332,7 +332,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
332 int len; 332 int len;
333 char *bcc_ptr = *pbcc_area; 333 char *bcc_ptr = *pbcc_area;
334 334
335 cFYI(1, ("decode sessetup ascii. bleft %d", bleft)); 335 cFYI(1, "decode sessetup ascii. bleft %d", bleft);
336 336
337 len = strnlen(bcc_ptr, bleft); 337 len = strnlen(bcc_ptr, bleft);
338 if (len >= bleft) 338 if (len >= bleft)
@@ -344,7 +344,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
344 if (ses->serverOS) 344 if (ses->serverOS)
345 strncpy(ses->serverOS, bcc_ptr, len); 345 strncpy(ses->serverOS, bcc_ptr, len);
346 if (strncmp(ses->serverOS, "OS/2", 4) == 0) { 346 if (strncmp(ses->serverOS, "OS/2", 4) == 0) {
347 cFYI(1, ("OS/2 server")); 347 cFYI(1, "OS/2 server");
348 ses->flags |= CIFS_SES_OS2; 348 ses->flags |= CIFS_SES_OS2;
349 } 349 }
350 350
@@ -373,7 +373,7 @@ static int decode_ascii_ssetup(char **pbcc_area, int bleft,
373 /* BB For newer servers which do not support Unicode, 373 /* BB For newer servers which do not support Unicode,
374 but thus do return domain here we could add parsing 374 but thus do return domain here we could add parsing
375 for it later, but it is not very important */ 375 for it later, but it is not very important */
376 cFYI(1, ("ascii: bytes left %d", bleft)); 376 cFYI(1, "ascii: bytes left %d", bleft);
377 377
378 return rc; 378 return rc;
379} 379}
@@ -384,16 +384,16 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
384 CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr; 384 CHALLENGE_MESSAGE *pblob = (CHALLENGE_MESSAGE *)bcc_ptr;
385 385
386 if (blob_len < sizeof(CHALLENGE_MESSAGE)) { 386 if (blob_len < sizeof(CHALLENGE_MESSAGE)) {
387 cERROR(1, ("challenge blob len %d too small", blob_len)); 387 cERROR(1, "challenge blob len %d too small", blob_len);
388 return -EINVAL; 388 return -EINVAL;
389 } 389 }
390 390
391 if (memcmp(pblob->Signature, "NTLMSSP", 8)) { 391 if (memcmp(pblob->Signature, "NTLMSSP", 8)) {
392 cERROR(1, ("blob signature incorrect %s", pblob->Signature)); 392 cERROR(1, "blob signature incorrect %s", pblob->Signature);
393 return -EINVAL; 393 return -EINVAL;
394 } 394 }
395 if (pblob->MessageType != NtLmChallenge) { 395 if (pblob->MessageType != NtLmChallenge) {
396 cERROR(1, ("Incorrect message type %d", pblob->MessageType)); 396 cERROR(1, "Incorrect message type %d", pblob->MessageType);
397 return -EINVAL; 397 return -EINVAL;
398 } 398 }
399 399
@@ -583,7 +583,7 @@ CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses, int first_time,
583 583
584 type = ses->server->secType; 584 type = ses->server->secType;
585 585
586 cFYI(1, ("sess setup type %d", type)); 586 cFYI(1, "sess setup type %d", type);
587ssetup_ntlmssp_authenticate: 587ssetup_ntlmssp_authenticate:
588 if (phase == NtLmChallenge) 588 if (phase == NtLmChallenge)
589 phase = NtLmAuthenticate; /* if ntlmssp, now final phase */ 589 phase = NtLmAuthenticate; /* if ntlmssp, now final phase */
@@ -664,7 +664,7 @@ ssetup_ntlmssp_authenticate:
664 changed to do higher than lanman dialect and 664 changed to do higher than lanman dialect and
665 we reconnected would we ever calc signing_key? */ 665 we reconnected would we ever calc signing_key? */
666 666
667 cFYI(1, ("Negotiating LANMAN setting up strings")); 667 cFYI(1, "Negotiating LANMAN setting up strings");
668 /* Unicode not allowed for LANMAN dialects */ 668 /* Unicode not allowed for LANMAN dialects */
669 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); 669 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
670#endif 670#endif
@@ -758,17 +758,17 @@ ssetup_ntlmssp_authenticate:
758 /* check version field to make sure that cifs.upcall is 758 /* check version field to make sure that cifs.upcall is
759 sending us a response in an expected form */ 759 sending us a response in an expected form */
760 if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) { 760 if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) {
761 cERROR(1, ("incorrect version of cifs.upcall (expected" 761 cERROR(1, "incorrect version of cifs.upcall (expected"
762 " %d but got %d)", 762 " %d but got %d)",
763 CIFS_SPNEGO_UPCALL_VERSION, msg->version)); 763 CIFS_SPNEGO_UPCALL_VERSION, msg->version);
764 rc = -EKEYREJECTED; 764 rc = -EKEYREJECTED;
765 goto ssetup_exit; 765 goto ssetup_exit;
766 } 766 }
767 /* bail out if key is too long */ 767 /* bail out if key is too long */
768 if (msg->sesskey_len > 768 if (msg->sesskey_len >
769 sizeof(ses->server->mac_signing_key.data.krb5)) { 769 sizeof(ses->server->mac_signing_key.data.krb5)) {
770 cERROR(1, ("Kerberos signing key too long (%u bytes)", 770 cERROR(1, "Kerberos signing key too long (%u bytes)",
771 msg->sesskey_len)); 771 msg->sesskey_len);
772 rc = -EOVERFLOW; 772 rc = -EOVERFLOW;
773 goto ssetup_exit; 773 goto ssetup_exit;
774 } 774 }
@@ -796,7 +796,7 @@ ssetup_ntlmssp_authenticate:
796 /* BB: is this right? */ 796 /* BB: is this right? */
797 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp); 797 ascii_ssetup_strings(&bcc_ptr, ses, nls_cp);
798#else /* ! CONFIG_CIFS_UPCALL */ 798#else /* ! CONFIG_CIFS_UPCALL */
799 cERROR(1, ("Kerberos negotiated but upcall support disabled!")); 799 cERROR(1, "Kerberos negotiated but upcall support disabled!");
800 rc = -ENOSYS; 800 rc = -ENOSYS;
801 goto ssetup_exit; 801 goto ssetup_exit;
802#endif /* CONFIG_CIFS_UPCALL */ 802#endif /* CONFIG_CIFS_UPCALL */
@@ -804,12 +804,12 @@ ssetup_ntlmssp_authenticate:
804#ifdef CONFIG_CIFS_EXPERIMENTAL 804#ifdef CONFIG_CIFS_EXPERIMENTAL
805 if (type == RawNTLMSSP) { 805 if (type == RawNTLMSSP) {
806 if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) { 806 if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) {
807 cERROR(1, ("NTLMSSP requires Unicode support")); 807 cERROR(1, "NTLMSSP requires Unicode support");
808 rc = -ENOSYS; 808 rc = -ENOSYS;
809 goto ssetup_exit; 809 goto ssetup_exit;
810 } 810 }
811 811
812 cFYI(1, ("ntlmssp session setup phase %d", phase)); 812 cFYI(1, "ntlmssp session setup phase %d", phase);
813 pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; 813 pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
814 capabilities |= CAP_EXTENDED_SECURITY; 814 capabilities |= CAP_EXTENDED_SECURITY;
815 pSMB->req.Capabilities |= cpu_to_le32(capabilities); 815 pSMB->req.Capabilities |= cpu_to_le32(capabilities);
@@ -827,7 +827,7 @@ ssetup_ntlmssp_authenticate:
827 on the response (challenge) */ 827 on the response (challenge) */
828 smb_buf->Uid = ses->Suid; 828 smb_buf->Uid = ses->Suid;
829 } else { 829 } else {
830 cERROR(1, ("invalid phase %d", phase)); 830 cERROR(1, "invalid phase %d", phase);
831 rc = -ENOSYS; 831 rc = -ENOSYS;
832 goto ssetup_exit; 832 goto ssetup_exit;
833 } 833 }
@@ -839,12 +839,12 @@ ssetup_ntlmssp_authenticate:
839 } 839 }
840 unicode_oslm_strings(&bcc_ptr, nls_cp); 840 unicode_oslm_strings(&bcc_ptr, nls_cp);
841 } else { 841 } else {
842 cERROR(1, ("secType %d not supported!", type)); 842 cERROR(1, "secType %d not supported!", type);
843 rc = -ENOSYS; 843 rc = -ENOSYS;
844 goto ssetup_exit; 844 goto ssetup_exit;
845 } 845 }
846#else 846#else
847 cERROR(1, ("secType %d not supported!", type)); 847 cERROR(1, "secType %d not supported!", type);
848 rc = -ENOSYS; 848 rc = -ENOSYS;
849 goto ssetup_exit; 849 goto ssetup_exit;
850#endif 850#endif
@@ -862,7 +862,7 @@ ssetup_ntlmssp_authenticate:
862 CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR); 862 CIFS_STD_OP /* not long */ | CIFS_LOG_ERROR);
863 /* SMB request buf freed in SendReceive2 */ 863 /* SMB request buf freed in SendReceive2 */
864 864
865 cFYI(1, ("ssetup rc from sendrecv2 is %d", rc)); 865 cFYI(1, "ssetup rc from sendrecv2 is %d", rc);
866 866
867 pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base; 867 pSMB = (SESSION_SETUP_ANDX *)iov[0].iov_base;
868 smb_buf = (struct smb_hdr *)iov[0].iov_base; 868 smb_buf = (struct smb_hdr *)iov[0].iov_base;
@@ -870,7 +870,7 @@ ssetup_ntlmssp_authenticate:
870 if ((type == RawNTLMSSP) && (smb_buf->Status.CifsError == 870 if ((type == RawNTLMSSP) && (smb_buf->Status.CifsError ==
871 cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))) { 871 cpu_to_le32(NT_STATUS_MORE_PROCESSING_REQUIRED))) {
872 if (phase != NtLmNegotiate) { 872 if (phase != NtLmNegotiate) {
873 cERROR(1, ("Unexpected more processing error")); 873 cERROR(1, "Unexpected more processing error");
874 goto ssetup_exit; 874 goto ssetup_exit;
875 } 875 }
876 /* NTLMSSP Negotiate sent now processing challenge (response) */ 876 /* NTLMSSP Negotiate sent now processing challenge (response) */
@@ -882,14 +882,14 @@ ssetup_ntlmssp_authenticate:
882 882
883 if ((smb_buf->WordCount != 3) && (smb_buf->WordCount != 4)) { 883 if ((smb_buf->WordCount != 3) && (smb_buf->WordCount != 4)) {
884 rc = -EIO; 884 rc = -EIO;
885 cERROR(1, ("bad word count %d", smb_buf->WordCount)); 885 cERROR(1, "bad word count %d", smb_buf->WordCount);
886 goto ssetup_exit; 886 goto ssetup_exit;
887 } 887 }
888 action = le16_to_cpu(pSMB->resp.Action); 888 action = le16_to_cpu(pSMB->resp.Action);
889 if (action & GUEST_LOGIN) 889 if (action & GUEST_LOGIN)
890 cFYI(1, ("Guest login")); /* BB mark SesInfo struct? */ 890 cFYI(1, "Guest login"); /* BB mark SesInfo struct? */
891 ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */ 891 ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */
892 cFYI(1, ("UID = %d ", ses->Suid)); 892 cFYI(1, "UID = %d ", ses->Suid);
893 /* response can have either 3 or 4 word count - Samba sends 3 */ 893 /* response can have either 3 or 4 word count - Samba sends 3 */
894 /* and lanman response is 3 */ 894 /* and lanman response is 3 */
895 bytes_remaining = BCC(smb_buf); 895 bytes_remaining = BCC(smb_buf);
@@ -899,7 +899,7 @@ ssetup_ntlmssp_authenticate:
899 __u16 blob_len; 899 __u16 blob_len;
900 blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength); 900 blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength);
901 if (blob_len > bytes_remaining) { 901 if (blob_len > bytes_remaining) {
902 cERROR(1, ("bad security blob length %d", blob_len)); 902 cERROR(1, "bad security blob length %d", blob_len);
903 rc = -EINVAL; 903 rc = -EINVAL;
904 goto ssetup_exit; 904 goto ssetup_exit;
905 } 905 }
@@ -933,7 +933,7 @@ ssetup_exit:
933 } 933 }
934 kfree(str_area); 934 kfree(str_area);
935 if (resp_buf_type == CIFS_SMALL_BUFFER) { 935 if (resp_buf_type == CIFS_SMALL_BUFFER) {
936 cFYI(1, ("ssetup freeing small buf %p", iov[0].iov_base)); 936 cFYI(1, "ssetup freeing small buf %p", iov[0].iov_base);
937 cifs_small_buf_release(iov[0].iov_base); 937 cifs_small_buf_release(iov[0].iov_base);
938 } else if (resp_buf_type == CIFS_LARGE_BUFFER) 938 } else if (resp_buf_type == CIFS_LARGE_BUFFER)
939 cifs_buf_release(iov[0].iov_base); 939 cifs_buf_release(iov[0].iov_base);