Author: brad
Date: 2005-08-20 01:22:42 +0000 (Sat, 20 Aug 2005)
New Revision: 9407

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=9407

Log:
 [EMAIL PROTECTED]:  j0j0 | 2005-08-19 19:28:22 -0600
 libnet/libnet_join.c
 Some more fixes so ldb uses ldb_dn's.
 
 torture/rpc/dssync.c
 Some debugging printf()'s.
 ldb_dn fixes.
 
 torture/rpc/testjoin.c
 Change torture_join_domain() to use libnet_JoinDomain() rather than 
libnet_Join().
 Some more debugging statements.
 
 I'm not sure why, but GUID_all_zero(user_handle.uuid) is returning true in 
torture_leave_domain() when called it from torture_destroy_context() in 
torture/rpc/dssync.c.
 That's what i'm working out now.
 

Modified:
   branches/SOC/SAMBA_4_0/
   branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
   branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c
   branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c


Changeset:

Property changes on: branches/SOC/SAMBA_4_0
___________________________________________________________________
Name: svk:merge
   - 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9397
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5500
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5497
   + 0c0555d6-39d7-0310-84fc-f1cc0bd64818:/branches/SAMBA_4_0:9397
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/SAMBA_4_0:5502
d349723c-e9fc-0310-b8a8-fdedf1c27407:/local/samba-SAMBA_4_0:5497

Modified: branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c  2005-08-20 00:10:03 UTC 
(rev 9406)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c  2005-08-20 01:22:42 UTC 
(rev 9407)
@@ -81,7 +81,6 @@
        struct dom_sid *domain_sid;
        const char *domain_name;
        const char *realm = NULL; /* Also flag for remote being AD */
-       const struct ldb_dn *account_dn;
 
        
        tmp_ctx = talloc_named(mem_ctx, 0, "libnet_Join temp context");
@@ -457,7 +456,7 @@
 
        struct ldb_context *remote_ldb;
 
-       const char *account_dn;
+       const struct ldb_dn *account_dn;
 
        char *remote_ldb_url;
        struct ldb_message **msgs, *msg;

Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c  2005-08-20 00:10:03 UTC 
(rev 9406)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/dssync.c  2005-08-20 01:22:42 UTC 
(rev 9407)
@@ -115,6 +115,19 @@
        /*create machine account*/
        ctx->new_dc.join = torture_join_domain(mem_ctx, TEST_MACHINE_NAME, 
lp_workgroup(), ACB_SVRTRUST, &new_dc_pass);  
 
+       /* debugging printf()'s*/
+       if (torture_join_samr_pipe(ctx->new_dc.join) != NULL) {
+                printf("test_create_context(): tj->p isn't null\n");
+       } else {
+               printf("test_create_context(): tj->p is null.\n");
+       }
+       
+       if (torture_join_samr_user_policy(ctx->new_dc.join) != NULL) {
+               printf("test_create_context(): tj->user_handle isn't null\n");  
+       } else {
+               printf("test_create_context(): tj->user_handle is null.\n");
+       }
+
        /*
        ctx->libnet_ctx = libnet_context_init(NULL);
        if (ctx->libnet_ctx == NULL) {
@@ -172,6 +185,7 @@
                                ldb_errstring(ctx->ldb_ctx));
                        return;
                }
+               
                /* 
                ldif = talloc_asprintf(ctx,
                        "dn: %s\n"
@@ -219,10 +233,12 @@
        This will need to be replaced with a libnet leave domain call.
        It will remove the computer dn: CN=smbtorturedssync,OU=Domain 
Controllers,DC=smb,DC=test
        entry, and maybe the server dn also.
+       */
+       printf("test_destroy_context(): Removing machine account 
%s$.\n",TEST_MACHINE_NAME);
        if (ctx->new_dc.join) {
                torture_leave_domain(ctx->new_dc.join);
        }
-       */
+       
        talloc_free(ctx);
        
 }

Modified: branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c        2005-08-20 
00:10:03 UTC (rev 9406)
+++ branches/SOC/SAMBA_4_0/source/torture/rpc/testjoin.c        2005-08-20 
01:22:42 UTC (rev 9407)
@@ -286,7 +286,7 @@
        */
        
        struct libnet_context *libnet_ctx;
-       struct libnet_Join libnet_r;
+       struct libnet_JoinDomain libnet_r;
        struct test_join *tj;
        NTSTATUS status;
        
@@ -298,22 +298,45 @@
        libnet_r.in.domain_name = domain;
        libnet_r.in.level = LIBNET_JOIN_SPECIFIED; 
        libnet_r.in.netbios_name = machine_name;
-       
-       if (acct_flags == ACB_SVRTRUST) {
-               libnet_r.in.secure_channel_type = SEC_CHAN_BDC;
-       } else if (acct_flags == ACB_WSTRUST) {
-               libnet_r.in.secure_channel_type = SEC_CHAN_WKSTA;
-       }
-               
-       status = libnet_Join(libnet_ctx, mem_ctx, &libnet_r);
+       libnet_r.in.account_name = talloc_asprintf(mem_ctx, "%s$", 
libnet_r.in.netbios_name);
+       libnet_r.in.acct_type = acct_flags;
+
+       /*
+        Call libnet_JoinDomain() rather than libnet_Join() -- it calls 
libnet_Join_primary_domain(), which puts 
+        the machine acct info in secrets.tdb. We don't want that for a 
torture_join.
+        */     
+       status = libnet_JoinDomain(libnet_ctx, mem_ctx, &libnet_r);
+
        if (!NT_STATUS_IS_OK(status)) {
                return NULL;
        }
        tj = talloc(mem_ctx, struct test_join);
+       
+       /* this bit makes torture_leave_domain() segfault...
+          libnet_ctx seems to be a better place to fetch most of this from 
anyway.
+          
        tj->p = libnet_r.out.samr_pipe;
        tj->user_handle = libnet_r.out.user_handle; 
        tj->dom_sid = dom_sid_string(mem_ctx, libnet_r.out.domain_sid);
        *machine_password = libnet_r.out.join_password;
+       */
+       if (libnet_ctx->pipe != NULL) {
+                printf("torture_join_domain(): libnet_ctx->pipe isn't null\n");
+       } else {
+               printf("torture_join_domain(): libnet_ctx->pipe is null.\n");
+       }
+       
+       if (&libnet_ctx->user_handle != NULL) {
+               printf("torture_join_domain(): libnet_ctx->user_handle isn't 
null\n");  
+       } else {
+               printf("torture_join_domain(): libnet_ctx->user_handle is 
null.\n");
+       }
+       
+       tj->p = libnet_ctx->pipe;
+       tj->user_handle = libnet_ctx->user_handle;
+       tj->dom_sid = dom_sid_string(mem_ctx, libnet_r.out.domain_sid);
+       *machine_password = libnet_r.out.join_password;
+               
        printf("torture_join_domain() complete.\n");
        return tj;
 }
@@ -343,7 +366,11 @@
                status = dcerpc_samr_DeleteUser(join->p, join, &d);
                if (!NT_STATUS_IS_OK(status)) {
                        printf("Delete of machine account failed\n");
+               } else {
+                       printf("Delete of machine account was successful.\n");
                }
+       } else {
+                printf("torture_leave_domain(): 
GUID_all_zero(&join->user_handle.uuid) returned true, dcerpc_samr_DeleteUser() 
not called.\n");
        }
 
        talloc_free(join);

Reply via email to