* [PATCH] cifs: revert needless change in decode_negTokenInit
@ 2010-08-30 13:05 Jeff Layton
[not found] ` <1283173524-31920-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Jeff Layton @ 2010-08-30 13:05 UTC (permalink / raw)
To: smfrench-Re5JQEeQqe8AvxtiuMwx3w
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w
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.
Cc: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
fs/cifs/asn1.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
index 21f0fbd..cfd1ce3 100644
--- a/fs/cifs/asn1.c
+++ b/fs/cifs/asn1.c
@@ -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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: revert needless change in decode_negTokenInit
[not found] ` <1283173524-31920-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2010-08-30 15:32 ` Shirish Pargaonkar
2010-08-30 17:41 ` Steve French
1 sibling, 0 replies; 3+ messages in thread
From: Shirish Pargaonkar @ 2010-08-30 15:32 UTC (permalink / raw)
To: Jeff Layton
Cc: smfrench-Re5JQEeQqe8AvxtiuMwx3w,
linux-cifs-u79uwXL29TY76Z2rM5mHXA
On Mon, Aug 30, 2010 at 8:05 AM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> 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.
>
> Cc: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> fs/cifs/asn1.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
> index 21f0fbd..cfd1ce3 100644
> --- a/fs/cifs/asn1.c
> +++ b/fs/cifs/asn1.c
> @@ -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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> 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.
Tested-by: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] cifs: revert needless change in decode_negTokenInit
[not found] ` <1283173524-31920-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-08-30 15:32 ` Shirish Pargaonkar
@ 2010-08-30 17:41 ` Steve French
1 sibling, 0 replies; 3+ messages in thread
From: Steve French @ 2010-08-30 17:41 UTC (permalink / raw)
To: Jeff Layton
Cc: linux-cifs-u79uwXL29TY76Z2rM5mHXA,
shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w
merged
On Mon, Aug 30, 2010 at 8:05 AM, Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> 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.
>
> Cc: Shirish Pargaonkar <shirishpargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Jeff Layton <jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> ---
> fs/cifs/asn1.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/fs/cifs/asn1.c b/fs/cifs/asn1.c
> index 21f0fbd..cfd1ce3 100644
> --- a/fs/cifs/asn1.c
> +++ b/fs/cifs/asn1.c
> @@ -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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-08-30 17:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-30 13:05 [PATCH] cifs: revert needless change in decode_negTokenInit Jeff Layton
[not found] ` <1283173524-31920-1-git-send-email-jlayton-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2010-08-30 15:32 ` Shirish Pargaonkar
2010-08-30 17:41 ` Steve French
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox