int delivery_mode;
int message_originated_locally;
int is_lmtp;
+ int is_unfiltered;
int is_msa;
};
}
+/*
+ * We also have an unfiltered LMTP socket that bypasses spam filters.
+ */
+void lmtp_unfiltered_greeting(void) {
+ smtp_greeting();
+ SMTP->is_lmtp = 1;
+ SMTP->is_unfiltered = 1;
+}
+
+
/*
* Login greeting common to all auth methods
*/
char username[SIZ];
CtdlDecodeBase64(username, argbuf, SIZ);
- lprintf(CTDL_DEBUG, "Trying <%s>\n", username);
+ /* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
if (CtdlLoginExistingUser(username) == login_ok) {
CtdlEncodeBase64(buf, "Password:", 9);
cprintf("334 %s\r\n", buf);
char password[SIZ];
CtdlDecodeBase64(password, argbuf, SIZ);
- lprintf(CTDL_DEBUG, "Trying <%s>\n", password);
+ /* lprintf(CTDL_DEBUG, "Trying <%s>\n", password); */
if (CtdlTryPassword(password) == pass_ok) {
smtp_auth_greeting();
}
*/
void smtp_rset(int do_response) {
int is_lmtp;
+ int is_unfiltered;
/*
* Our entire SMTP state is discarded when a RSET command is issued,
* we save it for later.
*/
is_lmtp = SMTP->is_lmtp;
+ is_unfiltered = SMTP->is_unfiltered;
memset(SMTP, 0, sizeof(struct citsmtp));
* Reinstate this little piece of information we saved (see above).
*/
SMTP->is_lmtp = is_lmtp;
+ SMTP->is_unfiltered = is_unfiltered;
if (do_response) {
cprintf("250 2.0.0 Zap!\r\n");
* to be the user's Internet e-mail address as Citadel knows it.
*/
if (CC->logged_in) {
- strcpy(SMTP->from, CC->cs_inet_email);
+ safestrncpy(SMTP->from, CC->cs_inet_email, sizeof SMTP->from);
cprintf("250 2.1.0 Sender ok <%s>\r\n", SMTP->from);
SMTP->message_originated_locally = 1;
return;
* submission (such as virus checkers or spam filters), call them now
* and give them an opportunity to reject the message.
*/
- scan_errors = PerformMessageHooks(msg, EVT_SMTPSCAN);
+ if (SMTP->is_unfiltered) {
+ scan_errors = 0;
+ }
+ else {
+ scan_errors = PerformMessageHooks(msg, EVT_SMTPSCAN);
+ }
if (scan_errors > 0) { /* We don't want this message! */
}
} while (scan_done == 0);
if (strlen(mailfrom)==0) strcpy(mailfrom, "someone@somewhere.org");
+ stripallbut(mailfrom, '<', '>');
/* Figure out what mail exchanger host we have to connect to */
num_mxhosts = getmx(mxhosts, node);
bmsg->cm_fields['A'] = strdup("Citadel");
bmsg->cm_fields['O'] = strdup(MAILROOM);
bmsg->cm_fields['N'] = strdup(config.c_nodename);
+ bmsg->cm_fields['U'] = strdup("Delivery Status Notification (Failure)");
if (give_up) bmsg->cm_fields['M'] = strdup(
"A message you sent could not be delivered to some or all of its recipients\n"
* message and the message message.
*/
if (incomplete_deliveries_remaining <= 0) {
- CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, msgnum, "");
- CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, text_msgid, "");
+ CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, msgnum, "", 0);
+ CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, text_msgid, "", 0);
}
* instructions and replace with the updated ones.
*/
if (incomplete_deliveries_remaining > 0) {
- CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, msgnum, "");
+ CtdlDeleteMessages(SMTP_SPOOLOUT_ROOM, msgnum, "", 0);
msg = malloc(sizeof(struct CtdlMessage));
memset(msg, 0, sizeof(struct CtdlMessage));
msg->cm_magic = CTDLMESSAGE_MAGIC;
NULL);
CtdlRegisterServiceHook(0, /* local LMTP */
- "lmtp.socket",
- lmtp_greeting,
- smtp_command_loop,
- NULL);
+#ifndef HAVE_RUN_DIR
+ "."
+#else
+ RUN_DIR
+#endif
+ "/lmtp.socket",
+ lmtp_greeting,
+ smtp_command_loop,
+ NULL);
+
+ CtdlRegisterServiceHook(0, /* local LMTP */
+#ifndef HAVE_RUN_DIR
+ "."
+#else
+ RUN_DIR
+#endif
+ "/lmtp-unfiltered.socket",
+ lmtp_unfiltered_greeting,
+ smtp_command_loop,
+ NULL);
smtp_init_spoolout();
CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);