summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
Diffstat (limited to 'source4')
-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 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)