summaryrefslogtreecommitdiff
path: root/source4/lib/cmdline/credentials.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2005-12-18 21:44:43 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:47:28 -0500
commit46de306f13ec894c967a93121ac1b0847659cf01 (patch)
tree982685432acf9424f114b599707af040f12c9969 /source4/lib/cmdline/credentials.c
parent97b54b007e0f8a44074fa570b06b7ff9d4f2489b (diff)
downloadsamba-46de306f13ec894c967a93121ac1b0847659cf01.tar.gz
samba-46de306f13ec894c967a93121ac1b0847659cf01.tar.bz2
samba-46de306f13ec894c967a93121ac1b0847659cf01.zip
r12320: Add command-line processing hooks for simple bind DN, and password callback.
We may change this in future. Andrew Bartlett (This used to be commit 5fec784d4795af0cf82d36766586ded134f62165)
Diffstat (limited to 'source4/lib/cmdline/credentials.c')
-rw-r--r--source4/lib/cmdline/credentials.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source4/lib/cmdline/credentials.c b/source4/lib/cmdline/credentials.c
index a3d4920e6d..cb1ba5c963 100644
--- a/source4/lib/cmdline/credentials.c
+++ b/source4/lib/cmdline/credentials.c
@@ -32,13 +32,20 @@ static const char *cmdline_get_userpassword(struct cli_credentials *credentials)
const char *username;
TALLOC_CTX *mem_ctx = talloc_new(NULL);
- cli_credentials_get_ntlm_username_domain(credentials, mem_ctx, &username, &domain);
- if (domain && domain[0]) {
- prompt = talloc_asprintf(mem_ctx, "Password for [%s\\%s]:",
- domain, username);
- } else {
+ const char *bind_dn = cli_credentials_get_bind_dn(credentials);
+
+ if (bind_dn) {
prompt = talloc_asprintf(mem_ctx, "Password for [%s]:",
- username);
+ bind_dn);
+ } else {
+ cli_credentials_get_ntlm_username_domain(credentials, mem_ctx, &username, &domain);
+ if (domain && domain[0]) {
+ prompt = talloc_asprintf(mem_ctx, "Password for [%s\\%s]:",
+ domain, username);
+ } else {
+ prompt = talloc_asprintf(mem_ctx, "Password for [%s]:",
+ username);
+ }
}
ret = getpass(prompt);