From: Günther Deschner Date: Tue, 19 Aug 2008 13:32:37 +0000 (+0200) Subject: wbinfo: add wbinfo_prompt_pass. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=7cf6ed68236e7dd64657cb1087a5a687d6f59ad1;p=thirdparty%2Fsamba.git wbinfo: add wbinfo_prompt_pass. Guenther --- diff --git a/source/nsswitch/wbinfo.c b/source/nsswitch/wbinfo.c index c1d41a53fdc..3ae3d218f4c 100644 --- a/source/nsswitch/wbinfo.c +++ b/source/nsswitch/wbinfo.c @@ -879,6 +879,33 @@ static bool wbinfo_lookupname(const char *full_name) return true; } +static char *wbinfo_prompt_pass(const char *prefix, + const char *username) +{ + char *prompt; + const char *ret = NULL; + + prompt = talloc_asprintf(talloc_tos(), "Enter %s's ", username); + if (!prompt) { + return NULL; + } + if (prefix) { + prompt = talloc_asprintf_append(prompt, "%s ", prefix); + if (!prompt) { + return NULL; + } + } + prompt = talloc_asprintf_append(prompt, "password: "); + if (!prompt) { + return NULL; + } + + ret = getpass(prompt); + TALLOC_FREE(prompt); + + return SMB_STRDUP(ret); +} + /* Authenticate a user with a plaintext password */ static bool wbinfo_auth_krb5(char *username, const char *cctype, uint32 flags)