" and disable the program that binds these ports.\n")};
-void LogPrintMessages(long err)
-{
+void LogPrintMessages(long err) {
StrBuf *Message;
StrBuf *List, *DetailList;
ConstStr *Short, *Where, *Hint;
}
-void AddPortError(char *Port, char *ErrorMessage)
-{
+void AddPortError(char *Port, char *ErrorMessage) {
long len;
DetailErrorFlags |= ERR_PORT;
}
-int DLoader_Exec_Cmd(char *cmdbuf)
-{
+int DLoader_Exec_Cmd(char *cmdbuf) {
void *vP;
ProtoFunctionHook *p;
}
-void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc)
-{
+void CtdlRegisterProtoHook(void (*handler) (char *), char *cmd, char *desc) {
ProtoFunctionHook *p;
if (ProtoHookList == NULL)
}
-void CtdlShutdownServiceHooks(void)
-{
- /* sort of a duplicate of close_masters() but called earlier */
+// During shutdown we can close all of the listening sockets.
+void CtdlShutdownServiceHooks(void) {
ServiceFunctionHook *cur;
cur = ServiceHookTable;
- while (cur != NULL)
- {
- if (cur->msock != -1)
- {
+ while (cur != NULL) {
+ if (cur->msock != -1) {
close(cur->msock);
cur->msock = -1;
if (cur->sockpath != NULL){
- syslog(LOG_INFO, "extensions: [%s] Closed UNIX domain socket %s", cur->ServiceName, cur->sockpath);
+ syslog(LOG_INFO, "extensions: [%s] closed unix domain socket %s", cur->ServiceName, cur->sockpath);
unlink(cur->sockpath);
} else {
syslog(LOG_INFO, "extensions: [%s] closing service", cur->ServiceName);
}
-void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name)
-{
+void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name) {
SearchFunctionHook *newfcn;
if (!name || !fcn_ptr) {
syslog(LOG_DEBUG, "extensions: registered a new search function (%s)", name);
}
-void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name)
-{
+
+void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name) {
SearchFunctionHook *cur, *p, *last;
last = NULL;
}
-void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name)
-{
+void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name) {
SearchFunctionHook *fcn = NULL;
for (fcn = SearchFunctionHookTable; fcn != NULL; fcn = fcn->next) {
}
-void PerformSessionHooks(int EventType)
-{
+void PerformSessionHooks(int EventType) {
SessionFunctionHook *fcn = NULL;
for (fcn = SessionHookTable; fcn != NULL; fcn = fcn->next) {
}
}
-void PerformUserHooks(ctdluser *usbuf, int EventType)
-{
+
+void PerformUserHooks(ctdluser *usbuf, int EventType) {
UserFunctionHook *fcn = NULL;
for (fcn = UserHookTable; fcn != NULL; fcn = fcn->next) {
}
}
-int PerformMessageHooks(struct CtdlMessage *msg, struct recptypes *recps, int EventType)
-{
+
+int PerformMessageHooks(struct CtdlMessage *msg, struct recptypes *recps, int EventType) {
MessageFunctionHook *fcn = NULL;
int total_retval = 0;
}
-int PerformRoomHooks(struct ctdlroom *target_room)
-{
+int PerformRoomHooks(struct ctdlroom *target_room) {
RoomFunctionHook *fcn;
int total_retval = 0;
}
-void PerformDeleteHooks(char *room, long msgnum)
-{
+void PerformDeleteHooks(char *room, long msgnum) {
DeleteFunctionHook *fcn;
for (fcn = DeleteHookTable; fcn != NULL; fcn = fcn->next) {
}
-int PerformXmsgHooks(char *sender, char *sender_email, char *recp, char *msg)
-{
+int PerformXmsgHooks(char *sender, char *sender_email, char *recp, char *msg) {
XmsgFunctionHook *fcn;
int total_sent = 0;
int p;
/*
- * Dirty hack until we impliment a hook mechanism for this
+ * "Start TLS" function that is (hopefully) adaptable for any protocol
*/
-void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response)
-{
+void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response) {
#ifdef HAVE_OPENSSL
CtdlStartTLS (ok_response, nosup_response, error_response);
#endif
}
-CTDL_MODULE_INIT(modules)
-{
- if (!threading) {
- }
+CTDL_MODULE_INIT(modules) {
return "modules";
}
}
-// Cleanup any contexts that are left lying around
-void close_masters(void) {
- struct ServiceFunctionHook *serviceptr;
- const char *Text;
-
- // close all protocol master sockets
- for (serviceptr = ServiceHookTable; serviceptr != NULL;
- serviceptr = serviceptr->next ) {
-
- if (serviceptr->tcp_port > 0) {
- if (serviceptr->msock == -1) {
- Text = "not closing again";
- }
- else {
- Text = "Closing";
- }
- syslog(LOG_INFO, "sysdep: %s %d listener on port %d",
- Text,
- serviceptr->msock,
- serviceptr->tcp_port
- );
- serviceptr->tcp_port = 0;
- }
-
- if (serviceptr->sockpath != NULL) {
- if (serviceptr->msock == -1) {
- Text = "not closing again";
- }
- else {
- Text = "Closing";
- }
- syslog(LOG_INFO, "sysdep: %s %d listener on '%s'",
- Text,
- serviceptr->msock,
- serviceptr->sockpath
- );
- }
-
- if (serviceptr->msock != -1) {
- close(serviceptr->msock);
- serviceptr->msock = -1;
- }
-
- // If it's a Unix domain socket, remove the file.
- if (serviceptr->sockpath != NULL) {
- unlink(serviceptr->sockpath);
- serviceptr->sockpath = NULL;
- }
- }
-}
-
-
// The system-dependent part of master_cleanup() - close the master socket.
void sysdep_master_cleanup(void) {
- close_masters();
context_cleanup();
}