util: Use new samba_getpass() function.
authorAndreas Schneider <asn@samba.org>
Thu, 22 Nov 2012 14:34:06 +0000 (15:34 +0100)
committerAndreas Schneider <asn@samba.org>
Mon, 3 Dec 2012 13:35:08 +0000 (14:35 +0100)
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
source3/lib/util_cmdline.c

index 4403846..d15f325 100644 (file)
@@ -246,7 +246,8 @@ bool set_cmdline_auth_info_machine_account_creds(struct user_auth_info *auth_inf
 void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info)
 {
        char *label = NULL;
-       char *pass;
+       char pwd[256] = {0};
+       int rc;
        TALLOC_CTX *frame;
 
        if (get_cmdline_auth_info_got_pass(auth_info) ||
@@ -258,9 +259,9 @@ void set_cmdline_auth_info_getpass(struct user_auth_info *auth_info)
        frame = talloc_stackframe();
        label = talloc_asprintf(frame, "Enter %s's password: ",
                        get_cmdline_auth_info_username(auth_info));
-       pass = getpass(label);
-       if (pass) {
-               set_cmdline_auth_info_password(auth_info, pass);
+       rc = samba_getpass(label, pwd, sizeof(pwd), false, false);
+       if (rc == 0) {
+               set_cmdline_auth_info_password(auth_info, pwd);
        }
        TALLOC_FREE(frame);
 }