Removed some vestiges of the old logging system
authorArt Cancro <ajc@citadel.org>
Wed, 24 May 2017 20:43:32 +0000 (16:43 -0400)
committerArt Cancro <ajc@citadel.org>
Wed, 24 May 2017 20:43:32 +0000 (16:43 -0400)
citadel/context.c
citadel/modules/ctdlproto/serv_syscmds.c
citadel/modules/network/serv_network.c
citadel/modules/xmpp/serv_xmpp.c
citadel/serv_extensions.c
citadel/serv_extensions.h
citadel/server_main.c
citadel/sysdep.c

index a9ba4fbb4052f160b39fa08dbf5ff4b8ee5b2b94..4e8594d785d4dbbcc83cfe66de4beeacfeab48bb 100644 (file)
 #include "control.h"
 #include "config.h"
 
-int DebugSession = 0;
-
 pthread_key_t MyConKey;                                /* TSD key for MyContext() */
-
-
 CitContext masterCC;
 CitContext *ContextList = NULL;
-
 time_t last_purge = 0;                         /* Last dead session purge */
 int num_sessions = 0;                          /* Current number of sessions */
 int next_pid = 0;
@@ -736,14 +731,9 @@ void set_async_waiting(struct CitContext *ccptr)
 }
 
 
-void DebugSessionEnable(const int n)
-{
-       DebugSession = n;
-}
 CTDL_MODULE_INIT(session)
 {
        if (!threading) {
-               CtdlRegisterDebugFlagHook(HKEY("session"), DebugSessionEnable, &DebugSession);
        }
        return "session";
 }
index 3b21bc4fbd1d6dcfb79f4f1d591f3fe7990de943..9a11deca6c3aa3b0c641952cc6e5d7fe7dc31a21 100644 (file)
@@ -2,7 +2,7 @@
 /* 
  * Main source module for the Citadel server
  *
- * Copyright (c) 1987-2011 by the citadel.org team
+ * Copyright (c) 1987-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.
 #include "serv_extensions.h"
 #include "ctdl_module.h"
 
-void cmd_log_get(char *argbuf)
-{
-       long HKLen;
-       const char *ch;
-       HashPos *Pos;
-       void *vptr;
-
-       if (CtdlAccessCheck(ac_aide)) return;
-
-       cprintf("%d Log modules enabled:\n", LISTING_FOLLOWS);
-
-       Pos = GetNewHashPos(LogDebugEntryTable, 0);
-
-       while (GetNextHashPos(LogDebugEntryTable, Pos, &HKLen, &ch, &vptr)) {
-               LogDebugEntry *E = (LogDebugEntry*)vptr;
-               cprintf("%s|%d\n", ch, *E->LogP);
-       }
-       
-       DeleteHashPos(&Pos);
-       cprintf("000\n");
-}
-void cmd_log_set(char *argbuf)
-{
-       void *vptr;
-       int lset;
-       int wlen;
-       char which[SIZ] = "";
-
-       if (CtdlAccessCheck(ac_aide)) return;
-
-       wlen = extract_token(which, argbuf, 0, '|', sizeof(which));
-       if (wlen < 0) wlen = 0;
-       lset = extract_int(argbuf, 1);
-       if (lset != 0) lset = 1;
-       if (GetHash(LogDebugEntryTable, which, wlen, &vptr) && 
-           (vptr != NULL))
-       {
-               LogDebugEntry *E = (LogDebugEntry*)vptr;
-               E->F(lset);
-               cprintf("%d %s|%d\n", CIT_OK, which, lset);
-       }
-       else {
-               cprintf("%d Log setting %s not known\n", 
-                       ERROR, which);
-       }
-}
-
 
 /*
  * Shut down the server
@@ -163,13 +116,9 @@ void cmd_cull(char *argbuf) {
 CTDL_MODULE_INIT(syscmd)
 {
        if (!threading) {
-               CtdlRegisterProtoHook(cmd_log_get, "LOGP", "Print Log-parameters");
-               CtdlRegisterProtoHook(cmd_log_set, "LOGS", "Set Log-parameters");
-
                CtdlRegisterProtoHook(cmd_down, "DOWN", "perform a server shutdown");
                CtdlRegisterProtoHook(cmd_halt, "HALT", "halt the server without exiting the server process");
                CtdlRegisterProtoHook(cmd_scdn, "SCDN", "schedule or cancel a server shutdown");
-
                CtdlRegisterProtoHook(cmd_cull, "CULL", "Cull database logs");
        }
         /* return our id for the Log */
index 3c8df1e8c2c31ecabcd4e6a65252172f7c1ba508..6c89cee3938f4c092a9ff8c3c2748c5930e61711 100644 (file)
@@ -78,7 +78,6 @@
 #include "netspool.h"
 #include "netmail.h"
 
-int NetQDebugEnabled = 0;
 struct CitContext networker_spool_CC;
 
 /* comes from lookup3.c from libcitadel... */
@@ -522,20 +521,13 @@ int ignet_aftersave(struct CtdlMessage *msg, recptypes *recps)
  * Module entry point
  */
 
-void SetNetQDebugEnabled(const int n)
-{
-       NetQDebugEnabled = n;
-}
-
 
 CTDL_MODULE_INIT(network)
 {
        if (!threading)
        {
                CtdlRegisterMessageHook(ignet_aftersave, EVT_AFTERSAVE);
-
                CtdlFillSystemContext(&networker_spool_CC, "CitNetSpool");
-               CtdlRegisterDebugFlagHook(HKEY("networkqueue"), SetNetQDebugEnabled, &NetQDebugEnabled);
                CtdlRegisterSessionHook(network_cleanup_function, EVT_STOP, PRIO_STOP + 30);
                 CtdlRegisterSessionHook(network_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 10);
                CtdlRegisterProtoHook(cmd_nsyn, "NSYN", "Synchronize room to node");
index 2ee2493cc1fe8b6e48fbbbe53e4ef64826be5228..3248a11cb39bbbf98b1281ec78082c10d3da3774 100644 (file)
@@ -64,7 +64,6 @@
 
 struct xmpp_event *xmpp_queue = NULL;
 
-int XMPPSrvDebugEnable = 0;
 
 
 
@@ -656,10 +655,6 @@ void xmpp_logout_hook(void) {
 }
 
 
-void LogXMPPSrvDebugEnable(const int n)
-{
-       XMPPSrvDebugEnable = n;
-}
 const char *CitadelServiceXMPP="XMPP";
 extern void xmpp_cleanup_events(void);
 CTDL_MODULE_INIT(xmpp)
@@ -672,7 +667,6 @@ CTDL_MODULE_INIT(xmpp)
                                        xmpp_async_loop,
                                        CitadelServiceXMPP
                );
-               CtdlRegisterDebugFlagHook(HKEY("serv_xmpp"), LogXMPPSrvDebugEnable, &XMPPSrvDebugEnable);
                CtdlRegisterSessionHook(xmpp_cleanup_function, EVT_STOP, PRIO_STOP + 70);
                 CtdlRegisterSessionHook(xmpp_login_hook, EVT_LOGIN, PRIO_LOGIN + 90);
                 CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 90);
index 86037aa5d107672f95d02a846b81da7452af8fdb..0624713e38a52244f1545fccd56deb21aa9e3212 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Citadel Extension Loader
- * Written by Brian Costello <btx@calyx.net>
+ * Originally written by Brian Costello <btx@calyx.net>
  *
  * Copyright (c) 1987-2017 by the citadel.org team
  *
 #include "config.h"
 
 
-int DebugModules = 0;
-int EnableMarkers = 0;
-int EnableCtlProto = 0;
-
 /*
  * Structure defentitions for hook tables
  */
 
-HashList *LogDebugEntryTable = NULL;
-
-typedef struct LogFunctionHook LogFunctionHook;
-struct LogFunctionHook {
-       LogFunctionHook *next;
-       int loglevel;
-       void (*h_function_pointer) (char *);
-};
-
-LogFunctionHook *LogHookTable = NULL;
-
 typedef struct FixedOutputHook FixedOutputHook;
 struct FixedOutputHook {
        FixedOutputHook *next;
@@ -53,10 +38,6 @@ struct FixedOutputHook {
 FixedOutputHook *FixedOutputTable = NULL;
 
 
-
-
-
-
 /*
  * SessionFunctionHook extensions are used for any type of hook for which
  * the context in which it's being called (which is determined by the event
@@ -72,6 +53,7 @@ struct SessionFunctionHook {
 };
 SessionFunctionHook *SessionHookTable = NULL;
 
+
 /*
  * UserFunctionHook extensions are used for any type of hook which implements
  * an operation on a user or username (potentially) other than the one
@@ -85,6 +67,7 @@ struct UserFunctionHook {
 };
 UserFunctionHook *UserHookTable = NULL;
 
+
 /*
  * MessageFunctionHook extensions are used for hooks which implement handlers
  * for various types of message operations (save, read, etc.)
@@ -137,8 +120,6 @@ struct XmsgFunctionHook {
 XmsgFunctionHook *XmsgHookTable = NULL;
 
 
-
-
 /*
  * RoomFunctionHook extensions are used for hooks which impliment room
  * processing functions when new messages are added EG. SIEVE.
@@ -151,7 +132,6 @@ struct RoomFunctionHook {
 RoomFunctionHook *RoomHookTable = NULL;
 
 
-
 typedef struct SearchFunctionHook SearchFunctionHook;
 struct SearchFunctionHook {
        SearchFunctionHook *next;
@@ -188,18 +168,18 @@ ConstStr Empty = {HKEY("")};
 char *ErrSubject = "Startup Problems";
 ConstStr ErrGeneral[] = {
        {HKEY("Citadel had trouble on starting up. ")},
-       {HKEY(" This means, citadel won't be the service provider for a specific service you configured it to.\n\n"
-             "If you don't want citadel to provide these services, turn them off in WebCit via: ")},
+       {HKEY(" This means, Citadel won't be the service provider for a specific service you configured it to.\n\n"
+             "If you don't want Citadel to provide these services, turn them off in WebCit via: ")},
        {HKEY("To make both ways actualy take place restart the citserver with \"sendcommand down\"\n\n"
              "The errors returned by the system were:\n")},
        {HKEY("You can recheck the above if you follow this faq item:\n"
              "http://www.citadel.org/doku.php?id=faq:mastering_your_os:net#netstat")}
 };
 
-ConstStr ErrPortShort = { HKEY("We couldn't bind all ports you configured to be provided by citadel server.\n")};
+ConstStr ErrPortShort = { HKEY("We couldn't bind all ports you configured to be provided by Citadel Server.\n")};
 ConstStr ErrPortWhere = { HKEY("\"Admin->System Preferences->Network\".\n\nThe failed ports and sockets are: ")};
-ConstStr ErrPortHint  = { HKEY("If you want citadel to provide you with that functionality, "
-                              "check the output of \"netstat -lnp\" on linux Servers or \"netstat -na\" on *BSD"
+ConstStr ErrPortHint  = { HKEY("If you want Citadel to provide you with that functionality, "
+                              "check the output of \"netstat -lnp\" on Linux, or \"netstat -na\" on BSD"
                               " and stop the program that binds these ports.\n You should eventually remove "
                               " their initscripts in /etc/init.d so that you won't get this trouble once more.\n"
                               " After that goto \"Administration -> Shutdown Citadel\" to make Citadel restart & retry to bind this port.\n")};
@@ -212,8 +192,7 @@ void LogPrintMessages(long err)
        ConstStr *Short, *Where, *Hint; 
 
        
-       Message = NewStrBufPlain(NULL, 
-                                StrLength(portlist) + StrLength(errormessages));
+       Message = NewStrBufPlain(NULL, StrLength(portlist) + StrLength(errormessages));
        
        DetailErrorFlags = DetailErrorFlags & ~err;
 
@@ -289,70 +268,6 @@ int DLoader_Exec_Cmd(char *cmdbuf)
        return 0;
 }
 
-void CtdlRegisterDebugFlagHook(const char *Name, long Len, CtdlDbgFunction F, const int *LogP)
-{
-       LogDebugEntry *E;
-       if (LogDebugEntryTable == NULL)
-               LogDebugEntryTable = NewHash(1, NULL);
-       E = (LogDebugEntry*) malloc(sizeof(LogDebugEntry));
-       E->F = F;
-       E->Name = Name;
-       E->Len = Len;
-       E->LogP = LogP;
-       Put(LogDebugEntryTable, Name, Len, E, NULL);
-       
-}
-void CtdlSetDebugLogFacilities(const char **Str, long n)
-{
-       StrBuf *Token = NULL;
-       StrBuf *Buf = NULL;
-       const char *ch;
-       int i;
-       int DoAll = 0;
-       void *vptr;
-
-       for (i=0; i < n; i++){
-               if ((Str[i] != NULL) && !IsEmptyStr(Str[i])) {
-                       if (strcmp(Str[i], "all") == 0) {
-                               DoAll = 1;
-                               continue;
-                       }
-                       Buf = NewStrBufPlain(Str[i], -1);
-                       ch = NULL;
-                       if (Token == NULL)
-                               Token = NewStrBufPlain(NULL, StrLength(Buf));
-                       while ((ch != StrBufNOTNULL) &&
-                              StrBufExtract_NextToken(Token, Buf, &ch, ',')) {
-                               if (GetHash(LogDebugEntryTable, SKEY(Token), &vptr) && 
-                                   (vptr != NULL))
-                               {
-                                       LogDebugEntry *E = (LogDebugEntry*)vptr;
-                                       E->F(1);
-                               }
-                       }
-               }
-               FreeStrBuf(&Buf);
-       }
-       FreeStrBuf(&Token);
-       if (DoAll) {
-               long HKLen;
-               const char *ch;
-               HashPos *Pos;
-
-               Pos = GetNewHashPos(LogDebugEntryTable, 0);
-               while (GetNextHashPos(LogDebugEntryTable, Pos, &HKLen, &ch, &vptr)) {
-                       LogDebugEntry *E = (LogDebugEntry*)vptr;
-                       E->F(1);
-               }
-
-               DeleteHashPos(&Pos);
-       }
-}
-void CtdlDestroyDebugTable(void)
-{
-
-       DeleteHash(&LogDebugEntryTable);
-}
 
 void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc)
 {
@@ -635,8 +550,7 @@ void CtdlDestroyUserHooks(void)
 }
 
 
-void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *),
-                               int EventType)
+void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *), int EventType)
 {
 
        MessageFunctionHook *newfcn;
@@ -652,8 +566,7 @@ void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *),
 }
 
 
-void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *),
-               int EventType)
+void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *), int EventType)
 {
        MessageFunctionHook *cur, *p, *last;
        last = NULL;
@@ -1368,25 +1281,10 @@ void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *er
 #endif
 }
 
-void DebugModulesEnable(const int n)
-{
-       DebugModules = n;
-}
-void MarkersEnable(const int n)
-{
-       EnableMarkers = n;
-}
-void DebugCitadelProtoEnable(const int n)
-{
-       EnableCtlProto = n;
-}
 
 CTDL_MODULE_INIT(modules)
 {
        if (!threading) {
-               CtdlRegisterDebugFlagHook(HKEY("modules"), DebugModulesEnable, &DebugModules);
-               CtdlRegisterDebugFlagHook(HKEY("periodicmarkers"), MarkersEnable, &EnableMarkers);
-               CtdlRegisterDebugFlagHook(HKEY("citadelprotocol"), DebugCitadelProtoEnable, &EnableCtlProto);
        }
        return "modules";
 }
index b394a0cef1a7eaba2f97ddacec5c7d3205b29113..325db6dcc56f96e5366237fc426725e4b8d87940 100644 (file)
@@ -4,22 +4,6 @@
 
 #include "server.h"
 
-/*
- * This is where we declare all of the server extensions we have.
- * We'll probably start moving these to a more sane location in the near
- * future.  For now, this just shuts up the compiler.
- */
-//void serv_calendar_destroy(void);
-//char *serv_test_init(void);
-//char *serv_postfix_tcpdict(void);
-/*
- */
-
-typedef void (*CtdlDbgFunction) (const int);
-
-
-
-
 /*
  * ServiceFunctionHook extensions are used for hooks which implement various
  * protocols (either on TCP or on unix domain sockets) directly in the Citadel server.
@@ -44,14 +28,6 @@ struct CleanupFunctionHook {
 };
 extern CleanupFunctionHook *CleanupHookTable;
 
-
-typedef struct __LogDebugEntry {
-       CtdlDbgFunction F;
-       const char *Name;
-       long Len;
-       const int *LogP;
-} LogDebugEntry;
-extern HashList *LogDebugEntryTable;
 void initialize_server_extensions(void);
 int DLoader_Exec_Cmd(char *cmdbuf);
 char *Dynamic_Module_Init(void);
@@ -65,23 +41,18 @@ void PerformUserHooks(struct ctdluser *usbuf, int EventType);
 int PerformXmsgHooks(char *, char *, char *, char *);
 void CtdlDestroyXmsgHooks(void);
 
-
-
 void CtdlDestroyMessageHook(void);
 int PerformMessageHooks(struct CtdlMessage *, recptypes *recps, int EventType);
 
-
 void CtdlDestroyNetprocHooks(void);
 int PerformNetprocHooks(struct CtdlMessage *, char *);
 
 void CtdlDestroyRoomHooks(void);
 int PerformRoomHooks(struct ctdlroom *);
 
-
 void CtdlDestroyDeleteHooks(void);
 void PerformDeleteHooks(char *, long);
 
-
 void CtdlDestroyCleanupHooks(void);
 
 void CtdlDestroyProtoHooks(void);
@@ -93,10 +64,6 @@ void CtdlDestroySearchHooks(void);
 void CtdlDestroyFixedOutputHooks(void);
 int PerformFixedOutputHooks(char *, char *, int);
 
-void CtdlRegisterDebugFlagHook(const char *Name, long len, CtdlDbgFunction F, const int *);
-void CtdlSetDebugLogFacilities(const char **Str, long n);
-void CtdlDestroyDebugTable(void);
-
 void netcfg_keyname(char *keybuf, long roomnum);
 
 #endif /* SERV_EXTENSIONS_H */
index f1b458e5a98ce2ac1fea353f8841d6ee3eab3b95..da2ec758621b0e3b9f733451eb4f54370442bf82 100644 (file)
@@ -82,7 +82,6 @@ int main(int argc, char **argv)
        char relhome[PATH_MAX]="";
        char ctdldir[PATH_MAX]=CTDLDIR;
        int syslog_facility = LOG_DAEMON;
-       const char *eDebuglist[] = {NULL, NULL};
        uid_t u = 0;
        struct passwd *p = NULL;
 #ifdef HAVE_RUN_DIR
@@ -122,7 +121,7 @@ int main(int argc, char **argv)
                        break;
 
                case 'x':
-                       eDebuglist [0] = optarg;
+                               /* deprecated */
                        break;
 
                case 't':       /* deprecated */
@@ -313,9 +312,6 @@ int main(int argc, char **argv)
        
        initialise_modules(0);
 
-       eDebuglist[1] = getenv("CITADEL_LOGDEBUG");
-       CtdlSetDebugLogFacilities(eDebuglist, 2);
-
        /*
         * If we need host auth, start our chkpwd daemon.
         */
index 67c7a7b9eaf143a50f8bd9c4d8695dc78c627352..d36a39517185c0bb03124ade6db43f1f9fb31cfd 100644 (file)
@@ -950,7 +950,6 @@ void sysdep_master_cleanup(void) {
        CtdlDestroyServiceHook();
        CtdlDestroyRoomHooks();
        CtdlDestroySearchHooks();
-       CtdlDestroyDebugTable();
        #ifdef HAVE_BACKTRACE
 ///    eCrash_Uninit();
        #endif