diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-04-29 08:51:01 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-04-29 19:44:16 +1000 |
commit | 084c8065f871c1aa31f5d157f1843437db449603 (patch) | |
tree | bdfaf1453c6ff5cb4d67789aee25aaa659fc4e0f /source4 | |
parent | 716ae7b4c829c811eb8a7fe03b702afd51d448b4 (diff) | |
download | samba-084c8065f871c1aa31f5d157f1843437db449603.tar.gz samba-084c8065f871c1aa31f5d157f1843437db449603.tar.bz2 samba-084c8065f871c1aa31f5d157f1843437db449603.zip |
s4:libnet Make 'net vampire' more robust to command line arguments
When we have just joined a domain, we know a bit about that domain.
Use these to override previous guesses as to what domain and realm to
use for the rest of the join.
Andrew Bartlett
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libnet/libnet_vampire.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/source4/libnet/libnet_vampire.c b/source4/libnet/libnet_vampire.c index 8d2393fc2a..a5c8a8f5d4 100644 --- a/source4/libnet/libnet_vampire.c +++ b/source4/libnet/libnet_vampire.c @@ -36,6 +36,7 @@ #include "system/time.h" #include "lib/ldb_wrap.h" #include "auth/auth.h" +#include "auth/credentials/credentials.h" #include "param/param.h" #include "param/provision.h" #include "libcli/security/dom_sid.h" @@ -655,6 +656,11 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } + /* Re-use the domain we are joining as the domain for the user + * to be authenticated with, unless they specified + * otherwise */ + cli_credentials_set_domain(ctx->cred, r->in.domain_name, CRED_GUESS_ENV); + join->in.domain_name = r->in.domain_name; join->in.account_name = account_name; join->in.netbios_name = netbios_name; @@ -673,6 +679,20 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, s->targetdir = r->in.targetdir; ZERO_STRUCT(b); + + /* Be more robust: + * We now know the domain and realm for sure - if they didn't + * put one on the command line, use this for the rest of the + * join */ + cli_credentials_set_realm(ctx->cred, join->out.realm, CRED_GUESS_ENV); + cli_credentials_set_domain(ctx->cred, join->out.domain_name, CRED_GUESS_ENV); + + /* Now set these values into the smb.conf - we probably had + * empty or useless defaults here from whatever smb.conf we + * started with */ + lp_set_cmdline(s->lp_ctx, "realm", join->out.realm); + lp_set_cmdline(s->lp_ctx, "workgroup", join->out.domain_name); + b.in.domain_dns_name = join->out.realm; b.in.domain_netbios_name = join->out.domain_name; b.in.domain_sid = join->out.domain_sid; |