* Add an SMTP MSA listener (separate port, requires auth)
authorArt Cancro <ajc@citadel.org>
Wed, 15 Sep 2004 03:02:49 +0000 (03:02 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 15 Sep 2004 03:02:49 +0000 (03:02 +0000)
citadel/ChangeLog
citadel/citadel.h
citadel/control.c
citadel/routines2.c
citadel/serv_smtp.c
citadel/serv_vandelay.c
citadel/setup.c

index c95e3f6fd568f256b7e8994702ab1555f494c456..f9b2ea962b97481f553226da8dd98859a38a1c64 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
-
index abd392e6fe52d64e4a2950ef75462051ad0df2b5..9e30841adb6a750c1563f1a6a5cf14efcf30ef72 100644 (file)
@@ -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) */
 };
 
 /*
index 93e5324d0e6b2dd60f58a34de23a57837d76eb3a..a9adb4f103ae271d8916ad026badcd010f663605 100644 (file)
@@ -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;
                }
index 8a76f8bd02dbb960eebef289017b8870b535f77d..52e836f1860f92839a2b6398de4b8de755a3567b 100644 (file)
@@ -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
index 0670302fefd8f4001d07c31c7ca32e83c7277398..065304947d54a9b254a9a9383e6322420c4752ed 100644 (file)
@@ -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,
index 101e6804227e3130c786e62f9b8a3cbcc3fdf717..272476a450fa454c23b3531768b6511b469bdb7f 100644 (file)
@@ -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");
 }
index bd3196adf3cfbd21069d04a7eaf9d2ae24dddd39..3681061d9609425465cfc3f2557b240277a3cf09 100644 (file)
@@ -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) {