commit 95276cd9672e7416265357303fd9db496ac01608
Author: Oswald Buddenhagen <[email protected]>
Date:   Mon Mar 30 14:52:02 2015 +0200

    don't insert unnecessary linebreaks upon PassCmd invocation
    
    the PassCmd will be typically non-interactive (or it will use a gui
    password agent), so starting a new line just makes the progress counter
    uglier. so make it configurable and default to no line break.

 src/drv_imap.c |   11 ++++++++---
 src/mbsync.1   |    5 ++++-
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index d00b43c..72a8fd1 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1723,13 +1723,18 @@ ensure_user( imap_server_conf_t *srvc )
 static const char *
 ensure_password( imap_server_conf_t *srvc )
 {
-       if (srvc->pass_cmd) {
+       char *cmd = srvc->pass_cmd;
+
+       if (cmd) {
                FILE *fp;
                int ret;
                char buffer[80];
 
-               flushn();
-               if (!(fp = popen( srvc->pass_cmd, "r" ))) {
+               if (*cmd == '+') {
+                       flushn();
+                       cmd++;
+               }
+               if (!(fp = popen( cmd, "r" ))) {
                  pipeerr:
                        sys_error( "Skipping account %s, password command 
failed", srvc->name );
                        return 0;
diff --git a/src/mbsync.1 b/src/mbsync.1
index 6007557..d525637 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -288,11 +288,14 @@ If neither a password nor a password command is specified 
in the
 configuration file, \fBmbsync\fR will prompt you for a password.
 ..
 .TP
-\fBPassCmd\fR \fIcommand\fR
+\fBPassCmd\fR [\fB+\fR]\fIcommand\fR
 Specify a shell command to obtain a password rather than specifying a
 password directly. This allows you to use password files and agents.
 The command must produce exactly one line on stdout; the trailing newline is
 optional.
+Prepend \fB+\fR to the command to indicate that it produces TTY output
+(e.g., a decryption password prompt); failure to do so will merely produce
+messier output.
 ..
 .TP
 \fBTunnel\fR \fIcommand\fR

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel

Reply via email to