* The VRFY and EXPN commands have been removed from this implementation
* because nobody uses these commands anymore, except for spammers.
*
- * Copyright (c) 1998-2012 by the citadel.org team
+ * Copyright (c) 1998-2013 by the citadel.org team
*
- * This program is open source software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 3.
+ * This program is open source software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 3.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
*/
#include "sysdep.h"
sSMTP->from = NewStrBufPlain(NULL, SIZ);
sSMTP->recipients = NewStrBufPlain(NULL, SIZ);
sSMTP->OneRcpt = NewStrBufPlain(NULL, SIZ);
+ sSMTP->preferred_sender_email = NULL;
+ sSMTP->preferred_sender_name = NULL;
/* If this config option is set, reject connections from problem
* addresses immediately instead of after they execute a RCPT
void smtp_webcit_preferences_hack(void) {
char config_roomname[ROOMNAMELEN];
char *webcit_conf = NULL;
+ citsmtp *sSMTP = SMTP;
snprintf(config_roomname, sizeof config_roomname, "%010ld.%s", CC->user.usernum, USERCONFIGROOM);
if (CtdlGetRoom(&CC->room, config_roomname) != 0) {
return;
}
- /* FIXME : now do something with this data */
+ /* Parse the webcit configuration and attempt to do something useful with it */
+ char *str = webcit_conf;
+ char *saveptr = str;
+ char *this_line = NULL;
+ while (this_line = strtok_r(str, "\n", &saveptr), this_line != NULL) {
+ str = NULL;
+ if (!strncasecmp(this_line, "defaultfrom|", 12)) {
+ sSMTP->preferred_sender_email = NewStrBufPlain(&this_line[12], -1);
+ }
+ if (!strncasecmp(this_line, "defaultname|", 12)) {
+ sSMTP->preferred_sender_name = NewStrBufPlain(&this_line[12], -1);
+ }
+ if ((!strncasecmp(this_line, "defaultname|", 12)) && (sSMTP->preferred_sender_name == NULL)) {
+ sSMTP->preferred_sender_name = NewStrBufPlain(&this_line[12], -1);
+ }
+ }
free(webcit_conf);
- abort();
}
* Set do_response to nonzero to output the SMTP RSET response code.
*/
void smtp_rset(long offset, long do_response) {
- int is_lmtp;
- int is_unfiltered;
citsmtp *sSMTP = SMTP;
/*
* but we need to preserve this one little piece of information, so
* we save it for later.
*/
- is_lmtp = sSMTP->is_lmtp;
- is_unfiltered = sSMTP->is_unfiltered;
- memset(sSMTP, 0, sizeof(citsmtp));
+ FlushStrBuf(sSMTP->Cmd);
+ FlushStrBuf(sSMTP->helo_node);
+ FlushStrBuf(sSMTP->from);
+ FlushStrBuf(sSMTP->recipients);
+ FlushStrBuf(sSMTP->OneRcpt);
+
+ sSMTP->command_state = 0;
+ sSMTP->number_of_recipients = 0;
+ sSMTP->delivery_mode = 0;
+ sSMTP->message_originated_locally = 0;
+ sSMTP->is_msa = 0;
+ /*
+ * we must remember is_lmtp & is_unfiltered.
+ */
/*
* It is somewhat ambiguous whether we want to log out when a RSET
* }
*/
- /*
- * Reinstate this little piece of information we saved (see above).
- */
- sSMTP->is_lmtp = is_lmtp;
- sSMTP->is_unfiltered = is_unfiltered;
-
if (do_response) {
cprintf("250 Zap!\r\n");
}
*/
else if (config.c_allow_spoofing == 0) {
process_rfc822_addr(ChrPtr(sSMTP->from), user, node, name);
+ syslog(LOG_DEBUG, "Claimed envelope sender is '%s' == '%s' @ '%s' ('%s')",
+ ChrPtr(sSMTP->from), user, node, name
+ );
if (CtdlHostAlias(node) != hostalias_nomatch) {
cprintf("550 You must log in to send mail from %s\r\n", node);
FlushStrBuf(sSMTP->from);
+ syslog(LOG_DEBUG, "Rejecting unauthenticated mail from %s", node);
return;
}
}
if (msg->cm_fields['N'] != NULL) free(msg->cm_fields['N']);
if (msg->cm_fields['H'] != NULL) free(msg->cm_fields['H']);
if (msg->cm_fields['O'] != NULL) free(msg->cm_fields['O']);
- msg->cm_fields['A'] = strdup(CCC->user.fullname);
msg->cm_fields['N'] = strdup(config.c_nodename);
msg->cm_fields['H'] = strdup(config.c_humannode);
msg->cm_fields['O'] = strdup(MAILROOM);
+ msg->cm_fields['A'] =
+ ((sSMTP->preferred_sender_name != NULL)
+ ? strdup(ChrPtr(sSMTP->preferred_sender_name))
+ : strdup(CCC->user.fullname)
+ );
+
if (!validemail) {
if (msg->cm_fields['F'] != NULL) free(msg->cm_fields['F']);
- msg->cm_fields['F'] = strdup(CCC->cs_inet_email);
+ msg->cm_fields['F'] =
+ ((sSMTP->preferred_sender_email != NULL)
+ ? strdup(ChrPtr(sSMTP->preferred_sender_email))
+ : strdup(CCC->cs_inet_email)
+ );
}
}
FreeStrBuf(&sSMTP->from);
FreeStrBuf(&sSMTP->recipients);
FreeStrBuf(&sSMTP->OneRcpt);
+ FreeStrBuf(&sSMTP->preferred_sender_email);
+ FreeStrBuf(&sSMTP->preferred_sender_name);
free(sSMTP);
}