auth: Simplify smb_krb5_send_to_kdc_state_destructor()
authorVolker Lendecke <vl@samba.org>
Mon, 12 Feb 2024 12:35:19 +0000 (13:35 +0100)
committerVolker Lendecke <vl@samba.org>
Tue, 12 Mar 2024 13:31:31 +0000 (13:31 +0000)
Replace a call to dbwrap_fetch_locked() with the higherlevel
dbwrap_delete().

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/auth/kerberos/krb5_init_context.c

index e8114af7ab2c32e04fcad9219f1a5c5719d64d6b..0eb849c4ce0d171545676e738726c1377bddbcf0 100644 (file)
@@ -492,16 +492,12 @@ struct smb_krb5_send_to_kdc_state {
 static int smb_krb5_send_to_kdc_state_destructor(struct smb_krb5_send_to_kdc_state *state)
 {
        TDB_DATA key = make_tdb_data((uint8_t *)&state->key_ptr, sizeof(state->key_ptr));
-       struct db_record *rec = NULL;
        NTSTATUS status;
 
-       rec = dbwrap_fetch_locked(smb_krb5_plugin_db, state, key);
-       if (rec == NULL) {
-               return 0;
+       status = dbwrap_delete(smb_krb5_plugin_db, key);
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NOT_FOUND)) {
+               status = NT_STATUS_OK;
        }
-
-       status = dbwrap_record_delete(rec);
-       TALLOC_FREE(rec);
        if (!NT_STATUS_IS_OK(status)) {
                return -1;
        }