[PATCH 10/16] net: Use samba_getpass() function in net util.
Andreas Schneider
asn at samba.org
Tue Nov 27 04:23:50 MST 2012
Signed-off-by: Andreas Schneider <asn at samba.org>
---
source3/utils/net_util.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/source3/utils/net_util.c b/source3/utils/net_util.c
index 4c818f2..9c4a77e 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,
--
1.8.0
More information about the samba-technical
mailing list