Removed some more ignet cruft
authorArt Cancro <ajc@citadel.org>
Fri, 2 Mar 2018 02:40:41 +0000 (21:40 -0500)
committerArt Cancro <ajc@citadel.org>
Fri, 2 Mar 2018 02:40:41 +0000 (21:40 -0500)
citadel/include/ctdl_module.h
citadel/modules/network/serv_netmail.c
citadel/netconfig.c

index 3783a04568879e20c7befbf67f816419ae140511..3b3d794c3531c79945ad8e9f84435ba3ac5d6973 100644 (file)
@@ -357,14 +357,6 @@ typedef struct __NetMap {
 
 HashList* CtdlReadNetworkMap(void);
 StrBuf *CtdlSerializeNetworkMap(HashList *Map);
-void NetworkLearnTopology(char *node, char *path, HashList *the_netmap, int *netmap_changed);
-int CtdlIsValidNode(const StrBuf **nexthop,
-                   const StrBuf **secret,
-                   StrBuf *node,
-                   HashList *IgnetCfg,
-                   HashList *the_netmap);
-
-
 
 
 
index bd761048a1faabc6ce908c4a8cef4845e29d7081..933b051f4445e6acc1b291befecc50fab67edd92 100644 (file)
@@ -382,7 +382,6 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon
 {
        struct CtdlMessage *msg = NULL;
        int ok_to_participate = 0;
-       StrBuf *Buf = NULL;
        recptypes *valid;
 
        /*
@@ -404,16 +403,6 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon
                {
                        ok_to_participate = 1;
                }
-               
-               Buf = NewStrBufPlain(CM_KEY(msg, eNodeName));
-               if (CtdlIsValidNode(NULL,
-                                   NULL,
-                                   Buf,
-                                   sc->working_ignetcfg,
-                                   sc->the_netmap) == 0)
-               {
-                       ok_to_participate = 1;
-               }
        }
        if (ok_to_participate)
        {
@@ -430,7 +419,6 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon
                CtdlSubmitMsg(msg, valid, "", 0);
                free_recipients(valid);
        }
-       FreeStrBuf(&Buf);
        CM_Free(msg);
 }
 
index a21c39f5026800dd726a8ce3e620d13e47c06329..d72381837c504f34cb7d4fe8aede1be0a7e72166 100644 (file)
@@ -716,102 +716,6 @@ StrBuf *CtdlSerializeNetworkMap(HashList *Map)
 }
 
 
-/*
- * Learn topology from path fields
- */
-void NetworkLearnTopology(char *node, char *path, HashList *the_netmap, int *netmap_changed)
-{
-       CtdlNetMap *pNM = NULL;
-       void *vptr;
-       char nexthop[256];
-       CtdlNetMap *nmptr;
-
-       if (GetHash(the_netmap, node, strlen(node), &vptr) && 
-           (vptr != NULL))/* TODO: is the NodeName Uniq? */
-       {
-               pNM = (CtdlNetMap*)vptr;
-               extract_token(nexthop, path, 0, '!', sizeof nexthop);
-               if (!strcmp(nexthop, ChrPtr(pNM->NextHop))) {
-                       pNM->lastcontact = time(NULL);
-                       (*netmap_changed) ++;
-                       return;
-               }
-       }
-
-       /* If we got here then it's not in the map, so add it. */
-       nmptr = (CtdlNetMap *) malloc(sizeof (CtdlNetMap));
-       nmptr->NodeName = NewStrBufPlain(node, -1);
-       nmptr->lastcontact = time(NULL);
-       nmptr->NextHop = NewStrBuf ();
-       StrBufExtract_tokenFromStr(nmptr->NextHop, path, strlen(path), 0, '!');
-       /* TODO: is the NodeName Uniq? */
-       Put(the_netmap, SKEY(nmptr->NodeName), nmptr, DeleteNetMap);
-       (*netmap_changed) ++;
-}
-
-
-/*
- * Check the network map and determine whether the supplied node name is
- * valid.  If it is not a neighbor node, supply the name of a neighbor node
- * which is the next hop.  If it *is* a neighbor node, we also fill in the
- * shared secret.
- */
-int CtdlIsValidNode(const StrBuf **nexthop,
-                   const StrBuf **secret,
-                   StrBuf *node,
-                   HashList *IgnetCfg,
-                   HashList *the_netmap)
-{
-       void *vNetMap;
-       void *vNodeConf;
-       CtdlNodeConf *TheNode;
-       CtdlNetMap *TheNetMap;
-
-       if (StrLength(node) == 0) {
-               return(-1);
-       }
-
-       /*
-        * First try the neighbor nodes
-        */
-       if (GetCount(IgnetCfg) == 0) {
-               syslog(LOG_INFO, "netconfig: IgnetCfg is empty!");
-               if (nexthop != NULL) {
-                       *nexthop = NULL;
-               }
-               return(-1);
-       }
-
-       /* try to find a neigbour with the name 'node' */
-       if (GetHash(IgnetCfg, SKEY(node), &vNodeConf) && 
-           (vNodeConf != NULL))
-       {
-               TheNode = (CtdlNodeConf*)vNodeConf;
-               if (secret != NULL)
-                       *secret = TheNode->Secret;
-               return 0;               /* yup, it's a direct neighbor */
-       }
-
-       /*
-        * If we get to this point we have to see if we know the next hop
-        *//* TODO: is the NodeName Uniq? */
-       if ((GetCount(the_netmap) > 0) &&
-           (GetHash(the_netmap, SKEY(node), &vNetMap)))
-       {
-               TheNetMap = (CtdlNetMap*)vNetMap;
-               if (nexthop != NULL)
-                       *nexthop = TheNetMap->NextHop;
-               return(0);
-       }
-
-       /*
-        * If we get to this point, the supplied node name is bogus.
-        */
-       syslog(LOG_ERR, "netconfig: invalid node name <%s>", ChrPtr(node));
-       return(-1);
-}
-
-
 /*
  * Convert any legacy configuration files in the "netconfigs" directory
  */
@@ -830,26 +734,32 @@ void convert_legacy_netcfg_files(void)
 
        syslog(LOG_INFO, "netconfig: legacy netconfig files exist - converting them!");
 
-       while (dit = readdir(dh), dit != NULL) {                // yes, we use the non-reentrant version; we're not in threaded mode yet
+       while (dit = readdir(dh), dit != NULL)                  // yes, we use the non-reentrant version; we're not in threaded mode yet
+       {
                roomnum = atol(dit->d_name);
                if (roomnum > 0) {
                        snprintf(filename, sizeof filename, "%s/%ld", ctdl_netcfg_dir, roomnum);
                        fp = fopen(filename, "r");
-                       if (fp) {
+                       if (fp)
+                       {
                                fseek(fp, 0L, SEEK_END);
                                len = ftell(fp);
-                               if (len > 0) {
+                               if (len > 0)
+                               {
                                        v = malloc(len);
-                                       if (v) {
+                                       if (v)
+                                       {
                                                rewind(fp);
-                                               if (fread(v, len, 1, fp)) {
+                                               if (fread(v, len, 1, fp))
+                                               {
                                                        write_netconfig_to_configdb(roomnum, v);
                                                        unlink(filename);
                                                }
                                                free(v);
                                        }
                                }
-                               else {
+                               else
+                               {
                                        unlink(filename);       // zero length netconfig, just delete it
                                }
                                fclose(fp);