[Avcheck] Patch: Preventing use of emtpy from
Thomas Weiss
panos@unbunt.org
Tue, 24 Sep 2002 13:44:31 +0200
--7AUc2qLy4jB3hD7Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi all,
here is a trivial patch against avcheck-0.9 that prevents avcheck from
using an empty from address when sending mail via pipe. Using an empty
from (as with bounce messages) causes problems with exim, while using
<> as from address (indicating a bounce message) does work with exim
3.35, postfix 1.11 and sendmail 8.11.3. Also the example shell scripts
should be modified to use <> instead of an empty argument to sendmail,
but I've not yet come around to do this.
Thomas
--7AUc2qLy4jB3hD7Z
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="avcheck.patch"
--- avcheck.c.orig Sat Jul 27 22:22:05 2002
+++ avcheck.c Tue Sep 24 12:29:32 2002
@@ -355,7 +355,8 @@
err(errno, "unable to pipe() or fork()");
if (!translate || cpid == 0) { /* child */
char **av = (char**)alloca(sizeof(char*) * (sendmail_argc + nto + 4));
- int ac;
+ int ac, from_empty = 1;
+ char *p;
cleanup_child();
close(pfd[1]);
if (pfd[0] != 0) {
@@ -365,8 +366,23 @@
}
for(ac = 0; ac < sendmail_argc; ++ac)
av[ac] = sendmail_argv[ac];
+
av[ac++] = "-f";
- av[ac++] = quoteaddr_alloc(from);
+
+ p = from;
+ while (*p != 0) {
+ if (!isspace(*p)) {
+ from_empty = 0;
+ break;
+ }
+ p++;
+ }
+
+ if (from_empty)
+ av[ac++] = "<>";
+ else
+ av[ac++] = quoteaddr_alloc(from);
+
av[ac++] = "--";
for(l = 0; l < nto; ++l)
av[ac++] = quoteaddr_alloc(to[l]);
--7AUc2qLy4jB3hD7Z--