wbinfo: prompt for password when none has been given.
authorGünther Deschner <gd@samba.org>
Tue, 27 May 2008 14:45:04 +0000 (16:45 +0200)
committerGünther Deschner <gd@samba.org>
Tue, 27 May 2008 14:48:03 +0000 (16:48 +0200)
Guenther
(This used to be commit 7c1f36d84a4c5779ea86923be69e209d0c9c0943)

source3/nsswitch/wbinfo.c

index 7bb4abe9b2e557178c938f1697b174c209d1699a..2fb46c4a2f701f5cf30cd7824d1ec91989069e79 100644 (file)
@@ -958,7 +958,14 @@ static bool wbinfo_auth(char *username)
                p++;
                password = p;
        } else {
-               password = "";
+               char *prompt;
+               asprintf(&prompt, "Enter %s's password:", username);
+               if (!prompt) {
+                       return false;
+               }
+
+               password = getpass(prompt);
+               SAFE_FREE(prompt);
        }
 
        name = s;
@@ -1001,6 +1008,16 @@ static bool wbinfo_auth_crap(char *username)
        if (p) {
                *p = 0;
                fstrcpy(pass, p + 1);
+       } else {
+               char *prompt;
+               asprintf(&prompt, "Enter %s's password:", username);
+               if (!prompt) {
+                       return false;
+               }
+
+               fstrcpy(pass, getpass(prompt));
+               SAFE_FREE(prompt);
+
        }
                
        parse_wbinfo_domain_user(username, name_domain, name_user);