git: bc8c756a2f86 - stable/13 - heimdal: Check return code from _hdb_fetch_kvno()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 01 Dec 2022 14:25:34 UTC
The branch stable/13 has been updated by cy:
URL: https://cgit.FreeBSD.org/src/commit/?id=bc8c756a2f866841057848cf88daec64fdd5e508
commit bc8c756a2f866841057848cf88daec64fdd5e508
Author: Cy Schubert <cy@FreeBSD.org>
AuthorDate: 2022-11-26 20:18:03 +0000
Commit: Cy Schubert <cy@FreeBSD.org>
CommitDate: 2022-12-01 14:25:11 +0000
heimdal: Check return code from _hdb_fetch_kvno()
A malformed principal will cause kadmind to segfault. The PR
addresses only when chpass is requested but delete is also affected.
Fix both.
PR: 268002
Reported by: Robert Morris <rtm@lcs.mit.edu>
(cherry picked from commit 671f55828d038e17fb29fd115b88e7cdf53500c3)
---
crypto/heimdal/lib/kadm5/chpass_s.c | 2 +-
crypto/heimdal/lib/kadm5/delete_s.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/crypto/heimdal/lib/kadm5/chpass_s.c b/crypto/heimdal/lib/kadm5/chpass_s.c
index d5407d1549f4..624293e5c3a3 100644
--- a/crypto/heimdal/lib/kadm5/chpass_s.c
+++ b/crypto/heimdal/lib/kadm5/chpass_s.c
@@ -168,7 +168,7 @@ kadm5_s_chpass_principal_with_key(void *server_handle,
return ret;
ret = context->db->hdb_fetch_kvno(context->context, context->db, princ, 0,
HDB_F_GET_ANY|HDB_F_ADMIN_DATA, &ent);
- if(ret == HDB_ERR_NOENTRY)
+ if(ret)
goto out;
ret = _kadm5_set_keys2(context, &ent.entry, n_key_data, key_data);
if(ret)
diff --git a/crypto/heimdal/lib/kadm5/delete_s.c b/crypto/heimdal/lib/kadm5/delete_s.c
index 7f8f537b06c0..fb5a52970ab9 100644
--- a/crypto/heimdal/lib/kadm5/delete_s.c
+++ b/crypto/heimdal/lib/kadm5/delete_s.c
@@ -50,7 +50,7 @@ kadm5_s_delete_principal(void *server_handle, krb5_principal princ)
}
ret = context->db->hdb_fetch_kvno(context->context, context->db, princ,
HDB_F_DECRYPT|HDB_F_GET_ANY|HDB_F_ADMIN_DATA, 0, &ent);
- if(ret == HDB_ERR_NOENTRY)
+ if (ret)
goto out;
if(ent.entry.flags.immutable) {
ret = KADM5_PROTECT_PRINCIPAL;