Commit 8bae4419 authored by Namjae Jeon's avatar Namjae Jeon

cifsd: add goto fail in neg_token_init_mech_type()

Add goto fail in neg_token_init_mech_type().
Reviewed-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarNamjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 3566a2b0
...@@ -284,14 +284,10 @@ int neg_token_init_mech_type(void *context, size_t hdrlen, ...@@ -284,14 +284,10 @@ int neg_token_init_mech_type(void *context, size_t hdrlen,
unsigned long *oid; unsigned long *oid;
size_t oidlen; size_t oidlen;
int mech_type; int mech_type;
char buf[50];
if (!asn1_oid_decode(value, vlen, &oid, &oidlen)) { if (!asn1_oid_decode(value, vlen, &oid, &oidlen))
char buf[50]; goto fail;
sprint_oid(value, vlen, buf, sizeof(buf));
ksmbd_debug(AUTH, "Unexpected OID: %s\n", buf);
return -EBADMSG;
}
if (oid_eq(oid, oidlen, NTLMSSP_OID, NTLMSSP_OID_LEN)) if (oid_eq(oid, oidlen, NTLMSSP_OID, NTLMSSP_OID_LEN))
mech_type = KSMBD_AUTH_NTLMSSP; mech_type = KSMBD_AUTH_NTLMSSP;
...@@ -302,15 +298,20 @@ int neg_token_init_mech_type(void *context, size_t hdrlen, ...@@ -302,15 +298,20 @@ int neg_token_init_mech_type(void *context, size_t hdrlen,
else if (oid_eq(oid, oidlen, KRB5U2U_OID, KRB5U2U_OID_LEN)) else if (oid_eq(oid, oidlen, KRB5U2U_OID, KRB5U2U_OID_LEN))
mech_type = KSMBD_AUTH_KRB5U2U; mech_type = KSMBD_AUTH_KRB5U2U;
else else
goto out; goto fail;
conn->auth_mechs |= mech_type; conn->auth_mechs |= mech_type;
if (conn->preferred_auth_mech == 0) if (conn->preferred_auth_mech == 0)
conn->preferred_auth_mech = mech_type; conn->preferred_auth_mech = mech_type;
out:
kfree(oid); kfree(oid);
return 0; return 0;
fail:
kfree(oid);
sprint_oid(value, vlen, buf, sizeof(buf));
ksmbd_debug(AUTH, "Unexpected OID: %s\n", buf);
return -EBADMSG;
} }
int neg_token_init_mech_token(void *context, size_t hdrlen, int neg_token_init_mech_token(void *context, size_t hdrlen,
......
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