From 151ef9ef74cca964b48a8c821355c7c27d14f976 Mon Sep 17 00:00:00 2001 From: Greg Hudson Date: Thu, 25 Mar 2010 03:08:12 +0000 Subject: [PATCH] Straighten the if-ladder in encrypted challenge's process_preauth, making it clearer that control drops through if one of the first couple of steps fails. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@23836 dc483132-0cff-0310-8789-dd5450dbe970 --- .../encrypted_challenge/encrypted_challenge_main.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/preauth/encrypted_challenge/encrypted_challenge_main.c b/src/plugins/preauth/encrypted_challenge/encrypted_challenge_main.c index 614ee47f2..27d9ae5e0 100644 --- a/src/plugins/preauth/encrypted_challenge/encrypted_challenge_main.c +++ b/src/plugins/preauth/encrypted_challenge/encrypted_challenge_main.c @@ -72,14 +72,14 @@ process_preauth(krb5_context context, void *plugin_context, salt, s2kparams, as_key, gak_data); } - if (padata->length) { + if (retval == 0 && padata->length) { krb5_enc_data *enc = NULL; krb5_data scratch; scratch.length = padata->length; scratch.data = (char *) padata->contents; - if (retval == 0) - retval = krb5_c_fx_cf2_simple(context,armor_key, "kdcchallengearmor", - as_key, "challengelongterm", &challenge_key); + retval = krb5_c_fx_cf2_simple(context,armor_key, "kdcchallengearmor", + as_key, "challengelongterm", + &challenge_key); if (retval == 0) retval =kaccess.decode_enc_data(&scratch, &enc); scratch.data = NULL; @@ -104,15 +104,14 @@ process_preauth(krb5_context context, void *plugin_context, fast_set_kdc_verified(context, get_data_proc, rock); if (enc) kaccess.free_enc_data(context, enc); - } else { /*No padata; we send*/ + } else if (retval == 0) { /*No padata; we send*/ krb5_enc_data enc; krb5_pa_data *pa = NULL; krb5_pa_data **pa_array = NULL; krb5_data *encoded_ts = NULL; krb5_pa_enc_ts ts; enc.ciphertext.data = NULL; - if (retval == 0) - retval = krb5_us_timeofday(context, &ts.patimestamp, &ts.pausec); + retval = krb5_us_timeofday(context, &ts.patimestamp, &ts.pausec); if (retval == 0) retval = kaccess.encode_enc_ts(&ts, &encoded_ts); if (retval == 0) -- 2.26.2