$Log$
+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
+* Started writing a message reference count verifier ('fsck' for message base)
+
Revision 1.469 2000/02/25 06:14:05 ajc
* Modularized the RWHO (Read WHO is online) command, basically as a pilot
for modularizing all "non-API" functionality.
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
-
long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */
char *rec, /* Recipient (mail) */
char *force, /* force a particular room? */
- int mailtype, /* local or remote type */
+ int supplied_mailtype, /* local or remote type */
int generate_id) /* 1 = generate 'I' field */
{
char aaa[100];
static int seqnum = 1;
struct CtdlMessage *imsg;
char *instr;
+ int mailtype;
lprintf(9, "CtdlSaveMsg() called\n");
if (is_valid_message(msg) == 0) return(-1); /* self check */
+ mailtype = supplied_mailtype;
/* If this message has no timestamp, we take the liberty of
* giving it one, right now.
== hostalias_localhost) {
recipient[a] = 0;
lprintf(7, "Changed to <%s>\n", recipient);
+ mailtype = MES_LOCAL;
}
}
}
* is no local sender; it would otherwise go to the Trashcan).
*/
if ((!CC->internal_pgm) || (strlen(recipient) == 0)) {
- CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0);
+ if (CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0) != 0) {
+ lprintf(3, "ERROR saving message pointer!\n");
+ CtdlSaveMsgPointerInRoom(AIDEROOM, newmsgid, 0);
+ }
}
/* For internet mail, drop a copy in the outbound queue room */
MailboxName(actual_rm, &userbuf, MAILROOM);
CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 0);
}
+ else {
+ lprintf(9, "No user <%s>, saving in %s> instead\n",
+ recipient, AIDEROOM);
+ CtdlSaveMsgPointerInRoom(AIDEROOM, newmsgid, 0);
+ }
}
/* Perform "after save" hooks */
internet
uum %s
humannode Internet Gateway
-lastcontact 951189557 Mon Feb 21 22:19:17 2000
+lastcontact 951540103 Fri Feb 25 23:41:43 2000
uncnsrd
bin Mail
test
bin Mail
+tux
+bin Mail
+phonenum US 800 555 1212
+humannode My System
+lastcontact 951540103 Fri Feb 25 23:41:43 2000
+
*/
int lgetroom(struct quickroom *qrbuf, char *room_name)
{
- begin_critical_section(S_QUICKROOM);
- return (getroom(qrbuf, room_name));
+ register int retval;
+ retval = getroom(qrbuf, room_name);
+ if (retval == 0) begin_critical_section(S_QUICKROOM);
+ return(retval);
}
}
}
+/*****************************************************************************/
+/*
+ * Check message reference counts (FIXME ... not yet finished)
+void cmd_fsck(char *argbuf) {
+ long msgnum;
+ struct cdbdata *cdbmsg;
+ struct SuppMsgInfo smi;
+
+ cprintf("%d This is not done yet.\n", LISTING_FOLLOWS);
+
+ get_control();
+ for (msgnum = 0L; msgnum <= CitControl.MMhighest; ++msgnum) {
+
+ cdbmsg = cdb_fetch(CDB_MSGMAIN, &msgnum, sizeof(long));
+ if (cdbmsg != NULL) {
+ cdb_free(cdbmsg);
+ cprintf("Message %7ld ", msgnum);
+
+ GetSuppMsgInfo(&smi, msgnum);
+ cprintf("refcount=%-2d \n", smi.smi_refcount);
+ }
+
+ }
+
+ cprintf("000\n");
+
+}
+ */
+
+
+
+
+/*****************************************************************************/
+
char *Dynamic_Module_Init(void)
{
CtdlRegisterProtoHook(cmd_expi, "EXPI", "Expire old system objects");
+/* CtdlRegisterProtoHook(cmd_fsck, "FSCK", "Check message ref counts"); */
return "$Id$";
}
#include "citserver.h"
#include "support.h"
#include "config.h"
+#include "control.h"
#include "dynloader.h"
#include "room_ops.h"
#include "user_ops.h"
time_t submitted = 0L;
struct CtdlMessage *bmsg = NULL;
int give_up = 0;
+ int mes_type = 0;
lprintf(9, "smtp_do_bounce() called\n");
strcpy(bounceto, "");
bmsg->cm_anon_type = MES_NORMAL;
bmsg->cm_format_type = 1;
bmsg->cm_fields['A'] = strdoop("Citadel");
+ bmsg->cm_fields['O'] = strdoop(MAILROOM);
bmsg->cm_fields['N'] = strdoop(config.c_nodename);
if (give_up) bmsg->cm_fields['M'] = strdoop(
-"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 we're giving up on the\n"
-"following deliveries because their mail servers are fux0red and\n"
-"would not accept the message for a very, very long time:\n\n"
+"A message you sent could not be delivered to some or all of its recipients.\n"
+"The following addresses were undeliverable:\n\n"
);
else bmsg->cm_fields['M'] = strdoop(
-"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"
+"A message you sent could not be delivered to some or all of its recipients\n"
+"due to prolonged unavailability of its destination(s).\n"
+"Giving up on the following addresses:\n\n"
);
-
-
/*
* Now go through the instructions checking for stuff.
*/
/* 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);
+ if (strlen(bounceto) == 0) {
+ lprintf(7, "No bounce address specified\n");
+ bounce_msgid = (-1L);
+ }
+ else if (mes_type = alias(bounceto), mes_type == MES_ERROR) {
+ lprintf(7, "Invalid bounce address <%s>\n", bounceto);
+ bounce_msgid = (-1L);
+ }
+ else {
+ bounce_msgid = CtdlSaveMsg(bmsg,
+ bounceto,
+ "", mes_type, 1);
+ }
/* Otherwise, go to the Aide> room */
lprintf(9, "bounce to room?\n");
*/
void begin_critical_section(int which_one)
{
+ /* lprintf(9, "begin_critical_section(%d)\n", which_one); */
pthread_mutex_lock(&Critters[which_one]);
}
*/
void end_critical_section(int which_one)
{
+ /* lprintf(9, "end_critical_section(%d)\n", which_one); */
pthread_mutex_unlock(&Critters[which_one]);
}