r13479: Return the joined domain SID and user SID as structures, not strings.
authorAndrew Bartlett <abartlet@samba.org>
Mon, 13 Feb 2006 00:02:31 +0000 (00:02 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:51:55 +0000 (13:51 -0500)
Andrew Bartlett

source/torture/nbt/dgram.c
source/torture/rpc/testjoin.c

index f44b81932915928647eabb7fa3c067f78524d415..db074ebeba20806b3282067c0de507c8b087aae5 100644 (file)
@@ -250,7 +250,7 @@ static BOOL nbt_test_ntlogon(TALLOC_CTX *mem_ctx,
        struct socket_address *dest;
        struct test_join *join_ctx;
        struct cli_credentials *machine_credentials;
-       const char *dom_sid;
+       const struct dom_sid *dom_sid;
 
        const char *myaddress = talloc_strdup(dgmsock, iface_best_ip(address));
        struct nbt_ntlogon_packet logon;
@@ -305,7 +305,7 @@ static BOOL nbt_test_ntlogon(TALLOC_CTX *mem_ctx,
        logon.req.logon.user_name     = TEST_NAME"$";
        logon.req.logon.mailslot_name = dgmslot->mailslot_name;
        logon.req.logon.acct_control  = ACB_WSTRUST;
-       logon.req.logon.sid           = *dom_sid_parse_talloc(dgmslot, dom_sid);
+       logon.req.logon.sid           = *dom_sid;
        logon.req.logon.nt_version    = 1;
        logon.req.logon.lmnt_token    = 0xFFFF;
        logon.req.logon.lm20_token    = 0xFFFF;
index 39634b9186a5771378aacd9d6c921f2de1077065..28a78b1fc05310d9519f70e712c525e66546aa25 100644 (file)
@@ -40,7 +40,8 @@ struct test_join {
        struct dcerpc_pipe *p;
        struct policy_handle user_handle;
        struct libnet_JoinDomain *libnet_r;
-       const char *dom_sid;
+       struct dom_sid *dom_sid;
+       struct dom_sid *user_sid;
 };
 
 
@@ -161,7 +162,8 @@ struct test_join *torture_create_testuser(const char *username,
                goto failed;
        }
 
-       join->dom_sid = dom_sid_string(join, l.out.sid);
+       talloc_steal(join, l.out.sid);
+       join->dom_sid = l.out.sid;
 
        o.in.connect_handle = &handle;
        o.in.access_mask = SEC_FLAG_MAXIMUM_ALLOWED;
@@ -200,6 +202,8 @@ again:
                goto failed;
        }
 
+       join->user_sid = dom_sid_add_rid(join, join->dom_sid, rid);
+
        pwp.in.user_handle = &join->user_handle;
 
        status = dcerpc_samr_GetUserPwInfo(join->p, join, &pwp);
@@ -330,7 +334,8 @@ struct test_join *torture_join_domain(const char *machine_name,
        }
        tj->p = libnet_r->out.samr_pipe;
        tj->user_handle = *libnet_r->out.user_handle;
-       tj->dom_sid = dom_sid_string(tj, libnet_r->out.domain_sid);
+       tj->dom_sid = libnet_r->out.domain_sid;
+       talloc_steal(tj, libnet_r->out.domain_sid);
 
        ZERO_STRUCT(u);
        s.in.user_handle = &tj->user_handle;
@@ -354,11 +359,6 @@ struct test_join *torture_join_domain(const char *machine_name,
                printf("SetUserInfo (non-critical) failed - %s\n", nt_errstr(status));
        }
 
-       DEBUG(0, ("%s joined domain %s (%s).\n", 
-                 libnet_r->in.netbios_name, 
-                 libnet_r->out.domain_name, 
-                 tj->dom_sid));
-
        *machine_credentials = cli_credentials_init(tj);
        cli_credentials_set_conf(*machine_credentials);
        cli_credentials_set_workstation(*machine_credentials, machine_name, CRED_SPECIFIED);
@@ -489,7 +489,7 @@ void torture_leave_domain(struct test_join *join)
 /*
   return the dom sid for a test join
 */
-const char *torture_join_sid(struct test_join *join)
+const struct dom_sid *torture_join_sid(struct test_join *join)
 {
        return join->dom_sid;
 }