* 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();
}
if (result == login_ok) {
if (CtdlTryPassword(pass, len) == pass_ok) {
-//// smtp_webcit_preferences_hack();
+ smtp_webcit_preferences_hack();
smtp_auth_greeting(offset, Flags);
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);
}
* 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.
*
- *
- *
- *
*/
const char *smtp_get_Recipients(void);
int is_lmtp;
int is_unfiltered;
int is_msa;
-}citsmtp;
+ StrBuf *preferred_sender_email;
+ StrBuf *preferred_sender_name;
+} citsmtp;
#define SMTP ((citsmtp *)CC->session_specific_data)