more trimming away of ignet stuffs
authorArt Cancro <ajc@citadel.org>
Wed, 24 Jan 2018 15:47:07 +0000 (10:47 -0500)
committerArt Cancro <ajc@citadel.org>
Wed, 24 Jan 2018 15:47:07 +0000 (10:47 -0500)
citadel/Makefile.in
citadel/context.c
citadel/context.h
citadel/include/ctdl_module.h
citadel/modules/ctdlproto/serv_file.c
citadel/modules/network/serv_network.c
citadel/netconfig.c
citadel/nttlist.c [deleted file]
citadel/scripts/mk_module_init.sh
citadel/server.h

index 24bb68f4e0feaa3e801307d14fdb93ad55a0e1b5..edcdd66d3bbd6d865d371e7d40e51253b0ff5a0d 100644 (file)
@@ -81,7 +81,7 @@ SOURCES=utils/citmail.c \
        locate_host.c auth.c msgbase.c parsedate.c \
        room_ops.c euidindex.c server_main.c ldap.c \
        support.c sysdep.c user_ops.c journaling.c threads.c \
-       context.c netconfig.c nttlist.c md5.c
+       context.c netconfig.c md5.c
 
 
 include Make_sources
@@ -136,7 +136,7 @@ SERV_OBJS = server_main.o utillib/citadel_dirs.o \
        internet_addressing.o journaling.o \
        parsedate.o genstamp.o ecrash.o threads.o context.o \
        clientsocket.o modules_init.o modules_upgrade.o $(SERV_MODULES) \
-       svn_revision.o ldap.o netconfig.o nttlist.o md5.o
+       svn_revision.o ldap.o netconfig.o md5.o
 
 citserver$(EXEEXT): $(SERV_OBJS)
        $(CC) $(SERV_OBJS) $(LDFLAGS) $(SERVER_LDFLAGS) $(LIBS) $(SERVER_LIBS) $(RESOLV) -o citserver$(EXEEXT)
index 385f9a7790f3b51fc58446f3da8388c44b700f7a..47da2679f5fec868fe972e7f1937e1b9b4954c68 100644 (file)
@@ -2,7 +2,7 @@
  * Citadel context management stuff.
  * Here's where we (hopefully) have all the code that manipulates contexts.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, version 3.
@@ -16,7 +16,6 @@
 #include "ctdl_module.h"
 #include "serv_extensions.h"
 #include "ecrash.h"
-
 #include "citserver.h"
 #include "user_ops.h"
 #include "locate_host.h"
@@ -52,6 +51,7 @@ int CtdlTrySingleUser(void)
        return can_do;
 }
 
+
 void CtdlEndSingleUser(void)
 {
        begin_critical_section(S_SINGLE_USER);
@@ -65,6 +65,7 @@ int CtdlWantSingleUser(void)
        return want_single_user;
 }
 
+
 int CtdlIsSingleUser(void)
 {
        if (want_single_user)
@@ -77,9 +78,6 @@ int CtdlIsSingleUser(void)
 }
 
 
-
-
-
 /*
  * Locate a context by its session number and terminate it if the user is able.
  * User can NOT terminate their current session.
@@ -494,7 +492,6 @@ void begin_session(CitContext *con)
        strcpy(con->lastcmdname, "    ");
        strcpy(con->cs_clientname, "(unknown)");
        strcpy(con->curr_user, NLI);
-       *con->net_node = '\0';
        *con->fake_username = '\0';
        *con->fake_hostname = '\0';
        *con->fake_roomname = '\0';
@@ -548,7 +545,6 @@ void begin_session(CitContext *con)
        }
        con->cs_flags = 0;
        con->upload_type = UPL_FILE;
-       con->dl_is_net = 0;
 
        con->nologin = 0;
        if (((CtdlGetConfigInt("c_maxsessions") > 0)&&(num_sessions > CtdlGetConfigInt("c_maxsessions"))) || CtdlWantSingleUser()) {
index 744fcb6001f5bb19ead336859d95f479a228808d..dacac07a267f08b7ffb7006f14c09c0a2a835087 100644 (file)
@@ -82,7 +82,6 @@ struct CitContext {
        int curr_view;          /* The view type for the current user/room */
        int is_master;          /* Is this session logged in using the master user? */
 
-       char net_node[32]       ;/* Is the client another Citadel server? */
        time_t previous_login;  /* Date/time of previous login */
        char lastcmdname[5];    /* name of last command executed */
        unsigned cs_flags;      /* miscellaneous flags */
@@ -115,7 +114,6 @@ struct CitContext {
        char upl_comment[256];
        char upl_filedir[PATH_MAX];
        char upl_mimetype[64];
-       char dl_is_net;
        char upload_type;
 
        struct ctdluser user;   /* Database record buffers */
index c08333e4b874c1761360de005217a6689fd75443..3783a04568879e20c7befbf67f816419ae140511 100644 (file)
@@ -367,16 +367,7 @@ int CtdlIsValidNode(const StrBuf **nexthop,
 
 
 
-int CtdlNetworkTalkingTo(const char *nodename, long len, int operation);
 
-/*
- * Operations that can be performed by network_talking_to()
- */
-enum {
-        NTT_ADD,
-        NTT_REMOVE,
-        NTT_CHECK
-};
 
 /*
  * Expose API calls from user_ops.c
index 44a5d361315086007d9b0a1cd7c1c37208921432..29b54605646eca5e23aca48869c9fe317b9d4821 100644 (file)
@@ -365,13 +365,6 @@ void cmd_clos(char *cmdbuf)
 
        fclose(CC->download_fp);
        CC->download_fp = NULL;
-
-       if (CC->dl_is_net == 1) {
-               CC->dl_is_net = 0;
-               snprintf(buf, sizeof buf, "%s/%s", ctdl_netout_dir, CC->net_node);
-               unlink(buf);
-       }
-
        cprintf("%d Ok\n", CIT_OK);
 }
 
@@ -524,105 +517,6 @@ void cmd_writ(char *cmdbuf)
 }
 
 
-/*
- * cmd_ndop() - open a network spool file for downloading
- */
-void cmd_ndop(char *cmdbuf)
-{
-       struct CitContext *CCC = CC;
-       char pathname[256];
-       struct stat statbuf;
-
-       if (IsEmptyStr(CCC->net_node)) {
-               cprintf("%d Not authenticated as a network node.\n",
-                       ERROR + NOT_LOGGED_IN);
-               return;
-       }
-
-       if (CCC->download_fp != NULL) {
-               cprintf("%d You already have a download file open.\n",
-                       ERROR + RESOURCE_BUSY);
-               return;
-       }
-
-       snprintf(pathname, sizeof pathname, 
-                        "%s/%s",
-                        ctdl_netout_dir,
-                        CCC->net_node);
-
-       /* first open the file in append mode in order to create a
-        * zero-length file if it doesn't already exist 
-        */
-       CCC->download_fp = fopen(pathname, "a");
-       if (CCC->download_fp != NULL)
-               fclose(CCC->download_fp);
-
-       /* now open it */
-       CCC->download_fp = fopen(pathname, "r");
-       if (CCC->download_fp == NULL) {
-               cprintf("%d cannot open %s: %s\n",
-                       ERROR + INTERNAL_ERROR, pathname, strerror(errno));
-               return;
-       }
-
-
-       /* set this flag so other routines know that the download file
-        * currently open is a network spool file 
-        */
-       CCC->dl_is_net = 1;
-
-       stat(pathname, &statbuf);
-       CCC->download_fp_total = statbuf.st_size;
-       cprintf("%d %ld\n", CIT_OK, (long)statbuf.st_size);
-}
-
-
-/*
- * cmd_nuop() - open a network spool file for uploading
- */
-void cmd_nuop(char *cmdbuf)
-{
-       static int seq = 1;
-
-       if (IsEmptyStr(CC->net_node)) {
-               cprintf("%d Not authenticated as a network node.\n",
-                       ERROR + NOT_LOGGED_IN);
-               return;
-       }
-
-       if (CC->upload_fp != NULL) {
-               cprintf("%d You already have an upload file open.\n",
-                       ERROR + RESOURCE_BUSY);
-               return;
-       }
-
-       snprintf(CC->upl_path, sizeof CC->upl_path,
-                "%s/%s.%04lx.%04x",
-                ctdl_nettmp_dir,
-                CC->net_node, 
-                (long)getpid(), 
-                ++seq
-       );
-
-       CC->upload_fp = fopen(CC->upl_path, "r");
-       if (CC->upload_fp != NULL) {
-               fclose(CC->upload_fp);
-               CC->upload_fp = NULL;
-               cprintf("%d '%s' already exists\n", ERROR + ALREADY_EXISTS, CC->upl_path);
-               return;
-       }
-
-       CC->upload_fp = fopen(CC->upl_path, "w");
-       if (CC->upload_fp == NULL) {
-               cprintf("%d Cannot open %s: %s\n", ERROR + INTERNAL_ERROR, CC->upl_path, strerror(errno));
-               return;
-       }
-
-       CC->upload_type = UPL_NET;
-       cprintf("%d Ok\n", CIT_OK);
-}
-
-
 void files_logout_hook(void)
 {
         CitContext *CCC = MyContext();
@@ -786,8 +680,6 @@ CTDL_MODULE_INIT(file_ops)
                CtdlRegisterProtoHook(cmd_ucls, "UCLS", "Close an upload file transfer");
                CtdlRegisterProtoHook(cmd_read, "READ", "File transfer read operation");
                CtdlRegisterProtoHook(cmd_writ, "WRIT", "File transfer write operation");
-               CtdlRegisterProtoHook(cmd_ndop, "NDOP", "Open a network spool file for download");
-               CtdlRegisterProtoHook(cmd_nuop, "NUOP", "Open a network spool file for upload");
                CtdlRegisterProtoHook(cmd_oimg, "OIMG", "Open an image file for download");
                CtdlRegisterProtoHook(cmd_uimg, "UIMG", "Upload an image file");
                CtdlRegisterProtoHook(cmd_mesg, "MESG", "fetch system banners");
index 4434044de20cfd8134067b0d89199aa23d49b713..36b23527a371d9545676cf81f00cc03b49c7f6b3 100644 (file)
@@ -318,31 +318,6 @@ void network_do_queue(void)
 }
 
 
-void network_logout_hook(void)
-{
-       CitContext *CCC = MyContext();
-
-       /*
-        * If we were talking to a network node, we're not anymore...
-        */
-       if (!IsEmptyStr(CCC->net_node)) {
-               CtdlNetworkTalkingTo(CCC->net_node, strlen(CCC->net_node), NTT_REMOVE);
-               CCC->net_node[0] = '\0';
-       }
-}
-
-
-void network_cleanup_function(void)
-{
-       struct CitContext *CCC = CC;
-
-       if (!IsEmptyStr(CCC->net_node)) {
-               CtdlNetworkTalkingTo(CCC->net_node, strlen(CCC->net_node), NTT_REMOVE);
-               CCC->net_node[0] = '\0';
-       }
-}
-
-
 /*
  * Module entry point
  */
@@ -353,8 +328,6 @@ CTDL_MODULE_INIT(network)
        if (!threading)
        {
                CtdlFillSystemContext(&networker_spool_CC, "CitNetSpool");
-               CtdlRegisterSessionHook(network_cleanup_function, EVT_STOP, PRIO_STOP + 30);
-                CtdlRegisterSessionHook(network_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 10);
                CtdlRegisterRoomHook(network_room_handler);
                CtdlRegisterCleanupHook(destroy_network_queue_room_locked);
                CtdlRegisterSessionHook(network_do_queue, EVT_TIMER, PRIO_QUEUE + 10);
index e59337f2740cb4b96f0d99ce2834fa88a384b1c6..a21c39f5026800dd726a8ce3e620d13e47c06329 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This module handles loading, saving, and parsing of room network configurations.
  *
- * Copyright (c) 2000-2017 by the citadel.org team
+ * Copyright (c) 2000-2018 by the citadel.org team
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License, version 3.
@@ -622,76 +622,6 @@ int CtdlNetconfigCheckRoomaccess(char *errmsgbuf, size_t n, const char* RemoteId
 }
 
 
-/*
- * cmd_netp() - authenticate to the server as another Citadel node polling
- *           for network traffic
- */
-void cmd_netp(char *cmdbuf)
-{
-       struct CitContext *CCC = CC;
-       HashList *working_ignetcfg;
-       char *node;
-       StrBuf *NodeStr;
-       long nodelen;
-       int v;
-
-       const StrBuf *secret = NULL;
-       const StrBuf *nexthop = NULL;
-       char err_buf[SIZ] = "";
-
-       /* Authenticate */
-       node = CCC->curr_user;
-       nodelen = extract_token(CCC->curr_user, cmdbuf, 0, '|', sizeof CCC->curr_user);
-       NodeStr = NewStrBufPlain(node, nodelen);
-       /* load the IGnet Configuration to check node validity */
-       working_ignetcfg = CtdlLoadIgNetCfg();
-       v = CtdlIsValidNode(&nexthop, &secret, NodeStr, working_ignetcfg, NULL);
-       if (v != 0) {
-               snprintf(err_buf, sizeof err_buf,
-                       "An unknown Citadel server called \"%s\" attempted to connect from %s [%s].\n",
-                       node, CCC->cs_host, CCC->cs_addr
-               );
-               syslog(LOG_WARNING, "netconfig: %s", err_buf);
-               cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
-               CtdlAideMessage(err_buf, "IGNet Networking");
-               DeleteHash(&working_ignetcfg);
-               FreeStrBuf(&NodeStr);
-               return;
-       }
-
-       extract_token(CCC->user.password, cmdbuf, 1, '|', sizeof CCC->user.password);
-       if (strcasecmp(CCC->user.password, ChrPtr(secret))) {
-               snprintf(err_buf, sizeof err_buf,
-                       "A Citadel server at %s [%s] failed to authenticate as network node \"%s\".\n",
-                       CCC->cs_host, CCC->cs_addr, node
-               );
-               syslog(LOG_WARNING, "netconfig: %s", err_buf);
-               cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
-
-               CtdlAideMessage(err_buf, "IGNet Networking");
-               DeleteHash(&working_ignetcfg);
-               FreeStrBuf(&NodeStr);
-               return;
-       }
-
-       if (CtdlNetworkTalkingTo(node, nodelen, NTT_CHECK)) {
-               syslog(LOG_WARNING, "netconfig: duplicate session for network node <%s>", node);
-               cprintf("%d Already talking to %s right now\n", ERROR + RESOURCE_BUSY, node);
-               DeleteHash(&working_ignetcfg);
-               FreeStrBuf(&NodeStr);
-               return;
-       }
-       nodelen = safestrncpy(CCC->net_node, node, sizeof CCC->net_node);
-       CtdlNetworkTalkingTo(CCC->net_node, nodelen, NTT_ADD);
-       syslog(LOG_INFO, "netconfig: network node <%s> logged in from %s [%s]",
-               CCC->net_node, CCC->cs_host, CCC->cs_addr
-       );
-       cprintf("%d authenticated as network node '%s'\n", CIT_OK, CCC->net_node);
-       DeleteHash(&working_ignetcfg);
-       FreeStrBuf(&NodeStr);
-}
-
-
 /*-----------------------------------------------------------------------------*
  *                 Network maps: evaluate other nodes                          *
  *-----------------------------------------------------------------------------*/
@@ -942,7 +872,6 @@ CTDL_MODULE_INIT(netconfig)
                convert_legacy_netcfg_files();
                CtdlRegisterProtoHook(cmd_gnet, "GNET", "Get network config");
                CtdlRegisterProtoHook(cmd_snet, "SNET", "Set network config");
-               CtdlRegisterProtoHook(cmd_netp, "NETP", "Identify as network poller");
        }
        return "netconfig";
 }
diff --git a/citadel/nttlist.c b/citadel/nttlist.c
deleted file mode 100644 (file)
index 34d6984..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * This module handles shared rooms, inter-Citadel mail, and outbound
- * mailing list processing.
- *
- * Copyright (c) 2000-2017 by the citadel.org team
- *
- *  This program is open source software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License, version 3.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- */
-#include "sysdep.h"
-#include <stdio.h>
-#include <libcitadel.h>
-#include "ctdl_module.h"
-#include "serv_extensions.h"
-
-/*-----------------------------------------------------------------------------*
- *                 Network maps: evaluate other nodes                          *
- *-----------------------------------------------------------------------------*/
-
-/*
- * network_talking_to()  --  concurrency checker
- */
-static HashList *nttlist = NULL;
-int CtdlNetworkTalkingTo(const char *nodename, long len, int operation)
-{
-
-       int retval = 0;
-       HashPos *Pos = NULL;
-       void *vdata;
-
-       begin_critical_section(S_NTTLIST);
-
-       switch(operation) {
-
-               case NTT_ADD:
-                       if (nttlist == NULL) 
-                               nttlist = NewHash(1, NULL);
-                       Put(nttlist, nodename, len, NewStrBufPlain(nodename, len), HFreeStrBuf);
-                       syslog(LOG_DEBUG, "nttlist: added <%s>\n", nodename);
-                       break;
-               case NTT_REMOVE:
-                       if ((nttlist == NULL) ||
-                           (GetCount(nttlist) == 0))
-                               break;
-                       Pos = GetNewHashPos(nttlist, 1);
-                       if (GetHashPosFromKey (nttlist, nodename, len, Pos))
-                               DeleteEntryFromHash(nttlist, Pos);
-                       DeleteHashPos(&Pos);
-                       syslog(LOG_DEBUG, "nttlist: removed <%s>\n", nodename);
-
-                       break;
-
-               case NTT_CHECK:
-                       if ((nttlist == NULL) ||
-                           (GetCount(nttlist) == 0))
-                               break;
-                       if (GetHash(nttlist, nodename, len, &vdata))
-                               retval ++;
-                       syslog(LOG_DEBUG, "nttlist: have [%d] <%s>\n", retval, nodename);
-                       break;
-       }
-
-       end_critical_section(S_NTTLIST);
-       return(retval);
-}
-
-void cleanup_nttlist(void)
-{
-        begin_critical_section(S_NTTLIST);
-       DeleteHash(&nttlist);
-        end_critical_section(S_NTTLIST);
-}
-
-
-
-
-/*
- * Module entry point
- */
-CTDL_MODULE_INIT(nttlist)
-{
-       if (!threading)
-       {
-               CtdlRegisterCleanupHook(cleanup_nttlist);
-       }
-       return "nttlist";
-}
index ade4e96986fcdaa56253eda7f0b00e008a4770c5..3d684df2b54384390ff1c5ef1c5cfd65fede31be 100755 (executable)
@@ -30,7 +30,7 @@ U_FILE="$CUR_DIR/modules_upgrade.c"
 
 /usr/bin/printf "Scanning extension modules for entry points.\n"
 
-STATIC_FIRST_MODULES="control modules euidindex msgbase nttlist database"
+STATIC_FIRST_MODULES="control modules euidindex msgbase database"
 DYNAMIC_MODULES=`grep CTDL_MODULE_INIT modules/*/*.c |$SED 's;.*(\(.*\));\1;'`
 if test -d user_modules; then 
     USER_MODULES=`grep CTDL_MODULE_INIT user_modules/*/*.c |$SED 's;.*(\(.*\));\1;'`
index 97be8d1b1531720a42807666f014b4eabb594b71..01d09c693ef3c6d030632655d8879a04a436b871 100644 (file)
@@ -147,7 +147,6 @@ enum {
        S_SUPPMSGMAIN,
        S_CONFIG,
        S_HOUSEKEEPING,
-       S_NTTLIST,
        S_DIRECTORY,
        S_NETCONFIGS,
        S_PUBLIC_CLIENTS,