summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-11-23 13:17:13 +0100
committerAndreas Schneider <asn@samba.org>2012-12-03 14:35:09 +0100
commit270d721d36890a13ec9a393a09925d1ca27a337f (patch)
tree142fde07a1d4ef4c179026f0870ee8b41ff22b6a
parent0d5f5424b4b86c16d51a5793fa93c3bfe3cdb11a (diff)
downloadsamba-270d721d36890a13ec9a393a09925d1ca27a337f.tar.gz
samba-270d721d36890a13ec9a393a09925d1ca27a337f.tar.bz2
samba-270d721d36890a13ec9a393a09925d1ca27a337f.zip
net: Use samba_getpass() function in net util.
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
-rw-r--r--source3/utils/net_util.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index 4c818f2f18..9c4a77eff4 100644
--- a/source3/utils/net_util.c
+++ b/source3/utils/net_util.c
@@ -482,7 +482,8 @@ done:
const char *net_prompt_pass(struct net_context *c, const char *user)
{
char *prompt = NULL;
- const char *pass = NULL;
+ char pwd[256] = {0};
+ int rc;
if (c->opt_password) {
return c->opt_password;
@@ -500,10 +501,13 @@ const char *net_prompt_pass(struct net_context *c, const char *user)
return NULL;
}
- pass = getpass(prompt);
+ rc = samba_getpass(prompt, pwd, sizeof(pwd), false, false);
SAFE_FREE(prompt);
+ if (rc < 0) {
+ return NULL;
+ }
- return pass;
+ return SMB_STRDUP(pwd);
}
int net_run_function(struct net_context *c, int argc, const char **argv,