]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Allocate contents of PAC blobs on blob talloc contexts
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 24 Aug 2023 23:41:39 +0000 (11:41 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Sep 2023 21:35:29 +0000 (21:35 +0000)
The lifetime of a blob’s contents should be tied to the lifetime of the
blob itself.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/pac-glue.c

index 374c85fad34d578c4d5841a80a2676aaffae5869..8c7601984ddbd86fa1af436ed87729351b8a0878 100644 (file)
@@ -1042,7 +1042,7 @@ NTSTATUS samba_kdc_get_requester_sid_blob(TALLOC_CTX *mem_ctx,
 
                pac_requester_sid.requester_sid.sid = user_info_dc->sids[PRIMARY_USER_SID_INDEX].sid;
 
-               ndr_err = ndr_push_union_blob(requester_sid_blob, mem_ctx,
+               ndr_err = ndr_push_union_blob(requester_sid_blob, requester_sid_blob,
                                              &pac_requester_sid,
                                              PAC_TYPE_REQUESTER_SID,
                                              (ndr_push_flags_fn_t)ndr_push_PAC_INFO);
@@ -1080,7 +1080,7 @@ NTSTATUS samba_kdc_get_claims_blob(TALLOC_CTX *mem_ctx,
        }
 
        ret = get_claims_blob_for_principal(p->kdc_db_ctx->samdb,
-                                           mem_ctx,
+                                           claims_blob,
                                            p->msg,
                                            claims_blob);
        if (ret != LDB_SUCCESS) {
@@ -1892,7 +1892,7 @@ static krb5_error_code samba_kdc_get_device_info_pac_blob(TALLOC_CTX *mem_ctx,
                return ENOMEM;
        }
 
-       ndr_err = ndr_push_union_blob(*device_info_blob, mem_ctx,
+       ndr_err = ndr_push_union_blob(*device_info_blob, *device_info_blob,
                                      info, PAC_TYPE_DEVICE_INFO,
                                      (ndr_push_flags_fn_t)ndr_push_PAC_INFO);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
@@ -2431,7 +2431,7 @@ krb5_error_code samba_kdc_update_pac(TALLOC_CTX *mem_ctx,
                }
 
                nt_status = samba_kdc_update_delegation_info_blob(
-                               mem_ctx,
+                               deleg_blob,
                                context,
                                old_pac,
                                server_principal,