cifs: revert needless change in decode_negTokenInit
Subsystems (2)
PATCH 1/1 cifs: revert needless change in decode_negTokenInit
9fbc590860e75785bdaf8b83e48fabfe4d4f7d58 needlessly changed some "else if" statements in decode_negTokenInit to "if's". Not only was the change not needed, but it's less efficient than the existing code.
When compare_oid returns true, then it's guaranteed to return false in the other cases. Therefore, there's no reason to keep comparing it.
--- fs/cifs/asn1.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
fs/cifs/asn1.c +3 -3
@@ -597,13 +597,13 @@ decode_negTokenInit(unsigned char *security_blob, int length,if (compare_oid (oid, oidlen,MSKRB5_OID ,MSKRB5_OID_LEN )) server->sec_mskerberos = true; -if (compare_oid (oid, oidlen,KRB5U2U_OID , +else if (compare_oid (oid, oidlen,KRB5U2U_OID ,KRB5U2U_OID_LEN )) server->sec_kerberosu2u = true; -if (compare_oid (oid, oidlen,KRB5_OID , +else if (compare_oid (oid, oidlen,KRB5_OID ,KRB5_OID_LEN )) server->sec_kerberos = true; -if (compare_oid (oid, oidlen,NTLMSSP_OID , +else if (compare_oid (oid, oidlen,NTLMSSP_OID ,NTLMSSP_OID_LEN )) server->sec_ntlmssp = true;
Signature · 1 line
1.7.2.2
A message that is not in the archive (sent off-list or not yet received): 1283173524-31920-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org
Shirish Pargaonkar
Tested-byQuoted 37 lines · Jeff Layton
9fbc590860e75785bdaf8b83e48fabfe4d4f7d58needlessly changed some "else if" statements indecode_negTokenInitto "if's". Not only was the change not needed, but it's less efficient than the existing code.When
compare_oidreturns true, then it's guaranteed to return false in the other cases. Therefore, there's no reason to keep comparing it.Cc Shirish Pargaonkar <[email protected]>Signed-off-by Jeff Layton <[email protected]>---
fs/cifs/asn1.c | 6 +++---1 files changed, 3 insertions(+), 3 deletions(-)fs/cifs/asn1.c +3
-4@@ -597,13 +597,13 @@ decode_negTokenInit(unsigned char *security_blob, int length, if (compare_oid(oid, oidlen, MSKRB5_OID, MSKRB5_OID_LEN)) server->sec_mskerberos = true; - if (compare_oid(oid, oidlen, KRB5U2U_OID, + else if (compare_oid(oid, oidlen, KRB5U2U_OID, KRB5U2U_OID_LEN)) server->sec_kerberosu2u = true; - if (compare_oid(oid, oidlen, KRB5_OID, + else if (compare_oid(oid, oidlen, KRB5_OID, KRB5_OID_LEN)) server->sec_kerberos = true; - if (compare_oid(oid, oidlen, NTLMSSP_OID, + else if (compare_oid(oid, oidlen, NTLMSSP_OID, NTLMSSP_OID_LEN)) server->sec_ntlmssp = true; --1.7.2.2
Quoted 5 lines
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Agree. I misunderstood the code. In function decode_negTokenInit, this comparison
is repeated (while) for every auth mech returned by server that neg prot response.
merged
Quoted 42 lines · Jeff Layton
9fbc590860e75785bdaf8b83e48fabfe4d4f7d58needlessly changed some "else if" statements indecode_negTokenInitto "if's". Not only was the change not needed, but it's less efficient than the existing code.When
compare_oidreturns true, then it's guaranteed to return false in the other cases. Therefore, there's no reason to keep comparing it.Cc Shirish Pargaonkar <[email protected]>Signed-off-by Jeff Layton <[email protected]>---
fs/cifs/asn1.c | 6 +++---1 files changed, 3 insertions(+), 3 deletions(-)fs/cifs/asn1.c +3
-4@@ -597,13 +597,13 @@ decode_negTokenInit(unsigned char *security_blob, int length, if (compare_oid(oid, oidlen, MSKRB5_OID, MSKRB5_OID_LEN)) server->sec_mskerberos = true; - if (compare_oid(oid, oidlen, KRB5U2U_OID, + else if (compare_oid(oid, oidlen, KRB5U2U_OID, KRB5U2U_OID_LEN)) server->sec_kerberosu2u = true; - if (compare_oid(oid, oidlen, KRB5_OID, + else if (compare_oid(oid, oidlen, KRB5_OID, KRB5_OID_LEN)) server->sec_kerberos = true; - if (compare_oid(oid, oidlen, NTLMSSP_OID, + else if (compare_oid(oid, oidlen, NTLMSSP_OID, NTLMSSP_OID_LEN)) server->sec_ntlmssp = true; --1.7.2.2
--
To unsubscribe from this list: send the line "unsubscribe linux-cifs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 3 lines
Thanks, Steve