/*
* Main source module for the Citadel server
*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 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.
*/
int master_cleanup(int exitcode)
{
- struct CleanupFunctionHook *fcn;
static int already_cleaning_up = 0;
if (already_cleaning_up) {
}
already_cleaning_up = 1;
- /* Run any cleanup routines registered by loadable modules */
- for (fcn = CleanupHookTable; fcn != NULL; fcn = fcn->next) {
- (*fcn->h_function_pointer) ();
- }
-
/* Do system-dependent stuff */
sysdep_master_cleanup();
shutdown_config_system();
/* Close databases */
- syslog(LOG_INFO, "Closing databases\n");
+ syslog(LOG_INFO, "citserver: closing databases");
close_databases();
/* If the operator requested a halt but not an exit, halt here. */
/*
* This module handles states which are global to the entire server.
*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 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.
/* MODULE INITIALIZATION STUFF */
/*****************************************************************************/
-void control_cleanup(void)
-{
- DeleteHash(&CfgNameHash);
-}
CTDL_MODULE_INIT(control)
{
if (!threading) {
CtdlRegisterProtoHook(cmd_gvdn, "GVDN", "get valid domain names");
CtdlRegisterProtoHook(cmd_conf, "CONF", "get/set system configuration");
- CtdlRegisterCleanupHook(control_cleanup);
-
}
/* return our id for the Log */
return "control";
/*
* This is a data store backend for the Citadel server which uses Berkeley DB.
*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 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.
syslog(LOG_INFO, "db: performing final checkpoint");
if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0))) {
- syslog(LOG_ERR, "txn_checkpoint: %s", db_strerror(ret));
+ syslog(LOG_ERR, "db: txn_checkpoint: %s", db_strerror(ret));
}
syslog(LOG_INFO, "db: flushing the database logs");
syslog(LOG_ERR, "db: log_flush: %s", db_strerror(ret));
}
-#ifdef DB_STAT_ALL
- /* print some statistics... */
- dbenv->lock_stat_print(dbenv, DB_STAT_ALL);
-#endif
-
/* close the tables */
syslog(LOG_INFO, "db: closing databases");
for (i = 0; i < MAXCDB; ++i) {
}
+ // This seemed nifty at the time but did anyone really look at it?
+ // #ifdef DB_STAT_ALL
+ // /* print some statistics... */
+ // dbenv->lock_stat_print(dbenv, DB_STAT_ALL);
+ // #endif
+
/* Close the handle. */
ret = dbenv->close(dbenv, 0);
if (ret) {
* room on a Citadel server. It handles iCalendar objects using the
* iTIP protocol. See RFCs 2445 and 2446.
*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 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.
}
-void serv_calendar_destroy(void) {
- icaltimezone_free_builtin_timezones();
-}
-
-
/*
* Register this module with the Citadel server.
*/
CtdlRegisterSessionHook(ical_session_shutdown, EVT_STOP, PRIO_STOP + 80);
CtdlRegisterFixedOutputHook("text/calendar", ical_fixed_output);
CtdlRegisterFixedOutputHook("application/ics", ical_fixed_output);
- CtdlRegisterCleanupHook(serv_calendar_destroy);
}
/* return our module name for the log */
}
-void noise_word_cleanup(void)
-{
- int i;
- noise_word *cur, *next;
-
- syslog(LOG_INFO, "wordbreaker: cleaning up fulltext noise words");
-
- for (i = 0 ; i < 26 ; i++)
- {
- cur = noise_words[i];
- while (cur)
- {
- next = cur->next;
- free(cur->word);
- free(cur);
- cur = next;
- }
- }
-}
-
/*
* Compare function
*/
/*
* This module handles fulltext indexing of the message base.
- * Copyright (c) 2005-2020 by the citadel.org team
+ * Copyright (c) 2005-2021 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 as published
CtdlRegisterProtoHook(cmd_srch, "SRCH", "Full text search");
CtdlRegisterDeleteHook(ft_delete_remove);
CtdlRegisterSearchFuncHook(ft_search, "fulltext");
- CtdlRegisterCleanupHook(noise_word_cleanup);
CtdlRegisterSessionHook(do_fulltext_indexing, EVT_TIMER, PRIO_CLEANUP + 300);
}
/* return our module name for the log */
/*
* IMAP server for the Citadel system
*
- * Copyright (C) 2000-2018 by Art Cancro and others.
+ * Copyright (C) 2000-2021 by Art Cancro and others.
* This code is released under the terms of the GNU General Public License.
*
* WARNING: the IMAP protocol is badly designed. No implementation of it
}
}
-void imap_cleanup(void)
-{
- DeleteHash(&ImapCmds);
-}
const imap_handler_hook *imap_lookup(int num_parms, ConstStr *Params)
{
NULL, imaps_greeting, imap_command_loop, NULL, CitadelServiceIMAPS);
#endif
CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP, PRIO_STOP + 30);
- CtdlRegisterCleanupHook(imap_cleanup);
}
/* return our module name for the log */
* wrote it as a module merely to keep things as clean and loosely coupled
* as possible.
*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 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.
/*****************************************************************************/
/* MODULE INITIALIZATION STUFF */
/*****************************************************************************/
-void cleanup_inetcfg(void)
-{
- char *buf;
- buf = inetcfg;
- inetcfg = NULL;
- if (buf != NULL) {
- free(buf);
- }
-}
CTDL_MODULE_INIT(inetcfg)
{
CtdlRegisterMessageHook(inetcfg_aftersave, EVT_AFTERSAVE);
inetcfg_init();
- CtdlRegisterCleanupHook(cleanup_inetcfg);
}
/* return our module name for the log */
/*
* This module handles network mail and mailing list processing.
*
- * Copyright (c) 2000-2019 by the citadel.org team
+ * Copyright (c) 2000-2021 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.
}
}
-void destroy_network_queue_room_locked (void)
-{
- begin_critical_section(S_RPLIST);
- destroy_network_queue_room(rplist);
- end_critical_section(S_RPLIST);
-}
-
/*
* network_do_queue()
if (!threading)
{
CtdlRegisterRoomHook(network_room_handler);
- CtdlRegisterCleanupHook(destroy_network_queue_room_locked);
CtdlRegisterSessionHook(network_do_queue, EVT_TIMER, PRIO_QUEUE + 10);
}
return "network";
}
-//
-// Cleanup hook for this module
-//
-void nntp_cleanup(void)
-{
- /* nothing here yet */
-}
-
-
//
// Implements the AUTHINFO USER command (RFC 4643)
//
CitadelServiceNNTPS);
#endif
- CtdlRegisterCleanupHook(nntp_cleanup);
CtdlRegisterSessionHook(nntp_cleanup_function, EVT_STOP, PRIO_STOP + 250);
}
* The VRFY and EXPN commands have been removed from this implementation
* because nobody uses these commands anymore, except for spammers.
*
- * Copyright (c) 1998-2020 by the citadel.org team
+ * Copyright (c) 1998-2021 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.
}
-void smtp_cleanup(void)
-{
- DeleteHash(&SMTPCmds);
-}
-
/*
* Here's where our SMTP session begins its happy day.
*/
NULL,
CitadelServiceSMTP_LMTP_UNF);
- CtdlRegisterCleanupHook(smtp_cleanup);
CtdlRegisterSessionHook(smtp_cleanup_function, EVT_STOP, PRIO_STOP + 250);
}
/*
* XMPP (Jabber) service for the Citadel system
- * Copyright (c) 2007-2019 by Art Cancro and citadel.org
+ * Copyright (c) 2007-2021 by Art Cancro and citadel.org
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
const char *CitadelServiceXMPP="XMPP";
-extern void xmpp_cleanup_events(void);
CTDL_MODULE_INIT(xmpp)
{
if (!threading) {
CtdlRegisterSessionHook(xmpp_logout_hook, EVT_LOGOUT, PRIO_LOGOUT + 90);
CtdlRegisterSessionHook(xmpp_login_hook, EVT_UNSTEALTH, PRIO_UNSTEALTH + 1);
CtdlRegisterSessionHook(xmpp_logout_hook, EVT_STEALTH, PRIO_STEALTH + 1);
- CtdlRegisterCleanupHook(xmpp_cleanup_events);
}
/*
* XMPP event queue
*
- * Copyright (c) 2007-2017 by Art Cancro
+ * Copyright (c) 2007-2021 by Art Cancro
*
* 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.
XMPP->last_event_processed = highest_event;
}
-
-
-void xmpp_cleanup_events(void)
-{
- struct xmpp_event *ptr, *ptr2;
- begin_critical_section(S_XMPP_QUEUE);
- ptr = xmpp_queue;
- xmpp_queue = NULL;
- while (ptr != NULL) {
- ptr2 = ptr->next;
- free(ptr);
- ptr = ptr2;
- }
- end_critical_section(S_XMPP_QUEUE);
-
-}
* Citadel Extension Loader
* Originally written by Brian Costello <btx@calyx.net>
*
- * Copyright (c) 1987-2020 by the citadel.org team
+ * Copyright (c) 1987-2021 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.
};
SearchFunctionHook *SearchFunctionHookTable = NULL;
-CleanupFunctionHook *CleanupHookTable = NULL;
-CleanupFunctionHook *EVCleanupHookTable = NULL;
-
ServiceFunctionHook *ServiceHookTable = NULL;
typedef struct ProtoFunctionHook ProtoFunctionHook;
}
-void CtdlRegisterCleanupHook(void (*fcn_ptr) (void))
-{
-
- CleanupFunctionHook *newfcn;
-
- newfcn = (CleanupFunctionHook *)
- malloc(sizeof(CleanupFunctionHook));
- newfcn->next = CleanupHookTable;
- newfcn->h_function_pointer = fcn_ptr;
- CleanupHookTable = newfcn;
-
- syslog(LOG_DEBUG, "extensions: registered a new cleanup function");
-}
-
-
-void CtdlUnregisterCleanupHook(void (*fcn_ptr) (void))
-{
- CleanupFunctionHook *cur, *p, *last;
- last = NULL;
- cur = CleanupHookTable;
- while (cur != NULL)
- {
- if (fcn_ptr == cur->h_function_pointer)
- {
- syslog(LOG_DEBUG, "extensions: unregistered cleanup function");
- p = cur->next;
-
- free(cur);
- cur = NULL;
-
- if (last != NULL)
- last->next = p;
- else
- CleanupHookTable = p;
- cur = p;
- }
- else {
- last = cur;
- cur = cur->next;
- }
- }
-}
-
-
-void CtdlRegisterEVCleanupHook(void (*fcn_ptr) (void))
-{
-
- CleanupFunctionHook *newfcn;
-
- newfcn = (CleanupFunctionHook *)
- malloc(sizeof(CleanupFunctionHook));
- newfcn->next = EVCleanupHookTable;
- newfcn->h_function_pointer = fcn_ptr;
- EVCleanupHookTable = newfcn;
-
- syslog(LOG_DEBUG, "extensions: registered a new cleanup function");
-}
-
-
-void CtdlUnregisterEVCleanupHook(void (*fcn_ptr) (void))
-{
- CleanupFunctionHook *cur, *p, *last;
- last = NULL;
- cur = EVCleanupHookTable;
- while (cur != NULL)
- {
- if (fcn_ptr == cur->h_function_pointer)
- {
- syslog(LOG_DEBUG, "extensions: unregistered cleanup function");
- p = cur->next;
-
- free(cur);
- cur = NULL;
-
- if (last != NULL)
- last->next = p;
- else
- EVCleanupHookTable = p;
- cur = p;
- }
- else {
- last = cur;
- cur = cur->next;
- }
- }
-}
-
-
void CtdlRegisterSessionHook(void (*fcn_ptr) (void), int EventType, int Priority)
{
SessionFunctionHook *newfcn;
};
extern ServiceFunctionHook *ServiceHookTable;
-typedef struct CleanupFunctionHook CleanupFunctionHook;
-struct CleanupFunctionHook {
- CleanupFunctionHook *next;
- void (*h_function_pointer) (void);
-};
-extern CleanupFunctionHook *CleanupHookTable;
-
void initialize_server_extensions(void);
int DLoader_Exec_Cmd(char *cmdbuf);
char *Dynamic_Module_Init(void);
/*
* Cleanup any contexts that are left lying around
*/
-
-
void close_masters (void)
{
struct ServiceFunctionHook *serviceptr;