aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>1996-10-14 03:46:10 +0000
committerEric S. Raymond <esr@thyrsus.com>1996-10-14 03:46:10 +0000
commit2bdac43bdd6dbcc9bcd03083bf7384e3c64e2cfc (patch)
tree5c9fef74f80e5b8e44de2652544ed88174d26013
parent70d0ff9e092f0a3f1dfe883af49386ed17b35c65 (diff)
downloadfetchmail-2bdac43bdd6dbcc9bcd03083bf7384e3c64e2cfc.tar.gz
fetchmail-2bdac43bdd6dbcc9bcd03083bf7384e3c64e2cfc.tar.bz2
fetchmail-2bdac43bdd6dbcc9bcd03083bf7384e3c64e2cfc.zip
Password is now shrouded when -v is on.
svn path=/trunk/; revision=329
-rw-r--r--NEWS4
-rw-r--r--driver.c48
2 files changed, 36 insertions, 16 deletions
diff --git a/NEWS b/NEWS
index e4d2f65b..6f100a88 100644
--- a/NEWS
+++ b/NEWS
@@ -15,11 +15,13 @@ fetchmail-1.9 ():
* Add option to set server nonresponse timeout.
+* Password is no longer displayed in verbose mode.
+
fetchmail-1.8 (Fri Oct 11 15:08:10 EDT 1996):
features --
-* Use kill(0, pid) to make lock handling a bit smarter (thanks to Johann
+* Use kill(0, pid) to make lock handling a bit smarter (thanks to Johan
Vromans <JVromans@squirrel.nl> for the suggestion).
* Arrange for timeout of client after 5 minutes if connection to server is
diff --git a/driver.c b/driver.c
index 45f17344..8acc54cc 100644
--- a/driver.c
+++ b/driver.c
@@ -13,10 +13,11 @@
#include <config.h>
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <varargs.h>
#include <sys/time.h>
#include <signal.h>
+#include <string.h>
#ifdef KERBEROS_V4
#include <krb.h>
@@ -39,6 +40,8 @@ char tag[TAGLEN];
static int tagnum;
#define GENSYM (sprintf(tag, "a%04d", ++tagnum), tag)
+static char *shroud;
+
/*********************************************************************
function:
description: hack message headers so replies will work properly
@@ -642,7 +645,9 @@ struct method *proto;
goto cleanUp;
/* try to get authorized to fetch mail */
+ shroud = queryctl->password;
ok = (protocol->getauth)(socket, queryctl, buf);
+ shroud = (char *)NULL;
if (alarmed || ok == PS_ERROR)
ok = PS_AUTHFAIL;
if (alarmed || ok != 0)
@@ -655,7 +660,8 @@ struct method *proto;
/* show user how many messages we downloaded */
if (outlevel > O_SILENT && outlevel < O_VERBOSE)
if (count == 0)
- fprintf(stderr, "No mail from %s\n", queryctl->servername);
+ fprintf(stderr, "No mail from %s@%s\n",
+ queryctl->remotename, queryctl->servername);
else
fprintf(stderr,
"%d message%s from %s.\n",
@@ -814,22 +820,28 @@ int socket;
const char *fmt;
va_dcl {
- char buf [POPBUFSIZE+1];
- va_list ap;
+ char buf [POPBUFSIZE+1];
+ va_list ap;
- if (protocol->tagged)
- (void) sprintf(buf, "%s ", GENSYM);
- else
- buf[0] = '\0';
+ if (protocol->tagged)
+ (void) sprintf(buf, "%s ", GENSYM);
+ else
+ buf[0] = '\0';
- va_start(ap);
- vsprintf(buf + strlen(buf), fmt, ap);
- va_end(ap);
+ va_start(ap);
+ vsprintf(buf + strlen(buf), fmt, ap);
+ va_end(ap);
- SockPuts(socket, buf);
+ SockPuts(socket, buf);
- if (outlevel == O_VERBOSE)
- fprintf(stderr,"> %s\n", buf);
+ if (outlevel == O_VERBOSE)
+ {
+ char *cp;
+
+ if (shroud && (cp = strstr(buf, shroud)))
+ memset(cp, '*', strlen(shroud));
+ fprintf(stderr,"> %s\n", buf);
+ }
}
/*********************************************************************
@@ -866,7 +878,13 @@ va_dcl {
SockPuts(socket, buf);
if (outlevel == O_VERBOSE)
- fprintf(stderr,"> %s\n", buf);
+ {
+ char *cp;
+
+ if (shroud && (cp = strstr(buf, shroud)))
+ memset(cp, '*', strlen(shroud));
+ fprintf(stderr,"> %s\n", buf);
+ }
/* we presume this does its own response echoing */
ok = (protocol->parse_response)(socket, buf);