kadmin: kadmind_dispatch fix handling of HEIM_ERR_EOF error

1b213c1082 ("kadmind: Add missing
error checks") altered the scope of the

   if (ret == HEIM_ERR_EOF)
      ret = 0;

treatment of HEIM_ERR_EOF as a success code.  Prior to that
commit HEIM_ERR_EOF meant success only when reading the 'keepold'
value.  It indicated a premature failure if returned when reading
'princ' or 'n_key_data'.

This change corrects the scope of HEIM_ERR_EOF indicating success.

Change-Id: If5463b47dc3eabee6fa2f8e717147f02adc1586c
This commit is contained in:
Jeffrey Altman
2022-01-20 23:43:06 -05:00
parent 81f3a0b804
commit 4ffd190b08

View File

@@ -380,11 +380,12 @@ kadmind_dispatch(void *kadm_handlep, krb5_boolean initial,
}
ret = krb5_ret_principal(sp, &princ);
if (ret == 0)
ret = krb5_ret_int32(sp, &n_key_data);
if (ret == 0)
ret = krb5_ret_int32(sp, &keepold);
if (ret == HEIM_ERR_EOF)
ret = 0;
ret = krb5_ret_int32(sp, &n_key_data);
if (ret == 0) {
ret = krb5_ret_int32(sp, &keepold);
if (ret == HEIM_ERR_EOF)
ret = 0;
}
if (ret)
goto fail;