Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Pass token id hint only if we got one.

  • Loading branch information...
commit c02fc435cc7ff384a852ca2f240091d838ad34d9 1 parent 47a5f2a
@ln5 authored
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/plugins/preauth/otp/otp_main.c
View
15 src/plugins/preauth/otp/otp_main.c
@@ -426,7 +426,7 @@ otp_server_pick_token(struct otp_server_ctx *ctx,
free(blob);
blob = strdup(cp);
}
- if (strcmp(token_id, token_id_hint) == 0)
+ if (token_id_hint != NULL && strcmp(token_id, token_id_hint) == 0)
break;
}
@@ -770,12 +770,19 @@ otp_server_verify_padata(krb5_context context,
/* Get OTP and potential token id hint from user. */
otp = strndup(otp_req->otp_value.data, otp_req->otp_value.length);
- tokenid = strndup(otp_req->otp_keyid.data, otp_req->otp_keyid.length);
- SERVER_DEBUG("Got tokenid hint [%s].", tokenid);
- if (otp == NULL || tokenid == NULL) {
+ if (otp == NULL) {
retval = ENOMEM;
goto errout;
}
+ SERVER_DEBUG("Got OTP [%s].", otp);
+ if (otp_req->otp_keyid.data != NULL) {
+ tokenid = strndup(otp_req->otp_keyid.data, otp_req->otp_keyid.length);
+ if (tokenid == NULL) {
+ retval = ENOMEM;
+ goto errout;
+ }
+ SERVER_DEBUG("Got tokenid hint [%s].", tokenid);
+ }
/* Create request context. */
retval = otp_server_create_req_ctx(otp_ctx, rock, tokenid, cb->get_string,
Please sign in to comment.
Something went wrong with that request. Please try again.