* Got bounce messages working (mostly ... testers, please beat this up!)
authorArt Cancro <ajc@citadel.org>
Tue, 22 Feb 2000 04:18:01 +0000 (04:18 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 22 Feb 2000 04:18:01 +0000 (04:18 +0000)
* Changed 'FIX' comments to 'FIXME' (less conflict, plus vim highlights it!)

12 files changed:
citadel/ChangeLog
citadel/citserver.c
citadel/clientsocket.c
citadel/dynloader.c
citadel/internet_addressing.c
citadel/msgbase.c
citadel/network/mail.sysinfo
citadel/room_ops.c
citadel/serv_smtp.c
citadel/serv_vcard.c
citadel/sysconfig.h
citadel/sysdep.c

index d9be4ed01fad062d307ad4de338eded2ce342b03..5a18bdae45a03bdf4f1e1e62c57e1a7f2a2d3297 100644 (file)
@@ -1,4 +1,8 @@
 $Log$
+Revision 1.465  2000/02/22 04:17:56  ajc
+* Got bounce messages working (mostly ... testers, please beat this up!)
+* Changed 'FIX' comments to 'FIXME' (less conflict, plus vim highlights it!)
+
 Revision 1.464  2000/02/18 22:29:18  ajc
 * Coded up the "bounce" functions.  Still a coupla bugs.
 
@@ -1643,3 +1647,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 b10167e5e3b918fa8eca3b9a2bd7ba22157d85e2..5e508ec5672d67739758feb4802fd814b6da02b6 100644 (file)
@@ -70,7 +70,7 @@ void master_cleanup(void) {
        /* Cancel all running sessions */
        lprintf(7, "Cancelling running sessions...\n");
 
-/* FIX do something here
+/* FIXME do something here
        while (ContextList != NULL) {
                }
  */
index 3c5e94caf928db5dd84bb3ce5bbc7a604784f722..c9d40c517aaf56afee3c27b0580a1482c231764c 100644 (file)
@@ -76,8 +76,8 @@ int sock_connect(char *host, char *service, char *protocol)
                return(-1);
        }
 
-/* FIX ... the alarm clock is a problem for multithreaded programs because all
- * threads receive the signal.
+/* FIXME ... the alarm clock is a problem for multithreaded programs because
+ * all threads receive the signal.
        signal(SIGALRM, timeout);
        alarm(30);
  */
index 4d26b594526294387d3a4e628cf30bc67b62797a..be6d6353a1e0fe1c1602fcbff392481884f1518b 100644 (file)
@@ -25,6 +25,7 @@
 #include "sysdep_decls.h"
 #include "msgbase.h"
 #include "tools.h"
+#include "config.h"
 
 #ifndef HAVE_SNPRINTF
 #include <stdarg.h>
@@ -240,9 +241,18 @@ void CtdlRegisterServiceHook(int tcp_port,
        newfcn->tcp_port = tcp_port;
        newfcn->h_greeting_function = h_greeting_function;
        newfcn->h_command_function = h_command_function;
-       newfcn->msock = (-1);
-       ServiceHookTable = newfcn;
-       lprintf(5, "Registered a new service (TCP port %d)\n", tcp_port);
+       newfcn->msock = ig_tcp_server(tcp_port, config.c_maxsessions);
+
+       if (newfcn->msock >= 0) {
+               ServiceHookTable = newfcn;
+               lprintf(5, "Registered a new service (TCP port %d)\n",
+                       tcp_port);
+       }
+       else {
+               lprintf(2, "ERROR: could not bind to TCP port %d.\n",
+                       tcp_port);
+               phree(newfcn);
+       }
 }
 
 
index e1878423986b1efbc8898c41d6719208e9c38d2a..a4f8218f521e471f61f73999befc7f2ab10fcd0a 100644 (file)
@@ -52,6 +52,7 @@ int CtdlHostAlias(char *fqdn) {
        char host[256], type[256];
 
        if (!strcasecmp(fqdn, config.c_fqdn)) return(hostalias_localhost);
+       if (!strcasecmp(fqdn, config.c_nodename)) return(hostalias_localhost);
        if (inetcfg == NULL) return(hostalias_nomatch);
 
        config_lines = num_tokens(inetcfg, '\n');
@@ -82,7 +83,7 @@ int CtdlHostAlias(char *fqdn) {
 /*
  * Return 0 if a given string fuzzy-matches a Citadel user account
  *
- * FIX ... this needs to be updated to handle aliases.
+ * FIXME ... this needs to be updated to handle aliases.
  */
 int fuzzy_match(struct usersupp *us, char *matchstring) {
        int a;
@@ -317,7 +318,7 @@ int convert_internet_address(char *destuser, char *desthost, char *source)
        }
 
        /* Now try to resolve the name
-        * FIX ... do the multiple-addresses thing
+        * FIXME ... do the multiple-addresses thing
         */
        if (!strcasecmp(node, config.c_nodename)) {
                /* Try all local rooms */
index 9dde1f53549da3d3844011ac017237296eec50a6..b4ed04e1f26fad003dfeb477b0cbb07de4d17d53 100644 (file)
@@ -29,6 +29,7 @@
 #include "mime_parser.h"
 #include "html.h"
 #include "genstamp.h"
+#include "internet_addressing.h"
 
 #define desired_section ((char *)CtdlGetUserData(SYM_DESIRED_SECTION))
 #define ma ((struct ma_info *)CtdlGetUserData(SYM_MA_INFO))
@@ -129,6 +130,16 @@ int alias(char *name)
        fclose(fp);
        lprintf(7, "Mail is being forwarded to %s\n", name);
 
+       /* Change "user @ xxx" to "user" if xxx is an alias for this host */
+       for (a=0; a<strlen(name); ++a) {
+               if (name[a] == '@') {
+                       if (CtdlHostAlias(&name[a+1]) == hostalias_localhost) {
+                               name[a] = 0;
+                               lprintf(7, "Changed to <%s>\n", name);
+                       }
+               }
+       }
+
        /* determine local or remote type, see citadel.h */
        for (a = 0; a < strlen(name); ++a)
                if (name[a] == '!')
@@ -155,7 +166,7 @@ int alias(char *name)
                fp = fopen("network/mail.sysinfo", "r");
                if (fp == NULL)
                        return (MES_ERROR);
-             GETSN:do {
+GETSN:         do {
                        a = getstring(fp, aaa);
                } while ((a >= 0) && (strcasecmp(aaa, bbb)));
                a = getstring(fp, aaa);
@@ -675,12 +686,10 @@ void CtdlFreeMessage(struct CtdlMessage *msg)
 
        for (i = 0; i < 256; ++i)
                if (msg->cm_fields[i] != NULL) {
-                       lprintf(9, "phreeing %c\n", i);
                        phree(msg->cm_fields[i]);
                }
 
        msg->cm_magic = 0;      /* just in case */
-       lprintf(9, "phreeing msg\n");
        phree(msg);
 }
 
@@ -783,7 +792,7 @@ int CtdlOutputMsg(long msg_num,             /* message number (local) to fetch */
                return(om_not_logged_in);
        }
 
-       /* FIX ... small security issue
+       /* FIXME ... small security issue
         * We need to check to make sure the requested message is actually
         * in the current room, and set msg_ok to 1 only if it is.  This
         * functionality is currently missing because I'm in a hurry to replace
@@ -979,7 +988,7 @@ int CtdlOutputMsg(long msg_num,             /* message number (local) to fetch */
                        return(om_ok);
                }
                else if (mode == MT_RFC822) {   /* unparsed RFC822 dump */
-                       /* FIX ... we have to put some code in here to avoid
+                       /* FIXME ... we have to put some code in here to avoid
                         * printing duplicate header information when both
                         * Citadel and RFC822 headers exist.  Preference should
                         * probably be given to the RFC822 headers.
@@ -1134,7 +1143,7 @@ void cmd_msg3(char *cmdbuf)
 
 
 /* 
- * display a message (mode 4 - MIME) (FIX ... still evolving, not complete)
+ * display a message (mode 4 - MIME) (FIXME ... still evolving, not complete)
  */
 void cmd_msg4(char *cmdbuf)
 {
@@ -1517,11 +1526,25 @@ long CtdlSaveMsg(struct CtdlMessage *msg,       /* message to save */
        strcpy(force_room, force);
 
        /* Strip non-printable characters out of the recipient name */
+       lprintf(9, "Checking recipient (if present)\n");
        strcpy(recipient, rec);
        for (a = 0; a < strlen(recipient); ++a)
                if (!isprint(recipient[a]))
                        strcpy(&recipient[a], &recipient[a + 1]);
 
+       /* Change "user @ xxx" to "user" if xxx is an alias for this host */
+       for (a=0; a<strlen(recipient); ++a) {
+               if (recipient[a] == '@') {
+                       if (CtdlHostAlias(&recipient[a+1]) 
+                          == hostalias_localhost) {
+                               recipient[a] = 0;
+                               lprintf(7, "Changed to <%s>\n", recipient);
+                       }
+               }
+       }
+
+       lprintf(9, "Recipient is <%s>\n", recipient);
+
        /* Learn about what's inside, because it's what's inside that counts */
        lprintf(9, "Learning what's inside\n");
        if (msg->cm_fields['M'] == NULL) {
index c5c556f2148eca1982b056e7b53bfd93c651d6e0..ae363a4f64dc049f810008dc61822f37f30845d6 100644 (file)
@@ -1,14 +1,14 @@
-test
-bin Mail
+internet
+uum %s
+humannode Internet Gateway
+lastcontact 951189557 Mon Feb 21 22:19:17 2000
 
 uncnsrd
 bin Mail
 phonenum US 914 244 3252
 humannode Uncensored
-lastcontact 944890658 Sat Dec 11 00:37:38 1999
+lastcontact 951189558 Mon Feb 21 22:19:18 2000
 
-internet
-uum %s
-humannode Internet Gateway
-lastcontact 944890658 Sat Dec 11 00:37:38 1999
+test
+bin Mail
 
index 7883268f5fbb65a39ab1245f6c392b62b48c5a93..61315accccfb821dcfc31da5afd06d87904c997c 100644 (file)
@@ -314,7 +314,7 @@ void ForEachRoom(void (*CallBack) (struct quickroom *EachRoom, void *out_data),
 
 /*
  * delete_msglist()  -  delete room message pointers
- * FIX - this really should check first to make sure there's actually a
+ * FIXME - this really should check first to make sure there's actually a
  *       msglist to delete.  As things stand now, calling this function on
  *       a room which has never been posted in will result in a message
  *       like "gdbm: illegal data" (no big deal, but could use fixing).
index f4b601491d4f96ec111886023971cd01fc23ea22..4ff49901a7567f106f292e642287710df46bc686 100644 (file)
@@ -353,7 +353,7 @@ void smtp_rcpt(char *argbuf) {
        char user[256];
        char node[256];
        char recp[256];
-       int is_spam = 0;        /* FIX implement anti-spamming */
+       int is_spam = 0;        /* FIXME implement anti-spamming */
 
        if (strlen(SMTP->from) == 0) {
                cprintf("503 MAIL first, then RCPT.  Duh.\r\n");
@@ -991,10 +991,11 @@ void smtp_do_bounce(char *instr) {
         bmsg->cm_fields['A'] = strdoop("Citadel");
         bmsg->cm_fields['N'] = strdoop(config.c_nodename);
         bmsg->cm_fields['M'] = strdoop(
-               "BOUNCE!  BOUNCE!!  BOUNCE!!!\n\n"
-               "FIX ... this message should be made to look nice and stuff.\n"
-               "In the meantime, you should be aware that the following\n"
-               "recipient addresses had permanent fatal errors:\n\n");
+
+"BOUNCE!  BOUNCE!!  BOUNCE!!!\n\n"
+"FIXME ... this message should be made to look nice and stuff.\n"
+"In the meantime, you should be aware that the following\n"
+"recipient addresses had permanent fatal errors:\n\n");
 
        lines = num_tokens(instr, '\n');
        for (i=0; i<lines; ++i) {
@@ -1024,14 +1025,17 @@ void smtp_do_bounce(char *instr) {
                if (bounce_this) {
                        ++num_bounces;
 
-                       /*  FIX put this back in!
+                       if (bmsg->cm_fields['M'] == NULL) {
+                               lprintf(2, "ERROR ... M field is null "
+                                       "(%s:%d)\n", __FILE__, __LINE__);
+                       }
+
                        bmsg->cm_fields['M'] = reallok(bmsg->cm_fields['M'],
-                               strlen(bmsg->cm_fields['M'] + 1024) );
+                               strlen(bmsg->cm_fields['M']) + 1024 );
                        strcat(bmsg->cm_fields['M'], addr);
                        strcat(bmsg->cm_fields['M'], ": ");
                        strcat(bmsg->cm_fields['M'], dsn);
                        strcat(bmsg->cm_fields['M'], "\n");
-                       */
 
                        remove_token(instr, i, '\n');
                        --i;
@@ -1043,13 +1047,12 @@ void smtp_do_bounce(char *instr) {
        lprintf(9, "num_bounces = %d\n", num_bounces);
        if (num_bounces > 0) {
 
-               /* First try the user who sent the message   FIX
+               /* First try the user who sent the message */
                lprintf(9, "bounce to user? <%s>\n", bounceto);
                if (strlen(bounceto) == 0) bounce_msgid = (-1L);
                else bounce_msgid = CtdlSaveMsg(bmsg,
                        bounceto,
                        "", MES_LOCAL, 1);
-               */
 
                /* Otherwise, go to the Aide> room */
                lprintf(9, "bounce to room?\n");
@@ -1285,4 +1288,3 @@ char *Dynamic_Module_Init(void)
        CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);
        return "$Id$";
 }
-
index 287140a140ada7f713e057e7536ae9dde295ec21..5ecffedf0a6f28013d06a5bf393cdde5387953b1 100644 (file)
@@ -86,7 +86,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg) {
                         * want to make sure there is absolutely only one
                         * vCard in the user's config room at all times.
                         * 
-                        * FIX ... this needs to be tweaked to allow an admin
+                        * FIXME ... this needs to be tweaked to allow an admin
                         * to make changes to another user's vCard instead of
                         * assuming that it's always the user saving his own.
                         */
index 3ce4597f87e514ffb5fca948d6931d33a2f09ebd..198f7e557144b00ffd2536dd8a8d17742de1fcee 100644 (file)
@@ -83,8 +83,8 @@
  * These define what port to listen on for various services.
  * FIX ... put this in a programmable config somewhere
  */
-#define POP3_PORT              1110
-#define SMTP_PORT              2525
+#define POP3_PORT              110
+#define SMTP_PORT              25
 
 
 /*
index 10852678b65e194c46d73a43cbcd1eeb6c6a5e9c..904528aa7149042995bb4c2a708aa44336a5067c 100644 (file)
@@ -499,7 +499,7 @@ int client_gets(char *buf)
  * The system-dependent part of master_cleanup() - close the master socket.
  */
 void sysdep_master_cleanup(void) {
-       /* FIX close all protocol master sockets here */
+       /* FIXME close all protocol master sockets here */
 }
 
 
@@ -856,19 +856,9 @@ int main(int argc, char **argv)
 
        for (serviceptr = ServiceHookTable; serviceptr != NULL;
            serviceptr = serviceptr->next ) {
-               serviceptr->msock = ig_tcp_server(
-                       serviceptr->tcp_port, config.c_maxsessions);
-               if (serviceptr->msock >= 0) {
-                       FD_SET(serviceptr->msock, &masterfds);
-                       if (serviceptr->msock > masterhighest)
-                               masterhighest = serviceptr->msock;
-                       lprintf(7, "Bound to port %-5d (socket %d)\n",
-                               serviceptr->tcp_port,
-                               serviceptr->msock);
-               }
-               else {
-                       lprintf(1, "Unable to bind to port %d\n",
-                               serviceptr->tcp_port);
+               FD_SET(serviceptr->msock, &masterfds);
+               if (serviceptr->msock > masterhighest) {
+                       masterhighest = serviceptr->msock;
                }
        }