summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-11-23 14:48:00 +0100
committerAndreas Schneider <asn@samba.org>2012-12-03 14:35:10 +0100
commit7cc108c93cd10ac592c28605f2c1e366a7e507b2 (patch)
tree6f87d01873a3428aa5e4da06d5debd483d345444
parentde1288e13eb132768d22ae8c2f34a5e99bddcb33 (diff)
downloadsamba-7cc108c93cd10ac592c28605f2c1e366a7e507b2.tar.gz
cmdline: Use new samba_getpass() function.
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
-rw-r--r--source4/lib/cmdline/credentials.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/source4/lib/cmdline/credentials.c b/source4/lib/cmdline/credentials.c
index f919842e6aa..fb517f3c084 100644
--- a/source4/lib/cmdline/credentials.c
+++ b/source4/lib/cmdline/credentials.c
@@ -24,19 +24,23 @@
static const char *cmdline_get_userpassword(struct cli_credentials *credentials)
{
- char *ret;
TALLOC_CTX *mem_ctx = talloc_new(NULL);
-
const char *prompt_name = cli_credentials_get_unparsed_name(credentials, mem_ctx);
const char *prompt;
+ static char pwd[256]; /* FIXME: Return a dup pwd and free it. */
+ int rc;
prompt = talloc_asprintf(mem_ctx, "Password for [%s]:",
prompt_name);
- ret = getpass(prompt);
-
+ memset(pwd, '\0', sizeof(pwd));
+ rc = samba_getpass(prompt, pwd, sizeof(pwd), false, false);
talloc_free(mem_ctx);
- return ret;
+ if (rc < 0) {
+ return NULL;
+ }
+
+ return pwd;
}
bool cli_credentials_set_cmdline_callbacks(struct cli_credentials *cred)