diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-09-01 20:25:24 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 15:03:23 -0500 |
commit | 6131ff85d550b4c7b2f45e0860c5d90da61cc6b6 (patch) | |
tree | 057b3fd3a0c83ba40dc3c70f75168c6847055ec2 /source4/lib/cmdline | |
parent | c37fa61abcfceb36c6f5e25ed20f43019ea8bd3f (diff) | |
download | samba-6131ff85d550b4c7b2f45e0860c5d90da61cc6b6.tar.gz samba-6131ff85d550b4c7b2f45e0860c5d90da61cc6b6.tar.bz2 samba-6131ff85d550b4c7b2f45e0860c5d90da61cc6b6.zip |
r24868: Don't use callbacks for prompting when stdout is not a tty.
(This used to be commit 9b02a39c156862f9e9258dcdb9b8b86715022fc1)
Diffstat (limited to 'source4/lib/cmdline')
-rw-r--r-- | source4/lib/cmdline/credentials.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source4/lib/cmdline/credentials.c b/source4/lib/cmdline/credentials.c index 36e0504021..2e5c6fd94a 100644 --- a/source4/lib/cmdline/credentials.c +++ b/source4/lib/cmdline/credentials.c @@ -38,7 +38,12 @@ static const char *cmdline_get_userpassword(struct cli_credentials *credentials) return ret; } -void cli_credentials_set_cmdline_callbacks(struct cli_credentials *cred) +bool cli_credentials_set_cmdline_callbacks(struct cli_credentials *cred) { - cli_credentials_set_password_callback(cred, cmdline_get_userpassword); + if (isatty(fileno(stdout))) { + cli_credentials_set_password_callback(cred, cmdline_get_userpassword); + return true; + } + + return false; } |