[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-2727-gf9e5450

Günther Deschner gd at samba.org
Wed Jun 4 18:10:51 GMT 2008


The branch, v3-3-test has been updated
       via  f9e5450c9492b0f35bd90040739007963e765ab1 (commit)
       via  0fa6c8c6a3efd026154e8af54ba73b3d3de1affa (commit)
       via  60bce925746590aabf489f0c771afd732c32f5a0 (commit)
       via  6dbed6e7b7300962e11fdce1a713e6f3ea2cb619 (commit)
      from  d7ba98cc3f2d037ec01e079220a66da508b104b0 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test


- Log -----------------------------------------------------------------
commit f9e5450c9492b0f35bd90040739007963e765ab1
Author: Günther Deschner <gd at samba.org>
Date:   Wed Jun 4 18:05:15 2008 +0200

    libnetjoin: correctly copy returned lsa policy sid.
    
    Guenther

commit 0fa6c8c6a3efd026154e8af54ba73b3d3de1affa
Author: Günther Deschner <gd at samba.org>
Date:   Tue Jun 3 15:19:46 2008 +0200

    netdomjoin-gui: some minor fixes + hunting down typecast bugs.
    
    Guenther

commit 60bce925746590aabf489f0c771afd732c32f5a0
Author: Günther Deschner <gd at samba.org>
Date:   Wed Jun 4 02:44:24 2008 +0200

    net: fix popt context memleak.
    
    Guenther

commit 6dbed6e7b7300962e11fdce1a713e6f3ea2cb619
Author: Günther Deschner <gd at samba.org>
Date:   Wed Jun 4 02:43:41 2008 +0200

    libnetjoin: only close existing policy handles while unjoining.
    
    Guenther

-----------------------------------------------------------------------

Summary of changes:
 .../examples/netdomjoin-gui/netdomjoin-gui.c       |   36 ++++++++++++++------
 source/libnet/libnet_join.c                        |   18 ++++++++--
 source/utils/net.c                                 |    2 +
 3 files changed, 41 insertions(+), 15 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c b/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
index df81937..dd4e4ad 100644
--- a/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
+++ b/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
@@ -113,7 +113,9 @@ static void callback_do_close(GtkWidget *widget,
 {
 	debug("callback_do_close called\n");
 
-	gtk_widget_destroy(data);
+	if (data) {
+		gtk_widget_destroy(GTK_WIDGET(data));
+	}
 }
 
 static void callback_do_freeauth(GtkWidget *widget,
@@ -127,7 +129,8 @@ static void callback_do_freeauth(GtkWidget *widget,
 	SAFE_FREE(state->password);
 
 	if (state->window_creds_prompt) {
-		gtk_widget_destroy(state->window_creds_prompt);
+		gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt));
+		state->window_creds_prompt = NULL;
 	}
 }
 
@@ -141,8 +144,13 @@ static void callback_do_freeauth_and_close(GtkWidget *widget,
 	SAFE_FREE(state->account);
 	SAFE_FREE(state->password);
 
-	gtk_widget_destroy(state->window_creds_prompt);
-	gtk_widget_destroy(state->window_do_change);
+	if (state->window_creds_prompt) {
+		gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt));
+		state->window_creds_prompt = NULL;
+	}
+	if (state->window_do_change) {
+		gtk_widget_destroy(GTK_WIDGET(state->window_do_change));
+	}
 }
 
 static void free_join_state(struct join_state *s)
@@ -225,8 +233,12 @@ static void callback_do_exit(GtkWidget *widget,
 		default:
 			break;
 	}
-	gtk_widget_destroy(dialog);
-	gtk_widget_destroy(state->window_main);
+	if (dialog) {
+		gtk_widget_destroy(GTK_WIDGET(dialog));
+	}
+	if (state->window_main) {
+		gtk_widget_destroy(GTK_WIDGET(state->window_main));
+	}
 	do_cleanup(state);
 	exit(0);
 }
@@ -257,7 +269,7 @@ static void callback_do_reboot(GtkWidget *widget,
 	gtk_widget_show(dialog);
 #else
 	gtk_dialog_run(GTK_DIALOG(dialog));
-	gtk_widget_destroy(dialog);
+	gtk_widget_destroy(GTK_WIDGET(dialog));
 #endif
 
 	gtk_label_set_text(GTK_LABEL(state->label_reboot),
@@ -388,10 +400,12 @@ static void callback_do_storeauth(GtkWidget *widget,
 	SAFE_FREE(state->account);
 	SAFE_FREE(state->password);
 
-	callback_return_username(state->entry_account, state);
-	callback_return_password(state->entry_password, state);
+	callback_return_username(state->entry_account, (gpointer)state);
+	callback_return_password(state->entry_password, (gpointer)state);
 
-	gtk_widget_destroy(state->window_creds_prompt);
+	if (state->window_creds_prompt) {
+		gtk_widget_destroy(GTK_WIDGET(state->window_creds_prompt));
+	}
 }
 
 static void callback_continue(GtkWidget *widget,
@@ -1537,7 +1551,7 @@ static int init_join_state(struct join_state **state)
 {
 	struct join_state *s;
 
-	s = malloc(sizeof(struct join_state));
+	s = (struct join_state *)malloc(sizeof(struct join_state));
 	if (!s) {
 		return -1;
 	}
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index d0ecd22..3b2bce9 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -690,7 +690,8 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx,
 		r->out.netbios_domain_name = info->dns.name.string;
 		r->out.dns_domain_name = info->dns.dns_domain.string;
 		r->out.forest_name = info->dns.dns_forest.string;
-		r->out.domain_sid = info->dns.sid;
+		r->out.domain_sid = sid_dup_talloc(mem_ctx, info->dns.sid);
+		NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid);
 	}
 
 	if (!NT_STATUS_IS_OK(status)) {
@@ -703,7 +704,8 @@ static NTSTATUS libnet_join_lookup_dc_rpc(TALLOC_CTX *mem_ctx,
 		}
 
 		r->out.netbios_domain_name = info->account_domain.name.string;
-		r->out.domain_sid = info->account_domain.sid;
+		r->out.domain_sid = sid_dup_talloc(mem_ctx, info->account_domain.sid);
+		NT_STATUS_HAVE_NO_MEMORY(r->out.domain_sid);
 	}
 
 	rpccli_lsa_Close(pipe_hnd, mem_ctx, &lsa_pol);
@@ -1115,6 +1117,10 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
 	struct samr_Ids name_types;
 	union samr_UserInfo *info = NULL;
 
+	ZERO_STRUCT(sam_pol);
+	ZERO_STRUCT(domain_pol);
+	ZERO_STRUCT(user_pol);
+
 	status = cli_full_connection(&cli, NULL,
 				     r->in.dc_name,
 				     NULL, 0,
@@ -1216,8 +1222,12 @@ static NTSTATUS libnet_join_unjoindomain_rpc(TALLOC_CTX *mem_ctx,
 
 done:
 	if (pipe_hnd) {
-		rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
-		rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
+		if (is_valid_policy_hnd(&domain_pol)) {
+			rpccli_samr_Close(pipe_hnd, mem_ctx, &domain_pol);
+		}
+		if (is_valid_policy_hnd(&sam_pol)) {
+			rpccli_samr_Close(pipe_hnd, mem_ctx, &sam_pol);
+		}
 		TALLOC_FREE(pipe_hnd);
 	}
 
diff --git a/source/utils/net.c b/source/utils/net.c
index 99e1e0c..d8b8317 100644
--- a/source/utils/net.c
+++ b/source/utils/net.c
@@ -567,6 +567,8 @@ static struct functable net_func[] = {
 
 	libnetapi_free(c->netapi_ctx);
 
+	poptFreeContext(pc);
+
 	TALLOC_FREE(frame);
 	return rc;
 }


-- 
Samba Shared Repository


More information about the samba-cvs mailing list