]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Inline samba_kdc_get_user_info_from_db() into its only caller
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Mon, 2 Oct 2023 23:28:58 +0000 (12:28 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 12 Oct 2023 23:13:32 +0000 (23:13 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/pac-glue.c
source4/kdc/pac-glue.h

index 291f9e20579db8dcb367c9f20a942a7cc443adbb..39cabfd94a73094d179825fa7a83c6386acea03f 100644 (file)
@@ -908,38 +908,6 @@ static bool samba_kdc_entry_pac_issued_by_trust(const struct samba_kdc_entry_pac
        return entry.pac != NULL && entry.is_from_trust;
 }
 
-/*
- * Look up the user's info in the database and create a auth_user_info_dc
- * structure. If the resulting structure is not talloc_free()d, it will be
- * reused on future calls to this function.
- */
-NTSTATUS samba_kdc_get_user_info_from_db(struct samba_kdc_entry *entry,
-                                         const struct ldb_message *msg,
-                                         const struct auth_user_info_dc **info_out)
-{
-       if (entry->user_info_dc == NULL) {
-               NTSTATUS nt_status;
-               struct loadparm_context *lp_ctx = entry->kdc_db_ctx->lp_ctx;
-
-               nt_status = authsam_make_user_info_dc(entry,
-                                                     entry->kdc_db_ctx->samdb,
-                                                     lpcfg_netbios_name(lp_ctx),
-                                                     lpcfg_sam_name(lp_ctx),
-                                                     lpcfg_sam_dnsname(lp_ctx),
-                                                     entry->realm_dn,
-                                                     msg,
-                                                     data_blob_null,
-                                                     data_blob_null,
-                                                     &entry->user_info_dc);
-               if (!NT_STATUS_IS_OK(nt_status)) {
-                       return nt_status;
-               }
-       }
-
-       *info_out = entry->user_info_dc;
-       return NT_STATUS_OK;
-}
-
 NTSTATUS samba_kdc_get_logon_info_blob(TALLOC_CTX *mem_ctx,
                                       const struct auth_user_info_dc *user_info_dc,
                                       const enum auth_group_inclusion group_inclusion,
@@ -1156,18 +1124,30 @@ NTSTATUS samba_kdc_get_user_info_dc(TALLOC_CTX *mem_ctx,
                                    struct auth_user_info_dc **info_out)
 {
        NTSTATUS nt_status;
-       const struct auth_user_info_dc *user_info_dc_from_db = NULL;
        struct auth_user_info_dc *user_info_dc = NULL;
 
-       nt_status = samba_kdc_get_user_info_from_db(entry, msg, &user_info_dc_from_db);
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               DBG_ERR("Getting user info for PAC failed: %s\n",
-                       nt_errstr(nt_status));
-               return nt_status;
+       if (entry->user_info_dc == NULL) {
+               struct loadparm_context *lp_ctx = entry->kdc_db_ctx->lp_ctx;
+
+               nt_status = authsam_make_user_info_dc(entry,
+                                                     entry->kdc_db_ctx->samdb,
+                                                     lpcfg_netbios_name(lp_ctx),
+                                                     lpcfg_sam_name(lp_ctx),
+                                                     lpcfg_sam_dnsname(lp_ctx),
+                                                     entry->realm_dn,
+                                                     msg,
+                                                     data_blob_null,
+                                                     data_blob_null,
+                                                     &entry->user_info_dc);
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       DBG_ERR("Getting user info for PAC failed: %s\n",
+                               nt_errstr(nt_status));
+                       return nt_status;
+               }
        }
 
        /* Make a shallow copy of the user_info_dc structure. */
-       nt_status = authsam_shallow_copy_user_info_dc(mem_ctx, user_info_dc_from_db, &user_info_dc);
+       nt_status = authsam_shallow_copy_user_info_dc(mem_ctx, entry->user_info_dc, &user_info_dc);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DBG_ERR("Failed to allocate user_info_dc SIDs: %s\n",
                        nt_errstr(nt_status));
index 803cfb2f2b37f80b3b3cb977dc92d4bf6e1d2b7d..4db38caf6096f51f3f0f032ebad66f116dfab7a3 100644 (file)
@@ -107,10 +107,6 @@ krb5_error_code samba_krbtgt_is_in_db(const struct samba_kdc_entry *skdc_entry,
                                      bool *is_in_db,
                                      bool *is_trusted);
 
-NTSTATUS samba_kdc_get_user_info_from_db(struct samba_kdc_entry *entry,
-                                        const struct ldb_message *msg,
-                                        const struct auth_user_info_dc **info_out);
-
 NTSTATUS samba_kdc_get_user_info_dc(TALLOC_CTX *mem_ctx,
                                    struct samba_kdc_entry *entry,
                                    const struct ldb_message *msg,