net: Use new samba_getpass() function for 'net rpc'.
authorAndreas Schneider <asn@samba.org>
Fri, 23 Nov 2012 14:05:51 +0000 (15:05 +0100)
committerAndreas Schneider <asn@samba.org>
Mon, 3 Dec 2012 13:35:09 +0000 (14:35 +0100)
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
source3/utils/net_rpc.c

index 60000242e05f025d79b2b14e97c7d130c2652c45..57d619e28b2a3e81b882f8a48efc57453147fc44 100644 (file)
@@ -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;
                }