]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Remove unused talloc context
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 24 Aug 2023 23:18:34 +0000 (11:18 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Sep 2023 21:35:29 +0000 (21:35 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/pac-glue.c

index 5b6b01d1597f64f8c44206a021d9c3bb2f77044b..da964095c506d56d5c8172315744c90a03d5ac2e 100644 (file)
@@ -755,11 +755,6 @@ int samba_krbtgt_is_in_db(struct samba_kdc_entry *p,
        struct dom_sid sid;
        uint32_t rid;
 
-       TALLOC_CTX *mem_ctx = talloc_new(NULL);
-       if (!mem_ctx) {
-               return ENOMEM;
-       }
-
        trust_direction = ldb_msg_find_attr_as_int(p->msg, "trustDirection", 0);
 
        if (trust_direction != 0) {
@@ -768,7 +763,6 @@ int samba_krbtgt_is_in_db(struct samba_kdc_entry *p,
                   This is exactly where we should flag for SID
                   validation when we do inter-forest trusts
                 */
-               talloc_free(mem_ctx);
                *is_trusted = true;
                *is_in_db = false;
                return 0;
@@ -783,7 +777,6 @@ int samba_krbtgt_is_in_db(struct samba_kdc_entry *p,
 
        status = dom_sid_split_rid(NULL, &sid, NULL, &rid);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(mem_ctx);
                return map_errno_from_nt_status(status);
        }
 
@@ -793,29 +786,24 @@ int samba_krbtgt_is_in_db(struct samba_kdc_entry *p,
                if (rid == DOMAIN_RID_KRBTGT) {
                        *is_trusted = true;
                        *is_in_db = true;
-                       talloc_free(mem_ctx);
                        return 0;
                } else if (rodc_krbtgt_number != -1) {
                        *is_in_db = true;
                        *is_trusted = false;
-                       talloc_free(mem_ctx);
                        return 0;
                }
        } else if ((rid != DOMAIN_RID_KRBTGT) && (rodc_krbtgt_number == p->kdc_db_ctx->my_krbtgt_number)) {
-               talloc_free(mem_ctx);
                *is_trusted = true;
                *is_in_db = true;
                return 0;
        } else if (rid == DOMAIN_RID_KRBTGT) {
                /* krbtgt viewed from an RODC */
-               talloc_free(mem_ctx);
                *is_trusted = true;
                *is_in_db = false;
                return 0;
        }
 
        /* Another RODC */
-       talloc_free(mem_ctx);
        *is_trusted = false;
        *is_in_db = false;
        return 0;