summaryrefslogtreecommitdiff
path: root/auth/credentials/credentials.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-10-18 08:41:46 +1100
committerAndrew Bartlett <abartlet@samba.org>2011-10-18 13:13:30 +1100
commit734e5c521cb06a91e708226e0eb6d003175958c2 (patch)
treeed4441c4f533511d3af524d3ff80e39e64075b17 /auth/credentials/credentials.c
parentf8c6219188fa4ce39a35a8f192c649a6aa9c7ec1 (diff)
downloadsamba-734e5c521cb06a91e708226e0eb6d003175958c2.tar.gz
credentials: Prioritise command-line specified options above defaults from smb.conf
If a user specified -W or --realm on the command line, then this is of level SPECIFIED, not UNINITIALISED, despite it going via the loadparm system. This helps us to ensure that -W server -Ulocaluser is parsed the same as -Userver\localuser. This matters as otherwise we might instead attempt to use kerberos to the realm from the smb.conf. Andrew Bartlett
Diffstat (limited to 'auth/credentials/credentials.c')
-rw-r--r--auth/credentials/credentials.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/auth/credentials/credentials.c b/auth/credentials/credentials.c
index ee60220ec7b..3eaccde25ee 100644
--- a/auth/credentials/credentials.c
+++ b/auth/credentials/credentials.c
@@ -681,9 +681,21 @@ _PUBLIC_ void cli_credentials_set_conf(struct cli_credentials *cred,
struct loadparm_context *lp_ctx)
{
cli_credentials_set_username(cred, "", CRED_UNINITIALISED);
- cli_credentials_set_domain(cred, lpcfg_workgroup(lp_ctx), CRED_UNINITIALISED);
- cli_credentials_set_workstation(cred, lpcfg_netbios_name(lp_ctx), CRED_UNINITIALISED);
- cli_credentials_set_realm(cred, lpcfg_realm(lp_ctx), CRED_UNINITIALISED);
+ if (lpcfg_parm_is_cmdline(lp_ctx, "workgroup")) {
+ cli_credentials_set_domain(cred, lpcfg_workgroup(lp_ctx), CRED_SPECIFIED);
+ } else {
+ cli_credentials_set_domain(cred, lpcfg_workgroup(lp_ctx), CRED_UNINITIALISED);
+ }
+ if (lpcfg_parm_is_cmdline(lp_ctx, "netbios name")) {
+ cli_credentials_set_workstation(cred, lpcfg_netbios_name(lp_ctx), CRED_SPECIFIED);
+ } else {
+ cli_credentials_set_workstation(cred, lpcfg_netbios_name(lp_ctx), CRED_UNINITIALISED);
+ }
+ if (lpcfg_parm_is_cmdline(lp_ctx, "realm")) {
+ cli_credentials_set_realm(cred, lpcfg_realm(lp_ctx), CRED_SPECIFIED);
+ } else {
+ cli_credentials_set_realm(cred, lpcfg_realm(lp_ctx), CRED_UNINITIALISED);
+ }
}
/**