From 9edc51ecd9ae0920f9d0c3f00f53fc9ac1cc0dce Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 22 Jan 2018 21:58:49 -0500 Subject: [PATCH] Removed netfilterlist module --- citadel/modules/network/serv_netfilter.c | 194 ----------------------- citadel/modules/network/serv_network.c | 4 +- 2 files changed, 1 insertion(+), 197 deletions(-) delete mode 100644 citadel/modules/network/serv_netfilter.c diff --git a/citadel/modules/network/serv_netfilter.c b/citadel/modules/network/serv_netfilter.c deleted file mode 100644 index 121ef3116..000000000 --- a/citadel/modules/network/serv_netfilter.c +++ /dev/null @@ -1,194 +0,0 @@ -/* - * A server-side module for Citadel designed to filter idiots off the network. - * - * Copyright (c) 2002-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 -#include -#include -#include -#include -#include -#include -#include - -#if TIME_WITH_SYS_TIME -# include -# include -#else -# if HAVE_SYS_TIME_H -# include -# else -# include -# endif -#endif - -#include -#include -#include -#include -#include "citadel.h" -#include "server.h" -#include "citserver.h" -#include "support.h" -#include "config.h" -#include "control.h" -#include "user_ops.h" -#include "database.h" -#include "msgbase.h" - - -#include "ctdl_module.h" - -typedef struct FilterList FilterList; - -struct FilterList { - FilterList *next; - char fl_user[SIZ]; - char fl_room[SIZ]; - char fl_node[SIZ]; -}; - -struct FilterList *filterlist = NULL; - -/* - * Keep track of what messages to reject - */ -FilterList *load_filter_list(void) { - char *serialized_list = NULL; - int i; - char buf[SIZ]; - FilterList *newlist = NULL; - FilterList *nptr; - - serialized_list = CtdlGetSysConfig(FILTERLIST); - if (serialized_list == NULL) return(NULL); /* if null, no entries */ - - /* Use the string tokenizer to grab one line at a time */ - for (i=0; ifl_user, buf, 0, '|', sizeof nptr->fl_user); - striplt(nptr->fl_user); - extract_token(nptr->fl_room, buf, 1, '|', sizeof nptr->fl_room); - striplt(nptr->fl_room); - extract_token(nptr->fl_node, buf, 2, '|', sizeof nptr->fl_node); - striplt(nptr->fl_node); - - /* Cowardly refuse to add an any/any/any entry that would - * end up filtering every single message. - */ - if (IsEmptyStr(nptr->fl_user) && - IsEmptyStr(nptr->fl_room) && - IsEmptyStr(nptr->fl_node)) { - free(nptr); - } - else { - nptr->next = newlist; - newlist = nptr; - } - } - - free(serialized_list); - return newlist; -} - - -void free_filter_list(FilterList *fl) { - if (fl == NULL) return; - free_filter_list(fl->next); - free(fl); -} - -void free_netfilter_list(void) -{ - free_filter_list(filterlist); - filterlist = NULL; -} - -void load_network_filter_list(void) -{ - filterlist = load_filter_list(); -} - - -/* - * This handler detects whether an incoming network message is from some - * moron user who the site operator has elected to filter out. If a match - * is found, the message is rejected. - */ -int filter_the_idiots(struct CtdlMessage *msg, char *target_room) { - FilterList *fptr; - int zap_user = 0; - int zap_room = 0; - int zap_node = 0; - - if ( (msg == NULL) || (filterlist == NULL) ) { - return(0); - } - - for (fptr = filterlist; fptr != NULL; fptr = fptr->next) { - - zap_user = 0; - zap_room = 0; - zap_node = 0; - - if (!CM_IsEmpty(msg, eAuthor)) { - if ( (!strcasecmp(msg->cm_fields[eAuthor], fptr->fl_user)) - || (fptr->fl_user[0] == 0) ) { - zap_user = 1; - } - } - - if (!CM_IsEmpty(msg, eRemoteRoom)) { - if ( (!strcasecmp(msg->cm_fields[eRemoteRoom], fptr->fl_room)) - || (fptr->fl_room[0] == 0) ) { - zap_room = 1; - } - } - - if (!CM_IsEmpty(msg, eOriginalRoom)) { - if ( (!strcasecmp(msg->cm_fields[eOriginalRoom], fptr->fl_room)) - || (fptr->fl_room[0] == 0) ) { - zap_room = 1; - } - } - - if (!CM_IsEmpty(msg, eNodeName)) { - if ( (!strcasecmp(msg->cm_fields[eNodeName], fptr->fl_node)) - || (fptr->fl_node[0] == 0) ) { - zap_node = 1; - } - } - - if (zap_user + zap_room + zap_node == 3) return(1); - - } - - return(0); -} - - -CTDL_MODULE_INIT(netfilter) -{ - if (!threading) - { -/* - currently unsupported. - CtdlRegisterNetprocHook(filter_the_idiots); -*/ - } - - /* return our module name for the log */ - return "netfilter"; -} diff --git a/citadel/modules/network/serv_network.c b/citadel/modules/network/serv_network.c index 6c89cee39..6c6f5e982 100644 --- a/citadel/modules/network/serv_network.c +++ b/citadel/modules/network/serv_network.c @@ -2,7 +2,7 @@ * This module handles shared rooms, inter-Citadel mail, and outbound * mailing list processing. * - * 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. @@ -391,8 +391,6 @@ void network_do_queue(void) network_do_spoolin(working_ignetcfg, the_netmap, &netmap_changed); } - /* Free the filter list in memory */ - free_netfilter_list(); /* Save the network map back to disk */ if (netmap_changed) { -- 2.30.2