From 7cc108c93cd10ac592c28605f2c1e366a7e507b2 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Fri, 23 Nov 2012 14:48:00 +0100 Subject: cmdline: Use new samba_getpass() function. Reviewed-by: Jelmer Vernooij --- source4/lib/cmdline/credentials.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source4') diff --git a/source4/lib/cmdline/credentials.c b/source4/lib/cmdline/credentials.c index f919842e6a..fb517f3c08 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) -- cgit