From: Günther Deschner Date: Tue, 27 May 2008 14:45:04 +0000 (+0200) Subject: wbinfo: prompt for password when none has been given. X-Git-Tag: samba-3.3.0pre1~1118^2~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7c1f36d84a4c5779ea86923be69e209d0c9c0943;p=thirdparty%2Fsamba.git wbinfo: prompt for password when none has been given. Guenther --- diff --git a/source/nsswitch/wbinfo.c b/source/nsswitch/wbinfo.c index 7bb4abe9b2e..2fb46c4a2f7 100644 --- a/source/nsswitch/wbinfo.c +++ b/source/nsswitch/wbinfo.c @@ -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);