diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2002-06-03 02:09:21 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2002-06-03 02:09:21 +0000 |
commit | 7ce16230e78e39d755acc3ce15d523ac54f617d9 (patch) | |
tree | 03afbb19bd846d3a0139a75d098a0fd978fa873f | |
parent | 6fef88e75d33de13a07030a4a13774e709ef7f20 (diff) | |
download | fetchmail-7ce16230e78e39d755acc3ce15d523ac54f617d9.tar.gz fetchmail-7ce16230e78e39d755acc3ce15d523ac54f617d9.tar.bz2 fetchmail-7ce16230e78e39d755acc3ce15d523ac54f617d9.zip |
Shrouding fix.
svn path=/trunk/; revision=3623
-rw-r--r-- | transact.c | 45 |
1 files changed, 20 insertions, 25 deletions
@@ -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); } |