s4/test: fix SEGFAULT in test_group_create when rid is NULL
authorKamen Mazdrashki <kamenim@samba.org>
Thu, 10 Jun 2010 15:21:44 +0000 (18:21 +0300)
committerKamen Mazdrashki <kamenim@samba.org>
Thu, 10 Jun 2010 22:20:09 +0000 (01:20 +0300)
Caller of this function may not need group RID and
in such case it passes NULL for rid parameter

source4/torture/libnet/utils.c

index 312b19483f5f4f8ae0b37c8ac7e66e0ad45fc9ec..486f04451bb3afa0cb88a0e94c30f767dbcfff9b 100644 (file)
@@ -366,6 +366,7 @@ bool test_group_create(struct torture_context *tctx,
                       struct policy_handle *handle, const char *name,
                       uint32_t *rid)
 {
+       uint32_t group_rid;
        struct lsa_String groupname;
        struct samr_CreateDomainGroup r;
        struct policy_handle group_handle;
@@ -376,7 +377,9 @@ bool test_group_create(struct torture_context *tctx,
        r.in.name           = &groupname;
        r.in.access_mask    = SEC_FLAG_MAXIMUM_ALLOWED;
        r.out.group_handle  = &group_handle;
-       r.out.rid           = rid;
+       /* use local variable in case caller
+        * don't care about the group RID */
+       r.out.rid           = rid ? rid : &group_rid;
 
        torture_comment(tctx, "creating group account %s\n", name);