kdc: Overwrite ‘error_code’ only if we have an actual error

‘r->error_code’ might have been set earlier, and we don’t want to
overwrite it with a successful error code.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
This commit is contained in:
Joseph Sutton
2023-06-12 16:20:06 +12:00
committed by Nico Williams
parent 243207f10a
commit da9cad2047
2 changed files with 8 additions and 2 deletions

View File

@@ -2743,7 +2743,10 @@ _kdc_as_rep(astgs_request_t r)
} }
out: out:
r->error_code = ret; if (ret) {
/* Overwrite error_code only if we have an actual error. */
r->error_code = ret;
}
{ {
krb5_error_code ret2 = _kdc_audit_request(r); krb5_error_code ret2 = _kdc_audit_request(r);
if (ret2) { if (ret2) {

View File

@@ -2161,7 +2161,10 @@ _kdc_tgs_rep(astgs_request_t r)
} }
out: out:
r->error_code = ret; if (ret) {
/* Overwrite error_code only if we have an actual error. */
r->error_code = ret;
}
{ {
krb5_error_code ret2 = _kdc_audit_request(r); krb5_error_code ret2 = _kdc_audit_request(r);
if (ret2) { if (ret2) {