Author: brad
Date: 2005-08-21 17:33:51 +0000 (Sun, 21 Aug 2005)
New Revision: 9452

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

Log:
 [EMAIL PROTECTED]:  j0j0 | 2005-08-21 11:40:36 -0600
 Bugfixes, trying to get things straight between contexts.
 

Modified:
   branches/SOC/SAMBA_4_0/
   branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c
   branches/SOC/SAMBA_4_0/source/utils/net/net_join.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:5506
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:5508
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-21 17:20:34 UTC 
(rev 9451)
+++ branches/SOC/SAMBA_4_0/source/libnet/libnet_join.c  2005-08-21 17:33:51 UTC 
(rev 9452)
@@ -82,7 +82,6 @@
        const char *domain_name;
        const char *realm = NULL; /* Also flag for remote being AD */
 
-       
        tmp_ctx = talloc_named(mem_ctx, 0, "libnet_Join temp context");
        if (!tmp_ctx) {
                r->out.error_string = NULL;
@@ -172,12 +171,12 @@
                talloc_free(tmp_ctx);
                return status;
        }
-       domain_sid = lsa_query_info.out.info->domain.sid;
-       domain_name = lsa_query_info.out.info->domain.name.string;
+       domain_sid = talloc_steal(mem_ctx,lsa_query_info.out.info->domain.sid);
+       domain_name = 
talloc_asprintf(mem_ctx,"%s",lsa_query_info.out.info->domain.name.string);
        
        r->out.domain_sid = talloc_steal(mem_ctx, domain_sid);
-       r->out.domain_name = talloc_steal(mem_ctx, domain_name);
-       r->out.realm = talloc_steal(mem_ctx, realm);
+       r->out.domain_name = talloc_asprintf(mem_ctx, "%s", domain_name);
+       r->out.realm = talloc_asprintf(mem_ctx, "%s", realm);
 
        /*
          establish a SAMR connection, on the same CIFS transport
@@ -432,7 +431,7 @@
        r->out.realm = NULL;
        r->out.kvno = 0;
 
-
+       r->out.error_string = NULL;
        talloc_free(tmp_ctx); 
 
        return NT_STATUS_OK;
@@ -444,9 +443,9 @@
 
        NTSTATUS status;
        
-       const char *realm = r->out.realm;
+       const char *realm = talloc_asprintf(mem_ctx, "%s", r->out.realm);
        
-       struct dcerpc_binding *samr_binding = r->out.samr_binding;
+       struct dcerpc_binding *samr_binding = talloc_steal(mem_ctx, 
r->out.samr_binding);
        
        struct dcerpc_pipe *drsuapi_pipe;
        struct dcerpc_binding *drsuapi_binding;
@@ -646,10 +645,11 @@
                }
        }
        
-/*     testing
+/*     testing*/
+       r->out.error_string = NULL;
        talloc_free(tmp_ctx); 
-*/
 
+
        return NT_STATUS_OK;
 }
 
@@ -702,23 +702,22 @@
        r2.in.level = r->in.level;
        status = libnet_JoinDomain(ctx, mem_ctx, &r2);
 
-       r->out.error_string = r2.out.error_string;
+       r->out.error_string = talloc_steal(mem_ctx, r2.out.error_string);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
        
+       r->out.samr_pipe = talloc_steal(mem_ctx, r2.out.samr_pipe);
+       r->out.user_handle = talloc_steal(mem_ctx, r2.out.user_handle);
+       r->out.domain_sid = talloc_steal(mem_ctx, r2.out.domain_sid);
+       r->out.join_password = talloc_steal(mem_ctx, r2.out.join_password);
        
        /*
-       r->out.samr_pipe = r2.out.samr_pipe;
-       r->out.user_handle = r2.out.user_handle;
-       r->out.domain_sid = r2.out.domain_sid;
-       r->out.join_password = r2.out.join_password;
-       */
        r2.out.samr_pipe = talloc_steal(mem_ctx, r->out.samr_pipe);
        r2.out.user_handle = talloc_steal(mem_ctx, r->out.user_handle);
        r2.out.domain_sid = talloc_steal(mem_ctx, r->out.domain_sid);
        r2.out.join_password = talloc_steal(mem_ctx, r->out.join_password);
-       
+       */
        sct = talloc_asprintf(mem_ctx, "%d", r->in.secure_channel_type);
        msg = ldb_msg_new(mem_ctx);
 
@@ -794,16 +793,18 @@
 {
 
        NTSTATUS nt_status;
-       struct libnet_Join r2;
+       struct libnet_Join *r2;
        
-       r2.in.level = r->in.level;
-       r2.in.secure_channel_type = r->in.secure_channel_type;
-       r2.in.domain_name = r->in.domain_name;
-       r2.in.netbios_name = r->in.netbios_name;
+       r2 = talloc(mem_ctx, struct libnet_Join);
        
+       r2->in.level = r->in.level;
+       r2->in.secure_channel_type = r->in.secure_channel_type;
+       r2->in.domain_name = r->in.domain_name;
+       r2->in.netbios_name = r->in.netbios_name;
+       
        if ((r->in.secure_channel_type == SEC_CHAN_WKSTA)
            || (r->in.secure_channel_type == SEC_CHAN_BDC)) {
-               nt_status = libnet_Join_primary_domain(ctx, mem_ctx, &r2);
+               nt_status = libnet_Join_primary_domain(ctx, mem_ctx, r2);
        } else {
                r->out.error_string
                        = talloc_asprintf(mem_ctx, "Invalid secure channel type 
specified (%08X) attempting to join domain %s",
@@ -811,11 +812,11 @@
                return NT_STATUS_INVALID_PARAMETER;
        }
        
-       r->out.error_string = r2.out.error_string;
-       r->out.join_password = r2.out.join_password;
-       r->out.domain_sid = r2.out.domain_sid;
-       r->out.samr_pipe = r2.out.samr_pipe;
-       r->out.user_handle = r2.out.user_handle;
+       r->out.error_string = talloc_asprintf(mem_ctx, "%s", 
r2->out.error_string);
+       r->out.join_password = talloc_steal(mem_ctx, r2->out.join_password);
+       r->out.domain_sid = talloc_steal(mem_ctx, r2->out.domain_sid);
+       r->out.samr_pipe = talloc_steal(mem_ctx, r2->out.samr_pipe);
+       r->out.user_handle = talloc_steal(mem_ctx, r2->out.user_handle);
        
        return nt_status;
 }

Modified: branches/SOC/SAMBA_4_0/source/utils/net/net_join.c
===================================================================
--- branches/SOC/SAMBA_4_0/source/utils/net/net_join.c  2005-08-21 17:20:34 UTC 
(rev 9451)
+++ branches/SOC/SAMBA_4_0/source/utils/net/net_join.c  2005-08-21 17:33:51 UTC 
(rev 9452)
@@ -67,7 +67,12 @@
        r.in.domain_name         = domain_name;
        r.in.secure_channel_type = secure_channel_type;
        r.out.error_string       = NULL;
-
+       r.in.level               = LIBNET_JOIN_AUTOMATIC;
+       /*
+        Valgrind complains if we don't set netbios_name to null here.
+       */
+       r.in.netbios_name        = NULL;
+       
        /* do the domain join */
        status = libnet_Join(libnetctx, ctx->mem_ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {

Reply via email to