diff options
-rw-r--r-- | source4/lib/cmdline/credentials.c | 9 | ||||
-rw-r--r-- | source4/lib/replace/libreplace.m4 | 1 |
2 files changed, 8 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; } diff --git a/source4/lib/replace/libreplace.m4 b/source4/lib/replace/libreplace.m4 index f06d7f83dc..c42d5bcf38 100644 --- a/source4/lib/replace/libreplace.m4 +++ b/source4/lib/replace/libreplace.m4 @@ -152,6 +152,7 @@ AC_CHECK_FUNCS(seteuid setresuid setegid setresgid chroot bzero strerror) AC_CHECK_FUNCS(vsyslog setlinebuf mktime ftruncate chsize rename) AC_CHECK_FUNCS(waitpid strlcpy strlcat initgroups memmove strdup) AC_CHECK_FUNCS(pread pwrite strndup strcasestr strtok_r mkdtemp socketpair) +AC_CHECK_FUNCS(isatty) AC_HAVE_DECL(setresuid, [#include <unistd.h>]) AC_HAVE_DECL(setresgid, [#include <unistd.h>]) AC_HAVE_DECL(errno, [#include <errno.h>]) |