$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.
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
+
/* Cancel all running sessions */
lprintf(7, "Cancelling running sessions...\n");
-/* FIX do something here
+/* FIXME do something here
while (ContextList != NULL) {
}
*/
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);
*/
#include "sysdep_decls.h"
#include "msgbase.h"
#include "tools.h"
+#include "config.h"
#ifndef HAVE_SNPRINTF
#include <stdarg.h>
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);
+ }
}
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');
/*
* 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;
}
/* 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 */
#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))
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] == '!')
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);
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);
}
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
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.
/*
- * 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)
{
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) {
-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
/*
* 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).
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");
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) {
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;
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");
CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER);
return "$Id$";
}
-
* 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.
*/
* 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
/*
* 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 */
}
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;
}
}