]> code.citadel.org Git - citadel.git/blobdiff - citadel/netconfig.c
RNCFG: add forward declaration missing in last commit.
[citadel.git] / citadel / netconfig.c
index 52adbbddff79cdb60730b3893a4c740a42399562..7fc53c594c8df304a055847f938e6de65c723f8b 100644 (file)
@@ -32,6 +32,7 @@
 
 
 void vFreeRoomNetworkStruct(void *vOneRoomNetCfg);
+void FreeRoomNetworkStructContent(OneRoomNetCfg *OneRNCfg);
 
 HashList *CfgTypeHash = NULL;
 HashList *RoomConfigs = NULL;
@@ -165,7 +166,7 @@ int ReadRoomNetConfigFile(OneRoomNetCfg **pOneRNCfg, char *filename)
        const CfgLineType *pCfg;
        StrBuf *Line;
        StrBuf *InStr;
-       OneRoomNetCfg *OneRNCfg;
+       OneRoomNetCfg *OneRNCfg = NULL;
 
        fd = open(filename, O_NONBLOCK|O_RDONLY);
        if (fd == -1) {
@@ -173,7 +174,10 @@ int ReadRoomNetConfigFile(OneRoomNetCfg **pOneRNCfg, char *filename)
                return 0;
        }
        if (*pOneRNCfg != NULL)
+       {
                OneRNCfg = *pOneRNCfg;
+               FreeRoomNetworkStructContent (OneRNCfg);
+       }
        else
                OneRNCfg = malloc(sizeof(OneRoomNetCfg));
        memset(OneRNCfg, 0, sizeof(OneRoomNetCfg));
@@ -843,7 +847,6 @@ int CtdlNetconfigCheckRoomaccess(
        const char* RemoteIdentifier)
 {
        OneRoomNetCfg *RNCfg;
-       char filename[SIZ];
        int found;
 
        if (RemoteIdentifier == NULL)
@@ -852,18 +855,18 @@ int CtdlNetconfigCheckRoomaccess(
                return (ERROR + USERNAME_REQUIRED);
        }
 
-       assoc_file_name(filename, sizeof filename, &CC->room, ctdl_netcfg_dir);
        begin_critical_section(S_NETCONFIGS);
-       if (!ReadRoomNetConfigFile(&RNCfg, filename))
+       RNCfg = CtdlGetNetCfgForRoom (CC->room.QRnumber);
+       if (RNCfg == NULL)
        {
                end_critical_section(S_NETCONFIGS);
                snprintf(errmsgbuf, n,
                         "This mailing list only accepts posts from subscribers.");
                return (ERROR + NO_SUCH_USER);
        }
-       end_critical_section(S_NETCONFIGS);
        found = is_recipient (RNCfg, RemoteIdentifier);
-       vFreeRoomNetworkStruct(&RNCfg);
+       end_critical_section(S_NETCONFIGS);
+
        if (found) {
                return (0);
        }