aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2002-06-03 02:09:21 +0000
committerEric S. Raymond <esr@thyrsus.com>2002-06-03 02:09:21 +0000
commit7ce16230e78e39d755acc3ce15d523ac54f617d9 (patch)
tree03afbb19bd846d3a0139a75d098a0fd978fa873f
parent6fef88e75d33de13a07030a4a13774e709ef7f20 (diff)
downloadfetchmail-7ce16230e78e39d755acc3ce15d523ac54f617d9.tar.gz
fetchmail-7ce16230e78e39d755acc3ce15d523ac54f617d9.tar.bz2
fetchmail-7ce16230e78e39d755acc3ce15d523ac54f617d9.zip
Shrouding fix.
svn path=/trunk/; revision=3623
-rw-r--r--transact.c45
1 files changed, 20 insertions, 25 deletions
diff --git a/transact.c b/transact.c
index 0d219ad0..4750fbee 100644
--- a/transact.c
+++ b/transact.c
@@ -1333,6 +1333,23 @@ void init_transact(const struct method *proto)
protocol = (struct method *)proto;
}
+static void enshroud(char *buf)
+/* shroud a password in the given buffer */
+{
+ char *cp;
+
+ if (shroud[0] && (cp = strstr(buf, shroud)))
+ {
+ char *sp;
+
+ sp = cp + strlen(shroud);
+ *cp = '*';
+ while (*sp)
+ *cp++ = *sp++;
+ *cp = '\0';
+ }
+}
+
#if defined(HAVE_STDARG_H)
void gen_send(int sock, const char *fmt, ... )
#else
@@ -1372,18 +1389,7 @@ va_dcl
if (outlevel >= O_MONITOR)
{
- char *cp;
-
- if (shroud[0] && (cp = strstr(buf, shroud)))
- {
- char *sp;
-
- sp = cp + strlen(shroud);
- *cp++ = '*';
- while (*sp)
- *cp++ = *sp++;
- *cp = '\0';
- }
+ enshroud(buf);
buf[strlen(buf)-2] = '\0';
report(stdout, "%s> %s\n", protocol->name, buf);
}
@@ -1462,19 +1468,8 @@ va_dcl
if (outlevel >= O_MONITOR)
{
- char *cp;
-
- if (shroud && shroud[0] && (cp = strstr(buf, shroud)))
- {
- char *sp;
-
- sp = cp + strlen(shroud);
- *cp++ = '*';
- while (*sp)
- *cp++ = *sp++;
- *cp = '\0';
- }
- buf[strlen(buf)-1] = '\0';
+ enshroud(buf);
+ buf[strlen(buf)-2] = '\0';
report(stdout, "%s> %s\n", protocol->name, buf);
}