diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2000-03-05 22:28:50 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2000-03-05 22:28:50 +0000 |
commit | 3a04ee22d1b955e9e1f1f27f5e8473e07b2b1afc (patch) | |
tree | 858e729ff0d836b09eeffefa66676c5a0924e929 /fetchmail.c | |
parent | b4a6572a6a6afeedbc23e84e0536728ab01dcf04 (diff) | |
download | fetchmail-3a04ee22d1b955e9e1f1f27f5e8473e07b2b1afc.tar.gz fetchmail-3a04ee22d1b955e9e1f1f27f5e8473e07b2b1afc.tar.bz2 fetchmail-3a04ee22d1b955e9e1f1f27f5e8473e07b2b1afc.zip |
Deal with the possibility that we might be running as a subprocess.
svn path=/trunk/; revision=2783
Diffstat (limited to 'fetchmail.c')
-rw-r--r-- | fetchmail.c | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/fetchmail.c b/fetchmail.c index 3d0c81b2..faaf52f4 100644 --- a/fetchmail.c +++ b/fetchmail.c @@ -510,22 +510,30 @@ int main(int argc, char **argv) for (ctl = querylist; ctl; ctl = ctl->next) { if (ctl->active && !(implicitmode && ctl->server.skip) - && ctl->server.protocol != P_ETRN - && ctl->server.protocol != P_IMAP_K4 + && ctl->server.protocol != P_ETRN + && ctl->server.protocol != P_IMAP_K4 #ifdef GSSAPI - && ctl->server.protocol != P_IMAP_GSS + && ctl->server.protocol != P_IMAP_GSS #endif /* GSSAPI */ - && !ctl->password) - { - char* password_prompt = _("Enter password for %s@%s: "); - - xalloca(tmpbuf, char *, strlen(password_prompt) + - strlen(ctl->remotename) + - strlen(ctl->server.pollname) + 1); - (void) sprintf(tmpbuf, password_prompt, - ctl->remotename, ctl->server.pollname); - ctl->password = xstrdup((char *)getpassword(tmpbuf)); - } + && !ctl->password) + if (!isatty(0)) + { + fprintf(stderr, + _("fetchmail: can't find a password for %s@s.\n"), + ctl->remotename, ctl->server.pollname); + return(PS_AUTHFAIL); + } + else + { + char* password_prompt = _("Enter password for %s@%s: "); + + xalloca(tmpbuf, char *, strlen(password_prompt) + + strlen(ctl->remotename) + + strlen(ctl->server.pollname) + 1); + (void) sprintf(tmpbuf, password_prompt, + ctl->remotename, ctl->server.pollname); + ctl->password = xstrdup((char *)getpassword(tmpbuf)); + } } /* |