* give all commands their own function
[citadel.git] / citadel / control.c
index 305ed3d2332c2f0ee2b1a9b6b459ec452b8731ca..85bef8f3bae92201f367a2f514188e924b2c73e1 100644 (file)
@@ -47,6 +47,8 @@
 #include "snprintf.h"
 #endif
 
+#include "ctdl_module.h"
+
 struct CitControl CitControl;
 extern struct config config;
 FILE *control_fp = NULL;
@@ -164,6 +166,8 @@ void get_control(void)
                if (control_fp != NULL) {
                        lock_control();
                        fchown(fileno(control_fp), config.c_ctdluid, -1);
+                       fchmod(fileno(control_fp), 
+                              S_IRUSR|S_IWUSR);
                }
        }
        if (control_fp == NULL) {
@@ -171,6 +175,8 @@ void get_control(void)
                if (control_fp != NULL) {
                        lock_control();
                        fchown(fileno(control_fp), config.c_ctdluid, -1);
+                       fchmod(fileno(control_fp), 
+                              S_IRUSR|S_IWUSR);
                        memset(&CitControl, 0, sizeof(struct CitControl));
                        fwrite(&CitControl, sizeof(struct CitControl),
                               1, control_fp);
@@ -188,6 +194,7 @@ void get_control(void)
        fread(&CitControl, sizeof(struct CitControl), 1, control_fp);
        already_have_control = 1;
        chown(file_citadel_control, config.c_ctdluid, (-1));
+       
 }
 
 /*
@@ -691,3 +698,16 @@ void cmd_conf(char *argbuf)
                        ERROR + ILLEGAL_VALUE);
        }
 }
+
+
+/*****************************************************************************/
+/*                      MODULE INITIALIZATION STUFF                          */
+/*****************************************************************************/
+
+
+CTDL_MODULE_INIT(control)
+{
+       CtdlRegisterProtoHook(cmd_conf, "CONF", "Autoconverted. TODO: document me.");
+       /* return our Subversion id for the Log */
+       return "$Id$";
+}