+Sun Aug 23 21:47:00 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+ * sysoputil is finally dead! Removed it from the build.
+ * Added userpurge.c server extension (initial implementation)
+
Tue Aug 18 00:42:33 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
* Makefile.in: `clean' target no longer rm's sysdep.h; new target
`realclean' removes everything clean does, plus sysdep.h, plus
CLIENT_TARGETS=citadel whobbs
SERVER_TARGETS=citserver setup citadelapi.a
UTIL_TARGETS=aidepost netmailer netproc netsetup msgform \
- readlog rcit stats sysoputil citmail netpoll mailinglist userlist
+ readlog rcit stats citmail netpoll mailinglist userlist
client: $(CLIENT_TARGETS)
ipc_c_tcp.o: ipc_c_tcp.c sysdep.h
$(CC) $(CFLAGS) -c ipc_c_tcp.c
-ipc_c_socks4.o: ipc_c_socks4.c sysdep.h
- $(CC) $(CFLAGS) -c ipc_c_socks4.c
-
citadel.o: citadel.c axdefs.h citadel.h
$(CC) -O $(CFLAGS) -c citadel.c
stats: stats.c config.o citadel.h
$(CC) -O $(CFLAGS) stats.c config.o $(LFLAGS) -o stats
-sysoputil: sysoputil.c config.o citadel.h
- $(CC) -O $(CFLAGS) sysoputil.c config.o $(LFLAGS) -o sysoputil
- chmod 4750 sysoputil
-
citadel.h: sysdep.h sysconfig.h ipcdef.h server.h
touch citadel.h
# messages. If you want the external editor to be used by default, be sure
# to reflect this in the command set below.
#
-# editor=joe
+editor=/usr/local/bin/simped
# If you define PRINTCMD, it will be a pipe through which messages are
# printed when the user hits the <P>rint key after a message.
cmd=37,0,&.,&Enter,&Configuration
cmd=38,0,&.,&Enter,a new &Room
cmd=39,0,&.,&Enter,&Textfile
-cmd=75,0,&.,&Enter,r&Oomname
-cmd=76,0,&.,&Enter,&Hostname
cmd=77,0,&.,&Enter,&Username
cmd=40,0,&.,&Enter,file using &Xmodem
cmd=42,0,&.,&Enter,file using &Ymodem
cmd=79,0,&.,&Wholist,&Long
+cmd=75,0,&.,&Wholist,&Roomname
+cmd=76,0,&.,&Wholist,&Hostname
#
# Command 69 allows the user to enter a server command directly. It is
-# intended for testing/debugging.
+# primarily for testing and not intended for general use. Usually there
+# is no need to enable it.
cmd=69,0,&@Server command:
-
#
# end of command set configuration
#
--- /dev/null
+/*
+ * userpurge.c
+ *
+ * This program is a server extension which purges the user file of any user
+ * who has not logged in for a period of time, or who has elected to delete
+ * their account by setting their password to "deleteme".
+ */
+
+/* PURGE_TIME is the amount of time (in seconds) for which a user must not
+ * have logged in for his/her account to be purged.
+ */
+#define PURGE_TIME (5184000L) /* two months */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <time.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include "citadel.h"
+
+void do_purge(char *who) {
+ int purge;
+ time_t call, now;
+ int calls;
+ char password[64];
+ unsigned int flags;
+
+ /* The default rule is to not purge. */
+ purge = 0;
+
+ /* If the user hasn't called in two months, his/her account
+ * has expired, so purge the record.
+ */
+ call = CtdlGetUserLastCall(who);
+ now = time(NULL);
+ if ((now - call) > PURGE_TIME) purge = 1;
+
+ /* If the user set his/her password to 'deleteme', he/she
+ * wishes to be deleted, so purge the record.
+ */
+ CtdlGetUserPassword(password, who);
+ if (!strcasecmp(password, "deleteme")) purge = 1;
+
+ /* If the record is marked as permanent, don't purge it.
+ */
+ flags = CtdlGetUserFlags(who);
+ if (flags & US_PERM) purge = 0;
+
+ /* If the access level is 0, the record should already have been
+ * deleted, but maybe the user was logged in at the time or something.
+ * Delete the record now.
+ */
+ if (CtdlGetUserAccessLevel(who) == 0) purge = 1;
+
+ /* 0 calls is impossible. If there are 0 calls, it must
+ * be a corrupted record, so purge it.
+ */
+ calls = CtdlGetUserTimesCalled(who);
+ if (calls == 0) purge = 1;
+
+ if (purge == 1) {
+ CtdlSendExpressMessage("IGnatius T Foobar", "who");
+ }
+
+
+ }
+
+
+void CtdlMain() {
+ CtdlForEachUser(do_purge);
+ }