From 7e06cf0ca1c9821277a625fe63f77e4a286c6759 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 22 Feb 2000 04:18:01 +0000 Subject: [PATCH] * Got bounce messages working (mostly ... testers, please beat this up!) * Changed 'FIX' comments to 'FIXME' (less conflict, plus vim highlights it!) --- citadel/ChangeLog | 5 +++++ citadel/citserver.c | 2 +- citadel/clientsocket.c | 4 ++-- citadel/dynloader.c | 16 +++++++++++++--- citadel/internet_addressing.c | 5 +++-- citadel/msgbase.c | 35 +++++++++++++++++++++++++++++------ citadel/network/mail.sysinfo | 14 +++++++------- citadel/room_ops.c | 2 +- citadel/serv_smtp.c | 24 +++++++++++++----------- citadel/serv_vcard.c | 2 +- citadel/sysconfig.h | 4 ++-- citadel/sysdep.c | 18 ++++-------------- 12 files changed, 81 insertions(+), 50 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index d9be4ed01..5a18bdae4 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -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 Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/citserver.c b/citadel/citserver.c index b10167e5e..5e508ec56 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -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) { } */ diff --git a/citadel/clientsocket.c b/citadel/clientsocket.c index 3c5e94caf..c9d40c517 100644 --- a/citadel/clientsocket.c +++ b/citadel/clientsocket.c @@ -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); */ diff --git a/citadel/dynloader.c b/citadel/dynloader.c index 4d26b5945..be6d6353a 100644 --- a/citadel/dynloader.c +++ b/citadel/dynloader.c @@ -25,6 +25,7 @@ #include "sysdep_decls.h" #include "msgbase.h" #include "tools.h" +#include "config.h" #ifndef HAVE_SNPRINTF #include @@ -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); + } } diff --git a/citadel/internet_addressing.c b/citadel/internet_addressing.c index e18784239..a4f8218f5 100644 --- a/citadel/internet_addressing.c +++ b/citadel/internet_addressing.c @@ -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 */ diff --git a/citadel/msgbase.c b/citadel/msgbase.c index 9dde1f535..b4ed04e1f 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -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\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\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) { diff --git a/citadel/network/mail.sysinfo b/citadel/network/mail.sysinfo index c5c556f21..ae363a4f6 100644 --- a/citadel/network/mail.sysinfo +++ b/citadel/network/mail.sysinfo @@ -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 diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 7883268f5..61315accc 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -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). diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index f4b601491..4ff49901a 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -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; icm_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$"; } - diff --git a/citadel/serv_vcard.c b/citadel/serv_vcard.c index 287140a14..5ecffedf0 100644 --- a/citadel/serv_vcard.c +++ b/citadel/serv_vcard.c @@ -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. */ diff --git a/citadel/sysconfig.h b/citadel/sysconfig.h index 3ce4597f8..198f7e557 100644 --- a/citadel/sysconfig.h +++ b/citadel/sysconfig.h @@ -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 /* diff --git a/citadel/sysdep.c b/citadel/sysdep.c index 10852678b..904528aa7 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -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; } } -- 2.30.2