fix dnamlen, they missed the e, so we need to follow.
[citadel.git] / citadel / netconfig.c
index f09c852fd32a3786ac5cc1f15c35c4e6fcbde087..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
@@ -1172,9 +1176,12 @@ int CtdlIsValidNode(const StrBuf **nexthop,
 void destroy_network_cfgs(void)
 {
        HashList *pCfgTypeHash = CfgTypeHash;
-       HashList *pRoomConfigs = RoomConfigs;
+       HashList *pRoomConfigs;
 
+       begin_critical_section(S_NETCONFIGS);
+       pRoomConfigs = RoomConfigs;
        RoomConfigs = NULL;
+       end_critical_section(S_NETCONFIGS);
        DeleteHash(&pRoomConfigs);
 
        CfgTypeHash = NULL;