* sysoputil is finally dead! Removed it from the build.
authorArt Cancro <ajc@citadel.org>
Mon, 24 Aug 1998 01:48:31 +0000 (01:48 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 24 Aug 1998 01:48:31 +0000 (01:48 +0000)
        * Added userpurge.c server extension (initial implementation)

citadel/ChangeLog
citadel/Makefile.in
citadel/citadel.rc
citadel/userpurge.c [new file with mode: 0644]

index 9059c1c3e9c6ff78038f6520f2f7c367c480a27b..6c0e2614f84d74e47f7d86b0a58f012eef1f3a04 100644 (file)
@@ -1,3 +1,7 @@
+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
index 3649423bc3987716001d98e9998584d540a9fb56..84a476ea6144424caa8d553ec457c25f37d54b3c 100644 (file)
@@ -13,7 +13,7 @@
 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)
 
@@ -35,9 +35,6 @@ netpoll: netpoll.c config.o ipc_c_tcp.o
 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
 
@@ -190,10 +187,6 @@ rcit: rcit.c config.o citadel.h
 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
 
index 60ea454ed7e43a9b5313f06acc81d21b25abeef6..ab74471b0e9efa01c03eedf436e971ee3e0067a1 100644 (file)
@@ -12,7 +12,7 @@
 # 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.
@@ -172,8 +172,6 @@ cmd=36,0,&.,&Enter,&ASCII 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
@@ -204,12 +202,14 @@ cmd=67,0,&.,&Read,&Bio
 
 
 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
 #
diff --git a/citadel/userpurge.c b/citadel/userpurge.c
new file mode 100644 (file)
index 0000000..ed57fa1
--- /dev/null
@@ -0,0 +1,73 @@
+/*
+ * 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);
+       }