[PATCH 09/16] net: Use new samba_getpass() function for 'net rpc'.

Andreas Schneider asn at samba.org
Tue Nov 27 04:23:49 MST 2012


Signed-off-by: Andreas Schneider <asn at samba.org>
---
 source3/utils/net_rpc.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 6000024..57d619e 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/utils/net_rpc.c
@@ -886,13 +886,20 @@ static int rpc_user_password(struct net_context *c, int argc, const char **argv)
 	if (argv[1]) {
 		u1003.usri1003_password = argv[1];
 	} else {
+		char pwd[256] = {0};
 		ret = asprintf(&prompt, _("Enter new password for %s:"),
 			       argv[0]);
 		if (ret == -1) {
 			return -1;
 		}
-		u1003.usri1003_password = talloc_strdup(c, getpass(prompt));
+
+		ret = samba_getpass(prompt, pwd, sizeof(pwd), false, false);
 		SAFE_FREE(prompt);
+		if (ret < 0) {
+			return -1;
+		}
+
+		u1003.usri1003_password = talloc_strdup(c, pwd);
 		if (u1003.usri1003_password == NULL) {
 			return -1;
 		}
-- 
1.8.0




More information about the samba-technical mailing list