#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"
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_m(krb5_cc_env, "MEMORY:libnetjoin")) {
- unsetenv(KRB5_ENV_CCNAME);
- }
-
return 0;
}
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_m(krb5_cc_env, "MEMORY:libnetjoin")) {
- unsetenv(KRB5_ENV_CCNAME);
- }
-
return 0;
}
struct libnet_JoinCtx **r)
{
struct libnet_JoinCtx *ctx;
- const char *krb5_cc_env = NULL;
ctx = talloc_zero(mem_ctx, struct libnet_JoinCtx);
if (!ctx) {
ctx->in.machine_name = talloc_strdup(mem_ctx, lp_netbios_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;
*r = 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) {
ctx->in.machine_name = talloc_strdup(mem_ctx, lp_netbios_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);
- }
-
*r = ctx;
return WERR_OK;
#include "session.h"
#include "smbd/smbd.h"
#include "auth.h"
+#include "krb5_env.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_RPC_SRV
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)) {
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)) {