* Properly handle all aliases specified in network/mail.aliases for incoming
authorArt Cancro <ajc@citadel.org>
Sat, 26 Feb 2000 18:30:43 +0000 (18:30 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 26 Feb 2000 18:30:43 +0000 (18:30 +0000)
  SMTP mail (uses the alias() function, so if we replace that function with
  something that uses the same calling convention, it'll still work)

citadel/ChangeLog
citadel/citadel.h
citadel/internet_addressing.c
citadel/network/mail.aliases
citadel/serv_smtp.c
citadel/sysconfig.h

index b349384b6be73e76d309013e7c2edd047698125e..e2728305c77d26285449eb0fac0151ff62af2c67 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 1.471  2000/02/26 18:30:40  ajc
+* Properly handle all aliases specified in network/mail.aliases for incoming
+  SMTP mail (uses the alias() function, so if we replace that function with
+  something that uses the same calling convention, it'll still work)
+
 Revision 1.470  2000/02/26 05:15:38  ajc
 * Fortified the message base and SMTP code so that misdirected bounce messages
   end up in the Aide> room instead of getting dereferenced
@@ -1667,3 +1672,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
+
index b97a759799f762be759ca60a0f4e89cdd1c31180..b963d47e3214366159cfe5570bb439acb026054f 100644 (file)
@@ -8,7 +8,7 @@
 #include "sysdep.h"
 #include "sysconfig.h"
 #include "ipcdef.h"
-#define CITADEL        "Citadel/UX 5.60"
+#define CITADEL        "Citadel/UX 5.70"
 #define REV_LEVEL 560
 #define SERVER_TYPE 0  /* zero for stock Citadel/UX; other developers please
                           obtain SERVER_TYPE codes for your implementations */
index a4f8218f521e471f61f73999befc7f2ab10fcd0a..e82d63a7c4aebc230105d0eefa98f4ec29e2f751 100644 (file)
@@ -27,6 +27,7 @@
 #include "support.h"
 #include "config.h"
 #include "tools.h"
+#include "msgbase.h"
 #include "internet_addressing.h"
 #include "user_ops.h"
 #include "room_ops.h"
@@ -129,7 +130,6 @@ void unfold_rfc822_field(char *field) {
 
 /*
  * Split an RFC822-style address into userid, host, and full name
- * (Originally from citmail.c, and unchanged so far)
  *
  */
 void process_rfc822_addr(char *rfc822, char *user, char *node, char *name)
@@ -241,22 +241,35 @@ void process_rfc822_addr(char *rfc822, char *user, char *node, char *name)
                        if (node[a] == '>')
                                node[a] = 0;
        }
-       /* strip anything to the left of a @ */
-       while ((strlen(node) > 0) && (haschar(node, '@') > 0))
-               strcpy(node, &node[1]);
 
-       /* strip anything to the left of a % */
-       while ((strlen(node) > 0) && (haschar(node, '%') > 0))
-               strcpy(node, &node[1]);
+       /* If no node specified, tack ours on instead */
+       if (
+               (haschar(node, '@')==0)
+               && (haschar(node, '%')==0)
+               && (haschar(node, '!')==0)
+       ) {
+               strcpy(node, config.c_nodename);
+       }
 
-       /* reduce multiple system bang paths to node!user */
-       while ((strlen(node) > 0) && (haschar(node, '!') > 1))
-               strcpy(node, &node[1]);
+       else {
 
-       /* now get rid of the user portion of a node!user string */
-       for (a = 0; a < strlen(node); ++a)
-               if (node[a] == '!')
-                       node[a] = 0;
+               /* strip anything to the left of a @ */
+               while ((strlen(node) > 0) && (haschar(node, '@') > 0))
+                       strcpy(node, &node[1]);
+       
+               /* strip anything to the left of a % */
+               while ((strlen(node) > 0) && (haschar(node, '%') > 0))
+                       strcpy(node, &node[1]);
+       
+               /* reduce multiple system bang paths to node!user */
+               while ((strlen(node) > 0) && (haschar(node, '!') > 1))
+                       strcpy(node, &node[1]);
+       
+               /* now get rid of the user portion of a node!user string */
+               for (a = 0; a < strlen(node); ++a)
+                       if (node[a] == '!')
+                               node[a] = 0;
+       }
 
        /* strip leading and trailing spaces in all strings */
        striplt(user);
@@ -300,9 +313,16 @@ int convert_internet_address(char *destuser, char *desthost, char *source)
        int hostalias;
        struct trynamebuf tnb;
        char buf[256];
+       int passes = 0;
+       char sourcealias[1024];
+
+       safestrncpy(sourcealias, source, sizeof(sourcealias) );
 
+REALIAS:
        /* Split it up */
-       process_rfc822_addr(source, user, node, name);
+       process_rfc822_addr(sourcealias, user, node, name);
+       lprintf(9, "process_rfc822_addr() converted to <%s@%s> (%s)\n",
+               user, node, name);
 
        /* Map the FQDN to a Citadel node name
         */
@@ -321,6 +341,16 @@ int convert_internet_address(char *destuser, char *desthost, char *source)
         * FIXME ... do the multiple-addresses thing
         */
        if (!strcasecmp(node, config.c_nodename)) {
+
+
+               /* First, see if we hit an alias.  Don't do this more than
+                * a few times, in case we accidentally hit an alias loop
+                */
+               strcpy(sourcealias, user);
+               alias(user);
+               if ( (strcasecmp(user, sourcealias)) && (++passes < 3) )
+                       goto REALIAS;
+
                /* Try all local rooms */
                if (!strncasecmp(user, "room_", 5)) {
                        strcpy(name, &user[5]);
index 46cb86329fc718ddca30fddb66b431bec9219fd0..0928762f4b05477788658495b406d74526a0676e 100644 (file)
@@ -1,3 +1,4 @@
 bbs,room_aide
 root,room_aide
 Auto,room_aide
+postmaster,room_aide
index 9a2b03179a9f452028c998c1f9b90b487a8b25be..d767860208e0c78ae7fe62547bd429a671a63b81 100644 (file)
@@ -373,7 +373,6 @@ void smtp_rcpt(char *argbuf) {
        cvt = convert_internet_address(user, node, recp);
        sprintf(recp, "%s@%s", user, node);
 
-
        switch(cvt) {
                case rfc822_address_locally_validated:
                        cprintf("250 %s is a valid recipient.\r\n", user);
index 7b749753a1766ce57762eca91ebe12d05b89a647..9f9d6626f5a3bf7099191701b20922a47a505117 100644 (file)
@@ -86,8 +86,8 @@
  * These define what port to listen on for various services.
  * FIXME ... put this in a programmable config somewhere
  */
-#define POP3_PORT              110
-#define SMTP_PORT              25
+#define POP3_PORT              1110
+#define SMTP_PORT              2525
 
 /*
  * SMTP delivery retry and give-up times