svn commit: samba r24868 - in branches/SAMBA_4_0: . source/lib/cmdline source/lib/replace

jelmer at samba.org jelmer at samba.org
Sat Sep 1 20:25:26 GMT 2007


Author: jelmer
Date: 2007-09-01 20:25:24 +0000 (Sat, 01 Sep 2007)
New Revision: 24868

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=24868

Log:
Don't use callbacks for prompting when stdout is not a tty.
Modified:
   branches/SAMBA_4_0/
   branches/SAMBA_4_0/source/lib/cmdline/credentials.c
   branches/SAMBA_4_0/source/lib/replace/libreplace.m4


Changeset:

Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...

Modified: branches/SAMBA_4_0/source/lib/cmdline/credentials.c
===================================================================
--- branches/SAMBA_4_0/source/lib/cmdline/credentials.c	2007-09-01 20:19:29 UTC (rev 24867)
+++ branches/SAMBA_4_0/source/lib/cmdline/credentials.c	2007-09-01 20:25:24 UTC (rev 24868)
@@ -38,7 +38,12 @@
 	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;
 }

Modified: branches/SAMBA_4_0/source/lib/replace/libreplace.m4
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/libreplace.m4	2007-09-01 20:19:29 UTC (rev 24867)
+++ branches/SAMBA_4_0/source/lib/replace/libreplace.m4	2007-09-01 20:25:24 UTC (rev 24868)
@@ -152,6 +152,7 @@
 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>])



More information about the samba-cvs mailing list