From 5aac4c43a3700070bc6c10eafaf027be76acf028 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 26 Feb 2000 18:30:43 +0000 Subject: [PATCH] * 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) --- citadel/ChangeLog | 6 ++++ citadel/citadel.h | 2 +- citadel/internet_addressing.c | 60 ++++++++++++++++++++++++++--------- citadel/network/mail.aliases | 1 + citadel/serv_smtp.c | 1 - citadel/sysconfig.h | 4 +-- 6 files changed, 55 insertions(+), 19 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index b349384b6..e2728305c 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citadel.h b/citadel/citadel.h index b97a75979..b963d47e3 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -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 */ diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index a4f8218f5..e82d63a7c 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -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]); diff --git a/citadel/network/mail.aliases b/citadel/network/mail.aliases index 46cb86329..0928762f4 100644 --- a/citadel/network/mail.aliases +++ b/citadel/network/mail.aliases @@ -1,3 +1,4 @@ bbs,room_aide root,room_aide Auto,room_aide +postmaster,room_aide diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index 9a2b03179..d76786020 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -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); diff --git a/citadel/sysconfig.h b/citadel/sysconfig.h index 7b749753a..9f9d6626f 100644 --- a/citadel/sysconfig.h +++ b/citadel/sysconfig.h @@ -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 -- 2.30.2