[SCM] Samba Shared Repository - branch v3-6-test updated

Karolin Seeger kseeger at samba.org
Wed Sep 28 12:06:42 MDT 2011


The branch, v3-6-test has been updated
       via  65d953f s3-libnet: allow to use default krb5 ccache in libnet_Join/libnet_Unjoin.
      from  82e2f18 Revert "s3-libnet: allow to use default krb5 ccache in libnet_Join/libnet_Unjoin."

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


- Log -----------------------------------------------------------------
commit 65d953f074394c0a588f1741aeb6c79f1a515866
Author: Günther Deschner <gd at samba.org>
Date:   Wed Sep 21 17:28:58 2011 +0200

    s3-libnet: allow to use default krb5 ccache in libnet_Join/libnet_Unjoin.
    
    We force using a MEMORY ccache though in the wkssvc server.
    
    Guenther
    
    Part of a fix for bug #7465 (net ads join -k didn't work if KRB5CCNAME is not
    set).

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

Summary of changes:
 source3/libnet/libnet_join.c              |   31 -----------------------------
 source3/rpc_server/wkssvc/srv_wkssvc_nt.c |    5 ++++
 2 files changed, 5 insertions(+), 31 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 6750120..7bb436b 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -35,7 +35,6 @@
 #include "secrets.h"
 #include "rpc_client/init_lsa.h"
 #include "rpc_client/cli_pipe.h"
-#include "krb5_env.h"
 #include "../libcli/security/security.h"
 #include "passdb.h"
 #include "libsmb/libsmb.h"
@@ -1764,17 +1763,10 @@ static WERROR libnet_join_post_processing(TALLOC_CTX *mem_ctx,
 
 static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r)
 {
-	const char *krb5_cc_env = NULL;
-
 	if (r->in.ads) {
 		ads_destroy(&r->in.ads);
 	}
 
-	krb5_cc_env = getenv(KRB5_ENV_CCNAME);
-	if (krb5_cc_env && StrCaseCmp(krb5_cc_env, "MEMORY:libnetjoin")) {
-		unsetenv(KRB5_ENV_CCNAME);
-	}
-
 	return 0;
 }
 
@@ -1783,17 +1775,10 @@ static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r)
 
 static int libnet_destroy_UnjoinCtx(struct libnet_UnjoinCtx *r)
 {
-	const char *krb5_cc_env = NULL;
-
 	if (r->in.ads) {
 		ads_destroy(&r->in.ads);
 	}
 
-	krb5_cc_env = getenv(KRB5_ENV_CCNAME);
-	if (krb5_cc_env && StrCaseCmp(krb5_cc_env, "MEMORY:libnetjoin")) {
-		unsetenv(KRB5_ENV_CCNAME);
-	}
-
 	return 0;
 }
 
@@ -1804,7 +1789,6 @@ WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx,
 			   struct libnet_JoinCtx **r)
 {
 	struct libnet_JoinCtx *ctx;
-	const char *krb5_cc_env = NULL;
 
 	ctx = talloc_zero(mem_ctx, struct libnet_JoinCtx);
 	if (!ctx) {
@@ -1816,13 +1800,6 @@ WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx,
 	ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
 	W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name);
 
-	krb5_cc_env = getenv(KRB5_ENV_CCNAME);
-	if (!krb5_cc_env || (strlen(krb5_cc_env) == 0)) {
-		krb5_cc_env = talloc_strdup(mem_ctx, "MEMORY:libnetjoin");
-		W_ERROR_HAVE_NO_MEMORY(krb5_cc_env);
-		setenv(KRB5_ENV_CCNAME, krb5_cc_env, 1);
-	}
-
 	ctx->in.secure_channel_type = SEC_CHAN_WKSTA;
 
 	*r = ctx;
@@ -1837,7 +1814,6 @@ WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx,
 			     struct libnet_UnjoinCtx **r)
 {
 	struct libnet_UnjoinCtx *ctx;
-	const char *krb5_cc_env = NULL;
 
 	ctx = talloc_zero(mem_ctx, struct libnet_UnjoinCtx);
 	if (!ctx) {
@@ -1849,13 +1825,6 @@ WERROR libnet_init_UnjoinCtx(TALLOC_CTX *mem_ctx,
 	ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
 	W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name);
 
-	krb5_cc_env = getenv(KRB5_ENV_CCNAME);
-	if (!krb5_cc_env || (strlen(krb5_cc_env) == 0)) {
-		krb5_cc_env = talloc_strdup(mem_ctx, "MEMORY:libnetjoin");
-		W_ERROR_HAVE_NO_MEMORY(krb5_cc_env);
-		setenv(KRB5_ENV_CCNAME, krb5_cc_env, 1);
-	}
-
 	*r = ctx;
 
 	return WERR_OK;
diff --git a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
index 0dd89ae..1764941 100644
--- a/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
+++ b/source3/rpc_server/wkssvc/srv_wkssvc_nt.c
@@ -32,6 +32,7 @@
 #include "session.h"
 #include "smbd/smbd.h"
 #include "auth.h"
+#include "krb5_env.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_SRV
@@ -867,7 +868,9 @@ WERROR _wkssvc_NetrJoinDomain2(struct pipes_struct *p,
 	j->in.msg_ctx		= p->msg_ctx;
 
 	become_root();
+	setenv(KRB5_ENV_CCNAME, "MEMORY:_wkssvc_NetrJoinDomain2", 1);
 	werr = libnet_Join(p->mem_ctx, j);
+	unsetenv(KRB5_ENV_CCNAME);
 	unbecome_root();
 
 	if (!W_ERROR_IS_OK(werr)) {
@@ -933,7 +936,9 @@ WERROR _wkssvc_NetrUnjoinDomain2(struct pipes_struct *p,
 	u->in.msg_ctx		= p->msg_ctx;
 
 	become_root();
+	setenv(KRB5_ENV_CCNAME, "MEMORY:_wkssvc_NetrUnjoinDomain2", 1);
 	werr = libnet_Unjoin(p->mem_ctx, u);
+	unsetenv(KRB5_ENV_CCNAME);
 	unbecome_root();
 
 	if (!W_ERROR_IS_OK(werr)) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list