From bb9f5f35e102edd80ca22fbea45435fc4f4b3147 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 15 Sep 2004 03:02:49 +0000 Subject: [PATCH] * Add an SMTP MSA listener (separate port, requires auth) --- citadel/ChangeLog | 4 +++- citadel/citadel.h | 7 ++++--- citadel/control.c | 4 ++++ citadel/routines2.c | 5 +++-- citadel/serv_smtp.c | 27 +++++++++++++++++++++++++-- citadel/serv_vandelay.c | 2 ++ citadel/setup.c | 1 + 7 files changed, 42 insertions(+), 8 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index c95e3f6fd..f9b2ea962 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,7 @@ $Log$ + Revision 625.22 2004/09/15 03:02:47 ajc + * Add an SMTP MSA listener (separate port, requires auth) + Revision 625.21 2004/09/13 15:51:59 ajc * newinstall.sh: updated from the working version at easyinstall.citadel.org @@ -6080,4 +6083,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/citadel.h b/citadel/citadel.h index abd392e6f..9e30841ad 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -32,7 +32,7 @@ extern "C" { /* * Text description of this software */ -#define CITADEL "Citadel 6.25" +#define CITADEL "Citadel 6.26" /* * REV_LEVEL is the current version number (multiplied by 100 to avoid having @@ -44,9 +44,9 @@ extern "C" { * usually more strict because you're not really supposed to dump/load and * upgrade at the same time. */ -#define REV_LEVEL 625 /* This version */ +#define REV_LEVEL 626 /* This version */ #define REV_MIN 591 /* Oldest compatible database */ -#define EXPORT_REV_MIN 623 /* Oldest compatible export files */ +#define EXPORT_REV_MIN 626 /* Oldest compatible export files */ #define SERVER_TYPE 0 /* zero for stock Citadel; other developers please obtain SERVER_TYPE codes for your implementations */ @@ -135,6 +135,7 @@ struct config { char c_ldap_base_dn[256]; /* LDAP base DN */ char c_ldap_bind_dn[256]; /* LDAP bind DN */ char c_ldap_bind_pw[256]; /* LDAP bind password */ + int c_msa_port; /* SMTP MSA listener port (usu 587) */ }; /* diff --git a/citadel/control.c b/citadel/control.c index 93e5324d0..a9adb4f10 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -210,6 +210,7 @@ void cmd_conf(char *argbuf) cprintf("\n"); #endif cprintf("%s\n", config.c_ip_addr); + cprintf("%d\n", config.c_msa_port); cprintf("000\n"); } @@ -372,6 +373,9 @@ void cmd_conf(char *argbuf) case 37: safestrncpy(config.c_ip_addr, buf, sizeof config.c_ip_addr); + case 38: + config.c_msa_port = atoi(buf); + break; } ++a; } diff --git a/citadel/routines2.c b/citadel/routines2.c index 8a76f8bd0..52e836f18 100644 --- a/citadel/routines2.c +++ b/citadel/routines2.c @@ -644,7 +644,7 @@ void read_bio(CtdlIPC *ipc) void do_system_configuration(CtdlIPC *ipc) { -#define NUM_CONFIGS 38 +#define NUM_CONFIGS 39 char buf[SIZ]; char sc[NUM_CONFIGS][SIZ]; @@ -737,7 +737,8 @@ void do_system_configuration(CtdlIPC *ipc) strprompt("Server IP address (0.0.0.0 for 'any')", &sc[37][0], 15); strprompt("POP3 server port (-1 to disable)", &sc[23][0], 5); strprompt("IMAP server port (-1 to disable)", &sc[27][0], 5); - strprompt("SMTP server port (-1 to disable)", &sc[24][0], 5); + strprompt("SMTP MTA server port (-1 to disable)", &sc[24][0], 5); + strprompt("SMTP MSA server port (-1 to disable)", &sc[38][0], 5); /* This logic flips the question around, because it's one of those * situations where 0=yes and 1=no diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 0670302fe..065304947 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -92,6 +92,7 @@ struct citsmtp { /* Information about the current session */ int delivery_mode; int message_originated_locally; int is_lmtp; + int is_msa; }; enum { /* Command states for login authentication */ @@ -138,6 +139,15 @@ void smtp_greeting(void) { cprintf("220 %s ESMTP Citadel server ready.\r\n", config.c_fqdn); } +/* + * SMTP MSA port requires authentication. + */ +void smtp_msa_greeting(void) { + smtp_greeting(); + SMTP->is_msa = 1; +} + + /* * LMTP is like SMTP but with some extra bonus footage added. */ @@ -559,6 +569,13 @@ void smtp_rcpt(char *argbuf) { return; } + if ( (SMTP->is_msa) && (!CC->logged_in) ) { + cprintf("550 5.1.8 " + "You must log in to send mail on this port.\r\n"); + strcpy(SMTP->from, ""); + return; + } + strcpy(recp, &argbuf[3]); striplt(recp); stripallbut(recp, '<', '>'); @@ -1628,13 +1645,19 @@ void smtp_init_spoolout(void) { char *serv_smtp_init(void) { - CtdlRegisterServiceHook(config.c_smtp_port, /* On the net... */ + CtdlRegisterServiceHook(config.c_smtp_port, /* SMTP MTA */ NULL, smtp_greeting, smtp_command_loop, NULL); - CtdlRegisterServiceHook(0, /* ...and locally */ + CtdlRegisterServiceHook(config.c_msa_port, /* SMTP MSA */ + NULL, + smtp_msa_greeting, + smtp_command_loop, + NULL); + + CtdlRegisterServiceHook(0, /* local LMTP */ "lmtp.socket", lmtp_greeting, smtp_command_loop, diff --git a/citadel/serv_vandelay.c b/citadel/serv_vandelay.c index 101e68042..272476a45 100644 --- a/citadel/serv_vandelay.c +++ b/citadel/serv_vandelay.c @@ -298,6 +298,7 @@ void artv_do_export(void) { cprintf("%s\n", config.c_ldap_bind_dn); cprintf("%s\n", config.c_ldap_bind_pw); cprintf("%s\n", config.c_ip_addr); + cprintf("%d\n", config.c_msa_port); /* Export the control file */ get_control(); @@ -363,6 +364,7 @@ void artv_import_config(void) { client_gets(config.c_ldap_bind_dn); client_gets(config.c_ldap_bind_pw); client_gets(config.c_ip_addr); + client_gets(buf); config.c_msa_port = atoi(buf); put_config(); lprintf(CTDL_INFO, "Imported config file\n"); } diff --git a/citadel/setup.c b/citadel/setup.c index bd3196adf..3681061d9 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -1083,6 +1083,7 @@ int main(int argc, char *argv[]) if (config.c_smtp_port == 0) config.c_smtp_port = 25; if (config.c_pop3_port == 0) config.c_pop3_port = 110; if (config.c_imap_port == 0) config.c_imap_port = 143; + if (config.c_msa_port == 0) config.c_msa_port = 587; /* Go through a series of dialogs prompting for config info */ if (setup_type != UI_SILENT) { -- 2.39.2