diff options
author | Günther Deschner <gd@samba.org> | 2008-04-14 16:15:18 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2008-04-14 16:15:18 +0200 |
commit | cbd07aa047e3895f74da984a646fb5fac4980a4a (patch) | |
tree | b8f0029c1dc8af4b365b4c5d6a97c09f642a7896 /source3 | |
parent | bc65d9678274d5d1c2f0179955c6d2cfdf20c752 (diff) | |
download | samba-cbd07aa047e3895f74da984a646fb5fac4980a4a.tar.gz samba-cbd07aa047e3895f74da984a646fb5fac4980a4a.tar.bz2 samba-cbd07aa047e3895f74da984a646fb5fac4980a4a.zip |
libnetjoin: Fix unjoining when no KRB5CCNAME is around.
Guenther
(This used to be commit 7fd237c545e0a7e0029195dbbb6691571abdfe84)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libnet/libnet_join.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/libnet/libnet_join.c b/source3/libnet/libnet_join.c index aff61d8807..dda945e529 100644 --- a/source3/libnet/libnet_join.c +++ b/source3/libnet/libnet_join.c @@ -1449,10 +1449,18 @@ 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; } @@ -1496,6 +1504,7 @@ 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) { @@ -1507,6 +1516,13 @@ 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; |