$Log$
+Revision 1.430 1999/12/22 04:46:34 ajc
+* Fixed up the "Date:" headers to be RFC822-compliant
+
Revision 1.429 1999/12/13 05:30:57 ajc
* Removed our naive 'conv_date()' RFC822-to-unixtime conversion function
and replaced it with the public domain 'parsedate()' function from UseNet
Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
* Initial CVS import
+
support.c sysdep.c tools.c user_ops.c userlist.c serv_expire.c \
whobbs.c sendcommand.c mime_parser.c base64.c qpdecode.c getutline.c \
auth.c chkpwd.c client_icq.c html.c vcard.c serv_upgrade.c \
- serv_smtp.c internet_addressing.c parsedate.c
+ serv_smtp.c internet_addressing.c parsedate.c genstamp.c
DEP_FILES=$(SOURCES:.c=.d)
SERV_OBJS = citserver.ro user_ops.ro support.ro room_ops.ro file_ops.ro \
msgbase.ro config.ro sysdep.ro locate_host.ro housekeeping.ro \
database.ro control.ro logging.ro policy.ro dynloader.ro tools.ro \
- mime_parser.ro html.ro internet_addressing.ro parsedate.ro \
+ mime_parser.ro html.ro internet_addressing.ro \
+ parsedate.ro genstamp.ro \
$(AUTH) $(LIBOBJS:.o=.ro)
citserver: $(SERV_OBJS)
# mail. If it is not run setuid, all outgoing mail may always show as coming
# from your BBSUID rather than the actual sending user.
#
-netmailer: netmailer.o internetmail.o config.o
- $(CC) netmailer.o config.o internetmail.o $(LDFLAGS) -o netmailer
+netmailer: netmailer.o internetmail.o config.o genstamp.o
+ $(CC) netmailer.o config.o internetmail.o genstamp.o \
+ $(LDFLAGS) -o netmailer
netproc: netproc.o config.o ipc_c_tcp.o tools.o $(LIBOBJS)
$(CC) netproc.o config.o ipc_c_tcp.o tools.o \
--- /dev/null
+/*
+ * Function to generate RFC822-compliant textual time/date stamp
+ *
+ * $Id$
+ *
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <time.h>
+#include "genstamp.h"
+
+
+static char *months[] = {
+ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+};
+
+static char *weekdays[] = {
+ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
+};
+
+
+/*
+ * Supplied with a unix timestamp, generate an RFC822-compliant textual
+ * time and date stamp.
+ */
+void generate_rfc822_datestamp(char *buf, time_t xtime) {
+ struct tm *t;
+
+ t = localtime(&xtime);
+
+ sprintf(buf, "%s, %02d %s %04d %02d:%02d:%02d %s",
+ weekdays[t->tm_wday],
+ t->tm_mday,
+ months[t->tm_mon],
+ t->tm_year + 1900,
+ t->tm_hour,
+ t->tm_min,
+ t->tm_sec,
+ tzname[0]
+ );
+}
+
--- /dev/null
+void generate_rfc822_datestamp(char *buf, time_t xtime);
#include "parsedate.h"
+
/*
* Return 0 if a given string fuzzy-matches a Citadel user account
*
return msg;
}
+
#include <limits.h>
#include <syslog.h>
#include "citadel.h"
+#include "genstamp.h"
void LoadInternetConfig(void);
void get_config(void);
FILE *fp, *rmail;
char sbuf[200], rbuf[200], cstr[100], fstr[128];
char nbuf[64], pbuf[128], rmname[128], buf[128];
- char subject[200];
+ char datestamp[256];
+ char subject[256];
time_t mid_buf;
time_t now;
int mlist = 0;
*/
fprintf(rmail, "To: %s\n", rbuf);
time(&now);
- fprintf(rmail, "Date: %s", asctime(localtime(&now)));
+ generate_rfc822_datestamp(datestamp, now);
+ fprintf(rmail, "Date: %s\n", datestamp);
fprintf(rmail, "Message-Id: <%ld@%s>\n", (long) mid_buf, nbuf);
fprintf(rmail, "X-Mailer: %s\n", CITADEL);
fprintf(rmail, "Subject: %s\n", subject);