Removed race condition from CheckIfAlreadySeen()
[citadel.git] / citadel / netconfig.c
index 94b638bcb267179dc4bc527250bc31f7118c343a..239796981111497f49a17efc57b359b698a6585e 100644 (file)
@@ -301,20 +301,21 @@ void SaveRoomNetConfigFile(OneRoomNetCfg *OneRNCfg, long roomnum)
        {
                const CfgLineType *pCfg;
                pCfg = GetCfgTypeByEnum(eCfg, CfgIt);
-               if (pCfg->IsSingleLine)
+               if (pCfg)
                {
-                       pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, NULL);
-               }
-               else
-               {
-                       RoomNetCfgLine *pName = OneRNCfg->NetConfigs[pCfg->C];
-                       while (pName != NULL)
+                       if (pCfg->IsSingleLine)
                        {
-                               pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, pName);
-                               pName = pName->next;
+                               pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, NULL);
+                       }
+                       else
+                       {
+                               RoomNetCfgLine *pName = OneRNCfg->NetConfigs[pCfg->C];
+                               while (pName != NULL)
+                               {
+                                       pCfg->Serializer(pCfg, OutBuffer, OneRNCfg, pName);
+                                       pName = pName->next;
+                               }
                        }
-                       
-                       
                }
 
        }
@@ -632,8 +633,6 @@ void cmd_netp(char *cmdbuf)
        StrBuf *NodeStr;
        long nodelen;
        int v;
-       long lens[2];
-       const char *strs[2];
 
        const StrBuf *secret = NULL;
        const StrBuf *nexthop = NULL;
@@ -653,20 +652,7 @@ void cmd_netp(char *cmdbuf)
                );
                syslog(LOG_WARNING, "%s", err_buf);
                cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
-
-               strs[0] = CCC->cs_addr;
-               lens[0] = strlen(CCC->cs_addr);
-               
-               strs[1] = "SRV_UNKNOWN";
-               lens[1] = sizeof("SRV_UNKNOWN") - 1;
-
-               CtdlAideFPMessage(
-                       err_buf,
-                       "IGNet Networking.",
-                       2, strs, (long*) &lens,
-                       CCC->cs_pid, 0,
-                       time(NULL));
-
+               CtdlAideMessage(err_buf, "IGNet Networking");
                DeleteHash(&working_ignetcfg);
                FreeStrBuf(&NodeStr);
                return;
@@ -681,20 +667,7 @@ void cmd_netp(char *cmdbuf)
                syslog(LOG_WARNING, "%s", err_buf);
                cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
 
-               strs[0] = CCC->cs_addr;
-               lens[0] = strlen(CCC->cs_addr);
-               
-               strs[1] = "SRV_PW";
-               lens[1] = sizeof("SRV_PW") - 1;
-
-               CtdlAideFPMessage(
-                       err_buf,
-                       "IGNet Networking.",
-                       2, strs,
-                       (long*) &lens,
-                       CCC->cs_pid, 0,
-                       time(NULL));
-
+               CtdlAideMessage(err_buf, "IGNet Networking");
                DeleteHash(&working_ignetcfg);
                FreeStrBuf(&NodeStr);
                return;