Commit 2f0e58ac authored by Jeff Layton's avatar Jeff Layton Committed by Steve French

[CIFS] remove level of indentation from decode_negTokenInit

Most of this function takes place inside of an unnecessary "else"
clause. The other 2 cases both return 0, so we can remove some
indentation here.
Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent 17680356
...@@ -483,6 +483,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -483,6 +483,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
asn1_open(&ctx, security_blob, length); asn1_open(&ctx, security_blob, length);
/* GSSAPI header */
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, ("Error decoding negTokenInit header")); cFYI(1, ("Error decoding negTokenInit header"));
return 0; return 0;
...@@ -490,16 +491,16 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -490,16 +491,16 @@ decode_negTokenInit(unsigned char *security_blob, int length,
|| (tag != ASN1_EOC)) { || (tag != ASN1_EOC)) {
cFYI(1, ("cls = %d con = %d tag = %d", cls, con, tag)); cFYI(1, ("cls = %d con = %d tag = %d", cls, con, tag));
return 0; return 0;
} else { }
/* remember to free obj->oid */
/* Check for SPNEGO OID -- remember to free obj->oid */
rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag); rc = asn1_header_decode(&ctx, &end, &cls, &con, &tag);
if (rc) { if (rc) {
if ((tag == ASN1_OJI) && (con == ASN1_PRI) && if ((tag == ASN1_OJI) && (con == ASN1_PRI) &&
(cls == ASN1_UNI)) { (cls == ASN1_UNI)) {
rc = asn1_oid_decode(&ctx, end, &oid, &oidlen); rc = asn1_oid_decode(&ctx, end, &oid, &oidlen);
if (rc) { if (rc) {
rc = compare_oid(oid, oidlen, rc = compare_oid(oid, oidlen, SPNEGO_OID,
SPNEGO_OID,
SPNEGO_OID_LEN); SPNEGO_OID_LEN);
kfree(oid); kfree(oid);
} }
...@@ -507,6 +508,7 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -507,6 +508,7 @@ decode_negTokenInit(unsigned char *security_blob, int length,
rc = 0; rc = 0;
} }
/* SPNEGO OID not present or garbled -- bail out */
if (!rc) { if (!rc) {
cFYI(1, ("Error decoding negTokenInit header")); cFYI(1, ("Error decoding negTokenInit header"));
return 0; return 0;
...@@ -567,22 +569,17 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -567,22 +569,17 @@ decode_negTokenInit(unsigned char *security_blob, int length,
if ((tag == ASN1_OJI) && (con == ASN1_PRI)) { if ((tag == ASN1_OJI) && (con == ASN1_PRI)) {
if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) { if (asn1_oid_decode(&ctx, end, &oid, &oidlen)) {
cFYI(1, cFYI(1, ("OID len = %d oid = 0x%lx 0x%lx "
("OID len = %d oid = 0x%lx 0x%lx " "0x%lx 0x%lx", oidlen, *oid,
"0x%lx 0x%lx", *(oid + 1), *(oid + 2), *(oid + 3)));
oidlen, *oid, *(oid + 1),
*(oid + 2), *(oid + 3)));
if (compare_oid(oid, oidlen, if (compare_oid(oid, oidlen, MSKRB5_OID,
MSKRB5_OID,
MSKRB5_OID_LEN)) MSKRB5_OID_LEN))
use_kerberos = true; use_kerberos = true;
else if (compare_oid(oid, oidlen, else if (compare_oid(oid, oidlen, KRB5_OID,
KRB5_OID,
KRB5_OID_LEN)) KRB5_OID_LEN))
use_kerberos = true; use_kerberos = true;
else if (compare_oid(oid, oidlen, else if (compare_oid(oid, oidlen, NTLMSSP_OID,
NTLMSSP_OID,
NTLMSSP_OID_LEN)) NTLMSSP_OID_LEN))
use_ntlmssp = true; use_ntlmssp = true;
...@@ -594,19 +591,16 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -594,19 +591,16 @@ decode_negTokenInit(unsigned char *security_blob, int length,
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1, ("Error decoding last part negTokenInit exit3"));
("Error decoding last part negTokenInit exit3"));
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
/* tag = 3 indicating mechListMIC */ /* tag = 3 indicating mechListMIC */
cFYI(1, cFYI(1, ("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
("Exit 4 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
return 0; return 0;
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1, ("Error decoding last part negTokenInit exit5"));
("Error decoding last part negTokenInit exit5"));
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_CON) } else if ((cls != ASN1_UNI) || (con != ASN1_CON)
|| (tag != ASN1_SEQ)) { || (tag != ASN1_SEQ)) {
...@@ -615,29 +609,24 @@ decode_negTokenInit(unsigned char *security_blob, int length, ...@@ -615,29 +609,24 @@ decode_negTokenInit(unsigned char *security_blob, int length,
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1, ("Error decoding last part negTokenInit exit 7"));
("Error decoding last part negTokenInit exit 7"));
return 0; return 0;
} else if ((cls != ASN1_CTX) || (con != ASN1_CON)) { } else if ((cls != ASN1_CTX) || (con != ASN1_CON)) {
cFYI(1, cFYI(1, ("Exit 8 cls = %d con = %d tag = %d end = %p (%d)",
("Exit 8 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
return 0; return 0;
} }
if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) { if (asn1_header_decode(&ctx, &end, &cls, &con, &tag) == 0) {
cFYI(1, cFYI(1, ("Error decoding last part negTokenInit exit9"));
("Error decoding last part negTokenInit exit9"));
return 0; return 0;
} else if ((cls != ASN1_UNI) || (con != ASN1_PRI) } else if ((cls != ASN1_UNI) || (con != ASN1_PRI)
|| (tag != ASN1_GENSTR)) { || (tag != ASN1_GENSTR)) {
cFYI(1, cFYI(1, ("Exit10 cls = %d con = %d tag = %d end = %p (%d)",
("Exit10 cls = %d con = %d tag = %d end = %p (%d)",
cls, con, tag, end, *end)); cls, con, tag, end, *end));
return 0; return 0;
} }
cFYI(1, ("Need to call asn1_octets_decode() function for %s", cFYI(1, ("Need to call asn1_octets_decode() function for %s",
ctx.pointer)); /* is this UTF-8 or ASCII? */ ctx.pointer)); /* is this UTF-8 or ASCII? */
}
if (use_kerberos) if (use_kerberos)
*secType = Kerberos; *secType = Kerberos;
......
...@@ -101,5 +101,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg); ...@@ -101,5 +101,5 @@ extern long cifs_ioctl(struct file *filep, unsigned int cmd, unsigned long arg);
extern const struct export_operations cifs_export_ops; extern const struct export_operations cifs_export_ops;
#endif /* EXPERIMENTAL */ #endif /* EXPERIMENTAL */
#define CIFS_VERSION "1.53" #define CIFS_VERSION "1.54"
#endif /* _CIFSFS_H */ #endif /* _CIFSFS_H */
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