summaryrefslogtreecommitdiff
path: root/nsswitch
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-11-22 15:33:10 +0100
committerAndreas Schneider <asn@samba.org>2012-12-03 14:35:08 +0100
commit04c0d4878e3bb28b8ba8116abb0de4527eb96bd6 (patch)
tree00786aef367f78eb68f688feb15b3c47da6aadde /nsswitch
parent27a1327b49210e342741cf8fb11576983cbcc36d (diff)
downloadsamba-04c0d4878e3bb28b8ba8116abb0de4527eb96bd6.tar.gz
wbinfo: Use new samba_getpass() function.
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'nsswitch')
-rw-r--r--nsswitch/wbinfo.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/nsswitch/wbinfo.c b/nsswitch/wbinfo.c
index aee4004e57d..0e102dc8582 100644
--- a/nsswitch/wbinfo.c
+++ b/nsswitch/wbinfo.c
@@ -1435,7 +1435,8 @@ static char *wbinfo_prompt_pass(TALLOC_CTX *mem_ctx,
const char *username)
{
char *prompt;
- const char *ret = NULL;
+ char buf[1024] = {0};
+ int rc;
prompt = talloc_asprintf(mem_ctx, "Enter %s's ", username);
if (!prompt) {
@@ -1452,10 +1453,13 @@ static char *wbinfo_prompt_pass(TALLOC_CTX *mem_ctx,
return NULL;
}
- ret = getpass(prompt);
+ rc = samba_getpass(prompt, buf, sizeof(buf), false, false);
TALLOC_FREE(prompt);
+ if (rc < 0) {
+ return NULL;
+ }
- return talloc_strdup(mem_ctx, ret);
+ return talloc_strdup(mem_ctx, buf);
}
/* Authenticate a user with a plaintext password */
@@ -1860,7 +1864,10 @@ static bool wbinfo_klog(char *username)
*p = '%';
} else {
fstrcpy(request.data.auth.user, username);
- fstrcpy(request.data.auth.pass, getpass("Password: "));
+ (void) samba_getpass("Password: ",
+ request.data.auth.pass,
+ sizeof(request.data.auth.pass),
+ false, false);
}
request.flags |= WBFLAG_PAM_AFS_TOKEN;