libgpo: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Mon, 10 Dec 2018 11:34:13 +0000 (12:34 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 10 Dec 2018 23:40:31 +0000 (00:40 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libgpo/gpo_reg.c

index 644b4d36d6244ab4035e207033f27b613aa96753..a160c3dd03d86c45045d8180b036806edd6fbd4a 100644 (file)
@@ -351,7 +351,6 @@ static WERROR gp_reg_store_groupmembership(TALLOC_CTX *mem_ctx,
        uint32_t i = 0;
        const char *valname = NULL;
        const char *path = NULL;
-       const char *val = NULL;
        int count = 0;
 
        path = gp_reg_groupmembership_path(mem_ctx, &token->sids[0],
@@ -365,13 +364,16 @@ static WERROR gp_reg_store_groupmembership(TALLOC_CTX *mem_ctx,
        W_ERROR_NOT_OK_RETURN(werr);
 
        for (i=0; i<token->num_sids; i++) {
+               struct dom_sid_buf buf;
 
                valname = talloc_asprintf(mem_ctx, "Group%d", count++);
                W_ERROR_HAVE_NO_MEMORY(valname);
 
-               val = sid_string_talloc(mem_ctx, &token->sids[i]);
-               W_ERROR_HAVE_NO_MEMORY(val);
-               werr = gp_store_reg_val_sz(mem_ctx, key, valname, val);
+               werr = gp_store_reg_val_sz(
+                       mem_ctx,
+                       key,
+                       valname,
+                       dom_sid_str_buf(&token->sids[i], &buf));
                W_ERROR_NOT_OK_RETURN(werr);
        }