* serv_inetcfg: added
authorArt Cancro <ajc@citadel.org>
Wed, 2 Feb 2000 00:03:52 +0000 (00:03 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 2 Feb 2000 00:03:52 +0000 (00:03 +0000)
citadel/Makefile.in
citadel/serv_inetcfg.c [new file with mode: 0644]
citadel/serv_smtp.c
citadel/setup.c

index c526414b238d26a3ff6d0cd4e78eb348ca9773cd..9e7aacf9115bebd47428d09fcfbc7289ee74dd25 100644 (file)
@@ -28,6 +28,7 @@ SERVER_TARGETS=citserver setup $(CHKPWD)
 SERV_MODULES=modules/serv_chat$(SO) modules/serv_vcard$(SO) \
        modules/serv_upgrade$(SO) \
        modules/serv_smtp$(SO) modules/serv_pop3$(SO) \
+       modules/serv_inetcfg$(SO) \
        modules/serv_expire$(SO) $(SERV_ICQ)
 UTIL_TARGETS=aidepost netmailer netproc netsetup msgform readlog rcit \
        stats citmail netpoll mailinglist userlist sendcommand \
@@ -73,7 +74,7 @@ SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.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 serv_pop3.c internet_addressing.c parsedate.c genstamp.c \
-       domain.c clientsocket.c
+       domain.c clientsocket.c serv_inetcfg.c
 
 DEP_FILES=$(SOURCES:.c=.d)
 
@@ -140,6 +141,12 @@ modules/serv_pop3.so: serv_pop3.mo
 modules/serv_pop3.mo: serv_pop3.mo
        ln -f serv_pop3.mo modules
 
+modules/serv_inetcfg.so: serv_inetcfg.mo
+       $(LINK_SHARED) -o modules/serv_inetcfg.so serv_inetcfg.mo
+
+modules/serv_inetcfg.mo: serv_inetcfg.mo
+       ln -f serv_inetcfg.mo modules
+
 modules/serv_expire.so: serv_expire.mo
        $(LINK_SHARED) -o modules/serv_expire.so serv_expire.mo
 
diff --git a/citadel/serv_inetcfg.c b/citadel/serv_inetcfg.c
new file mode 100644 (file)
index 0000000..7d7c54a
--- /dev/null
@@ -0,0 +1,86 @@
+/* $Id$ 
+ *
+ * This module handles the loading/saving and maintenance of the
+ * system's Internet configuration.
+ */
+
+#include "sysdep.h"
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+#include <string.h>
+#include <limits.h>
+#include "citadel.h"
+#include "server.h"
+#include <time.h>
+#include "sysdep_decls.h"
+#include "citserver.h"
+#include "support.h"
+#include "config.h"
+#include "dynloader.h"
+#include "room_ops.h"
+#include "user_ops.h"
+#include "policy.h"
+#include "database.h"
+#include "msgbase.h"
+#include "tools.h"
+#include "internet_addressing.h"
+#include "genstamp.h"
+#include "domain.h"
+
+
+/*
+ * This handler detects changes being made to the system's Internet
+ * configuration.
+ */
+int inetcfg_aftersave(struct CtdlMessage *msg) {
+       char *ptr;
+       int linelen;
+
+       /* If this isn't the configuration room, or if this isn't a MIME
+        * message, don't bother.
+        */
+       if (strcasecmp(msg->cm_fields['O'], SYSCONFIGROOM)) return(0);
+       if (msg->cm_format_type != 4) return(0);
+
+       ptr = msg->cm_fields['M'];
+       while (ptr != NULL) {
+       
+               linelen = strcspn(ptr, "\n");
+               if (linelen == 0) return(0);    /* end of headers */    
+               
+               if ( (!strncasecmp(ptr, "Content-type: ", 14))
+                  && (!strncasecmp(&ptr[14], INTERNETCFG,
+                  strlen(INTERNETCFG) )) ) {
+                       /* Bingo!  The user is changing configs.
+                        */
+                       lprintf(9, "Internet configuration changed FIX\n");
+               }
+
+               ptr = strchr((char *)ptr, '\n');
+               if (ptr != NULL) ++ptr;
+       }
+
+       return(0);
+}
+
+
+
+/*****************************************************************************/
+/*                      MODULE INITIALIZATION STUFF                          */
+/*****************************************************************************/
+
+
+char *Dynamic_Module_Init(void)
+{
+       CtdlRegisterMessageHook(inetcfg_aftersave, EVT_AFTERSAVE);
+       return "$Id$";
+}
+
index 91812f4a6afb02649a76e57ec536e5084abe7c50..287a993bf7ee2708613a3bf318480aa5125da86a 100644 (file)
@@ -67,6 +67,8 @@ long SYM_SMTP_RECP;
 /*****************************************************************************/
 
 
+
+
 /*
  * Here's where our SMTP session begins its happy day.
  */
index 9b3a0c2bd985aed96b71817d048c4b843ffefe0a..1872eaeaf22082aefc1f573af101aa2acb5321bc 100644 (file)
@@ -539,7 +539,6 @@ void set_str_val(int msgpos, char str[])
 {
        char buf[4096];
        char tempfile[64];
-       char setupmsg[256];
 
        sprintf(tempfile, tmpnam(NULL));