The branch main has been updated by cy:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=671f55828d038e17fb29fd115b88e7cdf53500c3

commit 671f55828d038e17fb29fd115b88e7cdf53500c3
Author:     Cy Schubert <[email protected]>
AuthorDate: 2022-11-26 20:18:03 +0000
Commit:     Cy Schubert <[email protected]>
CommitDate: 2022-11-27 02:41:52 +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 <[email protected]>
    MFC after:      3 days
---
 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;

Reply via email to