continuing war on unnecessary include of sys/time.h
[citadel.git] / citadel / netconfig.c
index 682d4e05acb301b59eb54a3293862e508743cb38..d2a39c6c63e11cd1b2e1d02af343c4b631b6e9b1 100644 (file)
@@ -30,6 +30,7 @@
 
 #include "include/ctdl_module.h"
 #include "serv_extensions.h"
+#include "config.h"
 
 void vFreeRoomNetworkStruct(void *vOneRoomNetCfg);
 void FreeRoomNetworkStructContent(OneRoomNetCfg *OneRNCfg);
@@ -176,6 +177,9 @@ int ReadRoomNetConfigFile(OneRoomNetCfg **pOneRNCfg, char *filename)
                *pOneRNCfg = NULL;
                return 0;
        }
+       fchown(fd, CTDLUID, (-1));
+       fchmod(fd, 0600);
+
        if (*pOneRNCfg != NULL)
        {
                OneRNCfg = *pOneRNCfg;
@@ -439,7 +443,7 @@ void LoadAllNetConfigs(void)
               (filedir_entry != NULL))
        {
 #ifdef _DIRENT_HAVE_D_NAMLEN
-               d_namelen = filedir_entry->d_namelen;
+               d_namelen = filedir_entry->d_namlen;
 #else
                d_namelen = strlen(filedir_entry->d_name);
 #endif
@@ -839,6 +843,7 @@ int is_recipient(OneRoomNetCfg *RNCfg, const char *Name)
                        }
                        nptr = nptr->next;
                }
+               i++;
        }
        return 0;
 }
@@ -927,6 +932,7 @@ void cmd_netp(char *cmdbuf)
                        err_buf,
                        "IGNet Networking.",
                        2, strs, (long*) &lens,
+                       CCC->cs_pid, 0,
                        time(NULL));
 
                DeleteHash(&working_ignetcfg);
@@ -954,6 +960,7 @@ void cmd_netp(char *cmdbuf)
                        "IGNet Networking.",
                        2, strs,
                        (long*) &lens,
+                       CCC->cs_pid, 0,
                        time(NULL));
 
                DeleteHash(&working_ignetcfg);
@@ -1169,13 +1176,16 @@ int CtdlIsValidNode(const StrBuf **nexthop,
 void destroy_network_cfgs(void)
 {
        HashList *pCfgTypeHash = CfgTypeHash;
-       HashList *pRoomConfigs = RoomConfigs;
+       HashList *pRoomConfigs;
 
-       CfgTypeHash = NULL;
+       begin_critical_section(S_NETCONFIGS);
+       pRoomConfigs = RoomConfigs;
        RoomConfigs = NULL;
-       
-       DeleteHash(&pCfgTypeHash);
+       end_critical_section(S_NETCONFIGS);
        DeleteHash(&pRoomConfigs);
+
+       CfgTypeHash = NULL;
+       DeleteHash(&pCfgTypeHash);
 }
 
 /*