summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2017-06-19 14:50:33 +0200
committerAndreas Schneider <asn@cryptomilk.org>2017-06-20 10:39:15 +0200
commit0caf40ec0196de0de016fda0d4aff0734d498d2b (patch)
tree35fd1e9f79ea04b6dc34d277059433ee3d50a5c6 /source3/lib
parent5b3c121a261b8e1c99809d16d9e4e4edf7fb2060 (diff)
downloadsamba-0caf40ec0196de0de016fda0d4aff0734d498d2b.tar.gz
s3:popt_common: Reparse the username in popt_common_credentials_post()
When we parse the username in the options handling, the smb.conf file has not been loaded yet. So we are not aware of a 'winbind separator' set in the config file. We need to read and set the username again in the post-processing of the credentials. https://bugzilla.samba.org/show_bug.cgi?id=12849 Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/popt_common.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/source3/lib/popt_common.c b/source3/lib/popt_common.c
index 1c1e3d7c9d4..65b6efeeb54 100644
--- a/source3/lib/popt_common.c
+++ b/source3/lib/popt_common.c
@@ -247,6 +247,8 @@ void popt_common_credentials_set_delay_post(void)
void popt_common_credentials_post(void)
{
+ const char *username = NULL;
+
if (get_cmdline_auth_info_use_machine_account(cmdline_auth_info) &&
!set_cmdline_auth_info_machine_account_creds(cmdline_auth_info))
{
@@ -256,6 +258,20 @@ void popt_common_credentials_post(void)
}
set_cmdline_auth_info_getpass(cmdline_auth_info);
+
+ /*
+ * When we set the username during the handling of the options passed to
+ * the binary we haven't loaded the config yet. This means that we
+ * didnn't take the 'winbind separator' into account.
+ *
+ * The username might contain the domain name and thus it hasn't been
+ * correctly parsed yet. If we have a username we need to set it again
+ * to run the string parser for the username correctly.
+ */
+ username = get_cmdline_auth_info_username(cmdline_auth_info);
+ if (username != NULL && username[0] != '\0') {
+ set_cmdline_auth_info_username(cmdline_auth_info, username);
+ }
}
static void popt_common_credentials_callback(poptContext con,