Howdy,
transact.c contains the following declaration of shroud:
char shroud[PASSWORDLEN]; /* string to shroud in debug output */
In the same file, gen_transact tests that shroud is nonzero,
which is always true. Removing the test makes the code
identical to that in gen_send.
Also, gen_send removes the trailing \r before reporting, whereas
gen_transact doesn't.
The following patch removes the obsolete test, moves the
duplicated code to a new function, enshroud, and makes
gen_transact not report the final \r.
Matt
--- fetchmail-5.9.11/transact.c Sat Mar 9 05:40:44 2002
+++ fetchmail/transact.c Wed Apr 24 17:26:50 2002
@@ -1333,6 +1333,23 @@
protocol = (struct method *)proto;
}
+void
+enshroud(char *buf)
+{
+ 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 @@
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 @@
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);
}
pgpSnRO1P1kgR.pgp
Description: PGP signature