mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
libnetjoin: Fix joining when no KRB5CCNAME is around.
Guenther
(This used to be commit 512e6ca0a9
)
This commit is contained in:
parent
09c5d89220
commit
e33b13e826
@ -1426,10 +1426,17 @@ static WERROR libnet_join_post_processing(TALLOC_CTX *mem_ctx,
|
|||||||
|
|
||||||
static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r)
|
static int libnet_destroy_JoinCtx(struct libnet_JoinCtx *r)
|
||||||
{
|
{
|
||||||
|
const char *krb5_cc_env = NULL;
|
||||||
|
|
||||||
if (r->in.ads) {
|
if (r->in.ads) {
|
||||||
ads_destroy(&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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1452,6 +1459,7 @@ WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx,
|
|||||||
struct libnet_JoinCtx **r)
|
struct libnet_JoinCtx **r)
|
||||||
{
|
{
|
||||||
struct libnet_JoinCtx *ctx;
|
struct libnet_JoinCtx *ctx;
|
||||||
|
const char *krb5_cc_env = NULL;
|
||||||
|
|
||||||
ctx = talloc_zero(mem_ctx, struct libnet_JoinCtx);
|
ctx = talloc_zero(mem_ctx, struct libnet_JoinCtx);
|
||||||
if (!ctx) {
|
if (!ctx) {
|
||||||
@ -1463,6 +1471,13 @@ WERROR libnet_init_JoinCtx(TALLOC_CTX *mem_ctx,
|
|||||||
ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
|
ctx->in.machine_name = talloc_strdup(mem_ctx, global_myname());
|
||||||
W_ERROR_HAVE_NO_MEMORY(ctx->in.machine_name);
|
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;
|
ctx->in.secure_channel_type = SEC_CHAN_WKSTA;
|
||||||
|
|
||||||
*r = ctx;
|
*r = ctx;
|
||||||
|
Loading…
Reference in New Issue
Block a user