summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-04-14 12:20:33 +0200
committerGünther Deschner <gd@samba.org>2008-04-14 12:33:10 +0200
commite33b13e826b9628fd03f2bd6a3c97a7ac90b4259 (patch)
treecad3a3c1bc3171398f236ae39e19ba0538ce93c8 /source3
parent09c5d892201a94c8d24bc5b593942a869ece2f34 (diff)
downloadsamba-e33b13e826b9628fd03f2bd6a3c97a7ac90b4259.tar.gz
samba-e33b13e826b9628fd03f2bd6a3c97a7ac90b4259.tar.bz2
samba-e33b13e826b9628fd03f2bd6a3c97a7ac90b4259.zip
libnetjoin: Fix joining when no KRB5CCNAME is around.
Guenther (This used to be commit 512e6ca0a9be9fe35994ec1010110573a5b551d1)
Diffstat (limited to 'source3')
-rw-r--r--source3/libnet/libnet_join.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c
index 16db032c50..51278b5a0a 100644
--- a/source3/libnet/libnet_join.c
+++ b/source3/libnet/libnet_join.c
@@ -1426,10 +1426,17 @@ 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;
}
@@ -1452,6 +1459,7 @@ 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) {
@@ -1463,6 +1471,13 @@ 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;