/*
+ * Copyright (c) 2008-2014, Simon Schubert <2@0x2c.org>.
* Copyright (c) 2008 The DragonFly Project. All rights reserved.
*
* This code is derived from software contributed to The DragonFly Project
- * by Simon 'corecode' Schubert <corecode@fs.ei.tum.de>.
+ * by Simon Schubert <2@0x2c.org>.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
/* Don't bounce bounced mails */
if (it->sender[0] == 0) {
syslog(LOG_INFO, "can not bounce a bounce message, discarding");
- exit(1);
+ exit(EX_SOFTWARE);
}
bzero(&bounceq, sizeof(bounceq));
LIST_INIT(&bounceq.queue);
bounceq.sender = "";
- if (add_recp(&bounceq, it->sender, 1) != 0)
+ if (add_recp(&bounceq, it->sender, EXPAND_WILDCARD) != 0)
goto fail;
if (newspoolf(&bounceq) != 0)
error = fprintf(bounceq.mailf,
"Received: from MAILER-DAEMON\n"
"\tid %s\n"
- "\tby %s (%s)\n"
+ "\tby %s (%s);\n"
"\t%s\n"
"X-Original-To: <%s>\n"
"From: MAILER-DAEMON <>\n"
fail:
syslog(LOG_CRIT, "error creating bounce: %m");
delqueue(it);
- exit(1);
+ exit(EX_IOERR);
}
struct parse_state {
ps->pos = 0;
addr = strdup(ps->addr);
if (addr == NULL)
- errlog(1, NULL);
+ errlog(EX_SOFTWARE, NULL);
- if (add_recp(queue, addr, 1) != 0)
- errlogx(1, "invalid recipient `%s'", addr);
+ if (add_recp(queue, addr, EXPAND_WILDCARD) != 0)
+ errlogx(EX_DATAERR, "invalid recipient `%s'", addr);
goto again;
}
"Received: from %s (uid %d)\n"
"\t(envelope-from %s)\n"
"\tid %s\n"
- "\tby %s (%s)\n"
+ "\tby %s (%s);\n"
"\t%s\n",
username, useruid,
queue->sender,
if (fgets(line, sizeof(line) - 1, stdin) == NULL)
break;
if (had_last_line)
- errlogx(1, "bad mail input format");
+ errlogx(EX_DATAERR, "bad mail input format:"
+ " from %s (uid %d) (envelope-from %s)",
+ username, useruid, queue->sender);
linelen = strlen(line);
if (linelen == 0 || line[linelen - 1] != '\n') {
/*
if (parse_state.state != NONE) {
if (parse_addrs(&parse_state, line, queue) < 0) {
- errlogx(1, "invalid address in header\n");
+ errlogx(EX_DATAERR, "invalid address in header\n");
/* NOTREACHED */
}
}
strprefixcmp(line, "Bcc:") == 0)) {
parse_state.state = START;
if (parse_addrs(&parse_state, line, queue) < 0) {
- errlogx(1, "invalid address in header\n");
+ errlogx(EX_DATAERR, "invalid address in header\n");
/* NOTREACHED */
}
}