]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Avoid setting AS key when OTP preauth fails
authorNathaniel McCallum <npmccallum@redhat.com>
Thu, 26 May 2016 20:54:29 +0000 (16:54 -0400)
committerTom Yu <tlyu@mit.edu>
Wed, 6 Jul 2016 19:17:06 +0000 (15:17 -0400)
In otp_client_process(), call cb->set_as_key() later in the function
after the OTP request has been created.  The previous position of this
call caused the AS key to be replaced even when later code in the
function failed, preventing other preauth mechanisms from retrieving
the correct AS key.

(cherry picked from commit 0712d0059d72ddeaf1764f8fa173a321e3bc072d)

ticket: 8421
version_fixed: 1.13.6
tags: -pullup
status: resolved

src/lib/krb5/krb/preauth_otp.c

index d9ddc8bf3b7dcdc42c3a2c2167fb52e9d85f6fc0..3de528b5ae19b5d8747e83cb1483151d87db2f5a 100644 (file)
@@ -1081,11 +1081,6 @@ otp_client_process(krb5_context context, krb5_clpreauth_moddata moddata,
     if (as_key == NULL)
         return ENOENT;
 
-    /* Use FAST armor key as response key. */
-    retval = cb->set_as_key(context, rock, as_key);
-    if (retval != 0)
-        return retval;
-
     /* Attempt to get token selection from the responder. */
     pin = empty_data();
     value = empty_data();
@@ -1115,6 +1110,11 @@ otp_client_process(krb5_context context, krb5_clpreauth_moddata moddata,
     if (retval != 0)
         goto error;
 
+    /* Use FAST armor key as response key. */
+    retval = cb->set_as_key(context, rock, as_key);
+    if (retval != 0)
+        goto error;
+
     /* Encode the request into the pa_data output. */
     retval = set_pa_data(req, pa_data_out);
 error: