[SCM] Samba Shared Repository - branch v3-2-test updated -
initial-v3-2-unstable-1182-g04d78d4
Günther Deschner
gd at samba.org
Tue Jan 8 11:01:29 GMT 2008
The branch, v3-2-test has been updated
via 04d78d4d9a8cffe44c927036038aef1d6d6b44b2 (commit)
via 421905fb608df6736944ac21ac67abee24991521 (commit)
via c49196954d38f0c2851abbfe25086cd6fe660a2e (commit)
via ba2b8a310e1d6f78116350e24c17ae4db08b9bed (commit)
via 7f51583f681b1acc9bfbab6ee0e2d1c13d2c4ca4 (commit)
from 0bd2643463a9160c8a1c7e1c2f8cca7b89060e09 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-2-test
- Log -----------------------------------------------------------------
commit 04d78d4d9a8cffe44c927036038aef1d6d6b44b2
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 8 11:55:45 2008 +0100
Correctly free buffers in netdomjoin-gui.
Guenther
commit 421905fb608df6736944ac21ac67abee24991521
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 8 11:54:51 2008 +0100
Make name_buffer in NetGetJoinInformation() talloced.
Guenther
commit c49196954d38f0c2851abbfe25086cd6fe660a2e
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 8 11:53:38 2008 +0100
Add NetApiBufferFree() to libnetapi.
Guenther
commit ba2b8a310e1d6f78116350e24c17ae4db08b9bed
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 8 11:49:35 2008 +0100
Fix crash bug when strequal is used too late in libnetapi_free.
Guenther
commit 7f51583f681b1acc9bfbab6ee0e2d1c13d2c4ca4
Author: Günther Deschner <gd at samba.org>
Date: Tue Jan 8 11:46:11 2008 +0100
When unjoining fails (e.g. missing creds) make sure we still correct config.
Guenther
-----------------------------------------------------------------------
Summary of changes:
.../examples/netdomjoin-gui/netdomjoin-gui.c | 9 ++++++-
source/lib/netapi/joindomain.c | 4 +-
source/lib/netapi/netapi.c | 27 ++++++++++++++++---
source/lib/netapi/netapi.h | 5 +++
source/libnet/libnet_join.c | 4 +++
5 files changed, 41 insertions(+), 8 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 1e1681b..4a3588e 100644
--- a/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
+++ b/source/lib/netapi/examples/netdomjoin-gui/netdomjoin-gui.c
@@ -249,6 +249,8 @@ static void callback_do_reboot(GtkWidget *widget,
SAFE_FREE(buffer);
state->name_type_new = type;
#endif
+ NetApiBufferFree((void *)buffer);
+
gtk_label_set_text(GTK_LABEL(state->label_current_name_buffer),
state->name_buffer_new);
if (state->name_type_new == NetSetupDomainName) {
@@ -1292,8 +1294,12 @@ static int initialize_join_state(struct join_state *state,
if (status) {
return status;
}
- state->name_buffer_initial = (char *)buffer;
+ state->name_buffer_initial = strdup(buffer);
+ if (!state->name_buffer_initial) {
+ return -1;
+ }
state->name_type_initial = type;
+ NetApiBufferFree((void *)buffer);
}
{
@@ -1311,6 +1317,7 @@ static int initialize_join_state(struct join_state *state,
if (!state->comment) {
return -1;
}
+ NetApiBufferFree(buffer);
}
#if 0
{
diff --git a/source/lib/netapi/joindomain.c b/source/lib/netapi/joindomain.c
index aa8ec6e..e4fb63e 100644
--- a/source/lib/netapi/joindomain.c
+++ b/source/lib/netapi/joindomain.c
@@ -437,9 +437,9 @@ static WERROR NetGetJoinInformationLocal(struct libnetapi_ctx *ctx,
uint16_t *name_type)
{
if ((lp_security() == SEC_ADS) && lp_realm()) {
- *name_buffer = SMB_STRDUP(lp_realm());
+ *name_buffer = talloc_strdup(ctx, lp_realm());
} else {
- *name_buffer = SMB_STRDUP(lp_workgroup());
+ *name_buffer = talloc_strdup(ctx, lp_workgroup());
}
if (!*name_buffer) {
return WERR_NOMEM;
diff --git a/source/lib/netapi/netapi.c b/source/lib/netapi/netapi.c
index 61b5190..d4cb3a9 100644
--- a/source/lib/netapi/netapi.c
+++ b/source/lib/netapi/netapi.c
@@ -103,6 +103,14 @@ NET_API_STATUS libnetapi_getctx(struct libnetapi_ctx **ctx)
NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
{
+
+ if (ctx->krb5_cc_env) {
+ char *env = getenv(KRB5_ENV_CCNAME);
+ if (env && (strequal(ctx->krb5_cc_env, env))) {
+ unsetenv(KRB5_ENV_CCNAME);
+ }
+ }
+
gfree_names();
gfree_loadparm();
gfree_case_tables();
@@ -113,11 +121,6 @@ NET_API_STATUS libnetapi_free(struct libnetapi_ctx *ctx)
secrets_shutdown();
regdb_close();
- if (ctx->krb5_cc_env &&
- (strequal(ctx->krb5_cc_env, getenv(KRB5_ENV_CCNAME)))) {
- unsetenv(KRB5_ENV_CCNAME);
- }
-
TALLOC_FREE(ctx);
TALLOC_FREE(frame);
@@ -221,3 +224,17 @@ const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx)
{
return ctx->error_string;
}
+
+/****************************************************************
+****************************************************************/
+
+NET_API_STATUS NetApiBufferFree(void *buffer)
+{
+ if (!buffer) {
+ return W_ERROR_V(WERR_INSUFFICIENT_BUFFER);
+ }
+
+ talloc_free(buffer);
+
+ return NET_API_STATUS_SUCCESS;
+}
diff --git a/source/lib/netapi/netapi.h b/source/lib/netapi/netapi.h
index 46dd8e1..4a40b32 100644
--- a/source/lib/netapi/netapi.h
+++ b/source/lib/netapi/netapi.h
@@ -53,6 +53,11 @@ const char *libnetapi_get_error_string(struct libnetapi_ctx *ctx);
/****************************************************************
****************************************************************/
+NET_API_STATUS NetApiBufferFree(void *buffer);
+
+/****************************************************************
+****************************************************************/
+
/* wkssvc */
NET_API_STATUS NetJoinDomain(const char *server,
const char *domain,
diff --git a/source/libnet/libnet_join.c b/source/libnet/libnet_join.c
index f4c0dfa..05ab184 100644
--- a/source/libnet/libnet_join.c
+++ b/source/libnet/libnet_join.c
@@ -1075,6 +1075,9 @@ static WERROR libnet_DomainUnjoin(TALLOC_CTX *mem_ctx,
status = libnet_join_unjoindomain_rpc(mem_ctx, r);
if (!NT_STATUS_IS_OK(status)) {
+ libnet_unjoin_set_error_string(mem_ctx, r,
+ "failed to unjoin domain: %s\n",
+ nt_errstr(status));
if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_USER)) {
return WERR_SETUP_NOT_JOINED;
}
@@ -1113,6 +1116,7 @@ WERROR libnet_Unjoin(TALLOC_CTX *mem_ctx,
if (r->in.unjoin_flags & WKSSVC_JOIN_FLAGS_JOIN_TYPE) {
werr = libnet_DomainUnjoin(mem_ctx, r);
if (!W_ERROR_IS_OK(werr)) {
+ do_UnjoinConfig(r);
return werr;
}
}
--
Samba Shared Repository
More information about the samba-cvs
mailing list