]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
rpc_server: Simplify dcesrv_samr_GetAliasMembership()
authorVolker Lendecke <vl@samba.org>
Wed, 15 Jul 2026 11:00:27 +0000 (13:00 +0200)
committerAnoop C S <anoopcs@samba.org>
Mon, 3 Aug 2026 09:05:30 +0000 (09:05 +0000)
Use talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Anoop C S <anoopcs@samba.org>
source4/rpc_server/samr/dcesrv_samr.c

index e756422be4f88ae7556ab2583f50ed18203e4a46..2fb24d95802c8da423f1b9544911abf8bb903fb7 100644 (file)
@@ -2060,21 +2060,16 @@ static NTSTATUS dcesrv_samr_GetAliasMembership(struct dcesrv_call_state *dce_cal
                                 "(objectclass=group)(|",
                                 GTYPE_SECURITY_BUILTIN_LOCAL_GROUP,
                                 GTYPE_SECURITY_DOMAIN_LOCAL_GROUP);
-       if (filter == NULL) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
        for (i=0; i<r->in.sids->num_sids; i++) {
                struct dom_sid_buf buf;
 
-               filter = talloc_asprintf_append(
-                       filter,
+               talloc_asprintf_addbuf(
+                       &filter,
                        "(member=<SID=%s>)",
                        dom_sid_str_buf(r->in.sids->sids[i].sid, &buf));
-
-               if (filter == NULL) {
-                       return NT_STATUS_NO_MEMORY;
-               }
+       }
+       if (filter == NULL) {
+               return NT_STATUS_NO_MEMORY;
        }
 
        /* Find out if we had at least one valid member SID passed - otherwise