ical_dezonify.o \
serv_ldap.o \
serv_autocompletion.o \
- serv_funambol.o
+ serv_funambol.o \
+ serv_test.o
UTIL_TARGETS=aidepost msgform \
citmail userlist sendcommand \
whobbs.c vcard.c serv_notes.c serv_fulltext.c ft_wordbreaker.c \
crc16.c journaling.c citadel_dirs.c imap_list.c imap_metadata.c
-DEP_FILES=$(SOURCES:.c=.d)
+DEP_FILES=$(SOURCES:.c=.d) modules_init.d
client: $(CLIENT_TARGETS)
parsedate.o: parsedate.c
+modules_init.c: mk_module_init.sh $(SOURCES)
+ $(srcdir)/mk_module_init.sh
+
SERV_OBJS = server_main.o \
user_ops.o citserver.o sysdep.o serv_extensions.o \
tools.o $(DATABASE:.c=.o) domain.o \
locate_host.o housekeeping.o mime_parser.o html.o \
internet_addressing.o journaling.o \
serv_crypto.o parsedate.o genstamp.o \
- clientsocket.o $(AUTH) $(SERV_MODULES)
+ clientsocket.o modules_init.o $(AUTH) $(SERV_MODULES)
citserver: $(SERV_OBJS)
$(CC) $(SERV_OBJS) $(LDFLAGS) $(SERVER_LDFLAGS) $(LIBS) $(SERVER_LIBS) $(RESOLV) -o citserver
done
clean:
- rm -f *.o
+ rm -f *.o
cleaner: clean
rm -rf $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) $(UTILBIN_TARGETS) database_cleanup.sh *.la
+ rm -rf modules_init.c modules_init.h
distclean: cleaner
find . -name '*~' -o -name '.#*' | xargs rm -f
#include <arpa/inet.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "config.h"
#include <stdarg.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
#endif
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "config.h"
struct config config;
#include "citadel.h"
#include "server.h"
#include "control.h"
-#include "serv_extensions.h"
#include "sysdep_decls.h"
#include "support.h"
#include "config.h"
#include <pthread.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "citserver.h"
#include "database.h"
#include "msgbase.h"
#include "sysdep_decls.h"
#include "config.h"
+#include "ctdl_module.h"
+
+
static DB *dbp[MAXCDB]; /* One DB handle for each Citadel database */
static DB_ENV *dbenv; /* The DB environment (global) */
#include <sys/stat.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "database.h"
#include "msgbase.h"
#include "support.h"
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "config.h"
#include "file_ops.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "database.h"
#include "msgbase.h"
#include "control.h"
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "control.h"
#include "sysdep_decls.h"
#include "support.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
--- /dev/null
+/* $Id:$ */
+
+#ifndef CTDL_MODULE_H
+#define CTDL_MODULE_H
+
+
+#include "server.h"
+#include "sysdep_decls.h"
+/*
+ * define macros for module init stuff
+ */
+
+
+#define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (void)
+
+#define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init ()
+
+void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
+void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
+
+void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
+void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
+
+void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
+void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
+
+void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
+ int EventType);
+void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
+ int EventType);
+
+void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
+void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
+
+void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
+void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
+
+void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
+void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
+
+void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
+void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
+
+void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
+void CtdlUnregisterProtoHook(void (*handler)(char *), char *cmd);
+
+void CtdlRegisterServiceHook(int tcp_port,
+ char *sockpath,
+ void (*h_greeting_function) (void),
+ void (*h_command_function) (void),
+ void (*h_async_function) (void)
+);
+void CtdlUnregisterServiceHook(int tcp_port,
+ char *sockpath,
+ void (*h_greeting_function) (void),
+ void (*h_command_function) (void),
+ void (*h_async_function) (void)
+);
+
+void CtdlRegisterFixedOutputHook(char *content_type,
+ void (*output_function) (char *supplied_data, int len)
+);
+void CtdlUnRegisterFixedOutputHook(char *content_type);
+
+#endif /* CTDL_MODULE_H */
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
/*
- * $Id: $
+ * $Id$
*
* Message journaling functions.
*
#include <sys/stat.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "database.h"
#include "msgbase.h"
#include "support.h"
#include <string.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "locate_host.h"
#include "sysdep_decls.h"
#include "config.h"
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "sysdep_decls.h"
#include "tools.h"
--- /dev/null
+#!/bin/sh
+#
+# Script to generate $C_FILE
+#
+
+
+
+CUR_DIR=`pwd`
+C_FILE="$CUR_DIR/modules_init.c"
+H_FILE="$CUR_DIR/modules_init.h"
+
+echo -e "Scanning extension modules for entry points."
+
+
+#start ofs the files which inturn removes any existing file
+#
+echo -e "/*" > $C_FILE
+echo -e " * $C_FILE" >> $C_FILE
+echo -e " * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE" >> $C_FILE
+echo -e " */\n\n\n" >> $C_FILE
+
+#echo -e "#include \"sysdep.h\"\n" >> $C_FILE
+echo -e "#include <stdlib.h>\n" >> $C_FILE
+#echo -e "#include <ctype.h>\n" >> $C_FILE
+#echo -e "#include \"citadel.h\"\n" >> $C_FILE
+echo -e "#include \"modules_init.h\"\n" >> $C_FILE
+echo -e "#include \"sysdep_decls.h\"\n" >> $C_FILE
+echo -e "\n\n\n" >> $C_FILE
+echo -e "void LogPrintMessages(long err);" >> $C_FILE
+echo -e "static long DetailErrorFlags;" >> $C_FILE
+echo -e "\n\n\n" >> $C_FILE
+
+echo -e "void initialise_modules (void)" >> $C_FILE
+echo -e "{" >> $C_FILE
+echo -e "\tlong filter;\n\n" >> $C_FILE
+echo -e -n "\t" >> $C_FILE
+echo -E "lprintf(CTDL_INFO, \"New citadel module init proceedure.\n\");" >> $C_FILE
+
+#start the header file
+echo -e "/*" > $H_FILE
+echo -e " * $H_FILE" >> $H_FILE
+echo -e " * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE" >> $H_FILE
+echo -e " */\n\n\n" >> $H_FILE
+echo -e "#ifndef MODULES_INIT_H" >> $H_FILE
+echo -e "#define MODULES_INIT_H\n" >> $H_FILE
+echo -e "#include \"ctdl_module.h\"\n" >> $H_FILE
+echo -e "void initialise_modules (void) ;\n" >> $H_FILE
+
+
+for i in serv_*.c
+do
+ RES=X`grep CTDL_MODULE_INIT $i | cut -f2 -d\( | cut -f1 -d\)`
+ if [ $RES != "X" ] ; then
+ RES_OUT=`echo $RES | cut -b2-`
+ echo -e "Found entry point in file $i"
+ echo -e -n "\t" >> $C_FILE
+ echo -E "lprintf (CTDL_INFO, \"%s\n\", CTDL_INIT_CALL($RES_OUT));" >> $C_FILE
+ echo -E "CTDL_MODULE_INIT($RES_OUT) ;" >> $H_FILE
+ fi
+done
+
+
+if [ -d "modules" ] ; then
+ cd modules
+ for j in *
+ do
+ if [ -d $j ] ; then
+ cd $j
+ for k in *.c
+ do
+ if [ -f "$k" ] ; then
+ RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
+ if [ $RES != "X" ] ; then
+ RES_OUT=`echo $RES | cut -b2-`
+ echo -e "Found entry point in file modules/$j/$k"
+ echo -n "\t" >> $C_FILE
+ echo -E "lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));" >> $C_FILE
+ echo -E "CTDL_MODULE_INIT($RES_OUT) ;" >> $H_FILE
+ fi
+ fi
+ done
+ fi
+ done
+fi
+
+cd $CUR_DIR
+
+if [ -d "user_modules" ] ; then
+ cd user_modules
+ for j in *
+ do
+ if [ -d $j ] ; then
+ cd $j
+ for k in *.c
+ do
+ if [ -f "$k" ] ; then
+ RES=X`grep CTDL_MODULE_INIT $k | cut -f2 -d\( | cut -f1 -d\)`
+ if [ $RES != "X" ] ; then
+ RES_OUT=`echo $RES | cut -b2-`
+ echo -e "Found entry point in file user_modules/$j/$k"
+ echo -n "\t" >> $C_FILE
+ echo -E "lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));" >> $C_FILE
+ echo -E "CTDL_MODULE_INIT($RES_OUT) ;" >> $H_FILE
+ fi
+ fi
+ done
+ fi
+ done
+fi
+
+cd $CUR_DIR
+
+echo -e "\n\n" >> $C_FILE
+echo -e "\tfor (filter = 1; filter != 0; filter = filter << 1)" >> $C_FILE
+echo -e "\t\tif ((filter & DetailErrorFlags) != 0)" >> $C_FILE
+echo -e "\t\t\tLogPrintMessages(filter);" >> $C_FILE
+echo -e "}" >> $C_FILE
+
+
+echo -e "\n#endif /* MODULES_INIT_H */" >> $H_FILE
#include "citadel.h"
#include "server.h"
#include "database.h"
-#include "serv_extensions.h"
#include "config.h"
#include "room_ops.h"
#include "sysdep_decls.h"
#include <errno.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "database.h"
#include "config.h"
#include "room_ops.h"
#include "tools.h"
#include "citadel_ipc.h"
#include "server.h"
-#include "serv_extensions.h"
#include "config.h"
#define LOCKFILE "/tmp/LCK.sendcommand"
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "serv_fulltext.h"
#include "serv_autocompletion.h"
+#include "ctdl_module.h"
+
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
}
-char *serv_autocompletion_init(void) {
+CTDL_MODULE_INIT(autocompletion) {
CtdlRegisterProtoHook(cmd_auto, "AUTO", "Do recipient autocompletion");
/* return our Subversion id for the Log */
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "tools.h"
#include "citadel_dirs.h"
-
+#include "ctdl_module.h"
/*
* enter user bio
-char *serv_bio_init(void)
+CTDL_MODULE_INIT(bio)
{
CtdlRegisterProtoHook(cmd_ebio, "EBIO", "Enter your bio");
CtdlRegisterProtoHook(cmd_rbio, "RBIO", "Read a user's bio");
#include "citadel.h"
#include "server.h"
#include "citserver.h"
-#include "sysdep_decls.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "user_ops.h"
#include "room_ops.h"
#include "tools.h"
#include "internet_addressing.h"
#include "serv_calendar.h"
#include "euidindex.h"
+#include "ctdl_module.h"
#ifdef CITADEL_WITH_CALENDAR_SERVICE
#include <ical.h>
#include "ical_dezonify.h"
+
+
struct ical_respond_data {
char desired_partnum[SIZ];
icalcomponent *cal;
/*
* Register this module with the Citadel server.
*/
-char *serv_calendar_init(void)
+CTDL_MODULE_INIT(calendar)
{
#ifdef CITADEL_WITH_CALENDAR_SERVICE
CtdlRegisterMessageHook(ical_obj_beforesave, EVT_BEFORESAVE);
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "serv_chat.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "snprintf.h"
#endif
+
+#include "ctdl_module.h"
+
+
+
struct ChatLine *ChatQueue = NULL;
int ChatLastMsg = 0;
-char *serv_chat_init(void)
+CTDL_MODULE_INIT(chat)
{
CtdlRegisterProtoHook(cmd_chat, "CHAT", "Begin real-time chat");
CtdlRegisterProtoHook(cmd_pexp, "PEXP", "Poll for instant messages");
#include "server.h"
#include "serv_crypto.h"
#include "sysdep_decls.h"
-#include "serv_extensions.h"
#include "citadel.h"
#include "config.h"
+#include "ctdl_module.h"
+/* TODO: should we use the standard module init stuff to start this? */
+/* TODO: should we register an event handler to call destruct_ssl? */
+
#ifdef HAVE_OPENSSL
SSL_CTX *ssl_ctx; /* SSL context */
pthread_mutex_t **SSLCritters; /* Things needing locking */
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "policy.h"
#include "database.h"
#include "tools.h"
+#include "ctdl_module.h"
+
+
struct PurgeList {
struct PurgeList *next;
char name[ROOMNAMELEN]; /* use the larger of username or roomname */
/*****************************************************************************/
-char *serv_expire_init(void)
+CTDL_MODULE_INIT(expire)
{
CtdlRegisterSessionHook(purge_databases, EVT_TIMER);
CtdlRegisterProtoHook(cmd_fsck, "FSCK", "Check message ref counts");
return 0;
}
+#if 0
void initialize_server_extensions(void)
{
long filter;
nSizErrmsg = 0;
- lprintf(CTDL_INFO, "%s\n", serv_bio_init());
+ /*lprintf(CTDL_INFO, "%s\n", serv_bio_init());
lprintf(CTDL_INFO, "%s\n", serv_calendar_init());
lprintf(CTDL_INFO, "%s\n", serv_notes_init());
lprintf(CTDL_INFO, "%s\n", serv_ldap_init());
lprintf(CTDL_INFO, "%s\n", serv_smtp_init());
lprintf(CTDL_INFO, "%s\n", serv_pop3_init());
lprintf(CTDL_INFO, "%s\n", serv_rwho_init());
- lprintf(CTDL_INFO, "%s\n", serv_spam_init());
+ lprintf(CTDL_INFO, "%s\n", serv_spam_init());*/
/* lprintf(CTDL_INFO, "%s\n", serv_test_init()); */
- lprintf(CTDL_INFO, "%s\n", serv_vandelay_init());
+ /*lprintf(CTDL_INFO, "%s\n", serv_vandelay_init());
lprintf(CTDL_INFO, "%s\n", serv_vcard_init());
lprintf(CTDL_INFO, "%s\n", serv_fulltext_init());
lprintf(CTDL_INFO, "%s\n", serv_autocompletion_init());
lprintf(CTDL_INFO, "%s\n", serv_postfix_tcpdict());
lprintf(CTDL_INFO, "%s\n", serv_sieve_init());
lprintf(CTDL_INFO, "%s\n", serv_managesieve_init());
- lprintf(CTDL_INFO, "%s\n", serv_funambol_init());
+ lprintf(CTDL_INFO, "%s\n", serv_funambol_init());*/
for (filter = 1; filter != 0; filter = filter << 1)
if ((filter & DetailErrorFlags) != 0)
LogPrintMessages(filter);
}
-
+#endif
void CtdlRegisterCleanupHook(void (*fcn_ptr) (void))
{
* We'll probably start moving these to a more sane location in the near
* future. For now, this just shuts up the compiler.
*/
-char *serv_bio_init(void);
-char *serv_calendar_init(void);
void serv_calendar_destroy(void);
-char *serv_notes_init(void);
-char *serv_ldap_init(void);
-char *serv_chat_init(void);
-char *serv_expire_init(void);
-char *serv_imap_init(void);
-char *serv_inetcfg_init(void);
-char *serv_listsub_init(void);
-char *serv_mrtg_init(void);
-char *serv_netfilter_init(void);
-char *serv_network_init(void);
-char *serv_newuser_init(void);
-char *serv_pas2_init(void);
-char *serv_pop3_init(void);
-char *serv_rwho_init(void);
-char *serv_smtp_init(void);
-char *serv_spam_init(void);
char *serv_test_init(void);
-char *serv_upgrade_init(void);
-char *serv_vandelay_init(void);
-char *serv_vcard_init(void);
-char *serv_fulltext_init(void);
-char *serv_autocompletion_init(void);
char *serv_postfix_tcpdict(void);
-char *serv_managesieve_init(void);
-char *serv_sieve_init(void);
-char *serv_funambol_init(void);
/*
*/
int DLoader_Exec_Cmd(char *cmdbuf);
char *Dynamic_Module_Init(void);
-void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType);
-void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
void CtdlDestroySessionHooks(void);
void PerformSessionHooks(int EventType);
-void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
-void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
void CtdlDestroyUserHooks(void);
void PerformUserHooks(struct ctdluser *usbuf, int EventType);
-void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
-void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *), int order);
int PerformXmsgHooks(char *, char *, char *);
void CtdlDestroyXmsgHooks(void);
-void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *),
- int EventType);
-void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *),
- int EventType);
void CtdlDestroyMessageHook(void);
int PerformMessageHooks(struct CtdlMessage *, int EventType);
-void CtdlRegisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
-void CtdlUnregisterNetprocHook(int (*handler)(struct CtdlMessage *, char *) );
void CtdlDestroyNetprocHooks(void);
int PerformNetprocHooks(struct CtdlMessage *, char *);
-void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
-void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
void CtdlDestroyRoomHooks(void);
int PerformRoomHooks(struct ctdlroom *);
-void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
-void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
void CtdlDestroyDeleteHooks(void);
void PerformDeleteHooks(char *, long);
-void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
-void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
void CtdlDestroyCleanupHooks(void);
-void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
-void CtdlUnregisterProtoHook(void (*handler)(char *), char *cmd);
+
void CtdlDestroyProtoHooks(void);
-void CtdlRegisterServiceHook(int tcp_port,
- char *sockpath,
- void (*h_greeting_function) (void),
- void (*h_command_function) (void),
- void (*h_async_function) (void)
-);
-void CtdlUnregisterServiceHook(int tcp_port,
- char *sockpath,
- void (*h_greeting_function) (void),
- void (*h_command_function) (void),
- void (*h_async_function) (void)
-);
+
void CtdlDestroyServiceHook(void);
-void CtdlRegisterFixedOutputHook(char *content_type,
- void (*output_function) (char *supplied_data, int len)
-);
-void CtdlUnRegisterFixedOutputHook(char *content_type);
void CtdlDestroyFixedOutputHooks(void);
int PerformFixedOutputHooks(char *, char *, int);
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "database.h"
#include "msgbase.h"
#include "control.h"
#include "ft_wordbreaker.h"
+#include "ctdl_module.h"
+
+
+
long ft_newhighest = 0L;
long *ft_newmsgs = NULL;
int ft_num_msgs = 0;
/*****************************************************************************/
-char *serv_fulltext_init(void)
+CTDL_MODULE_INIT(fulltext)
{
initialize_ft_cache();
CtdlRegisterProtoHook(cmd_srch, "SRCH", "Full text search");
#include <sys/socket.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "domain.h"
#include "clientsocket.h"
#include "serv_funambol.h"
+
+
+
+#include "ctdl_module.h"
+
+
/*
* Create the notify message queue
*/
-char *serv_funambol_init(void)
+CTDL_MODULE_INIT(funambol)
{
create_notify_queue();
CtdlRegisterSessionHook(do_notify_queue, EVT_TIMER);
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "serv_crypto.h"
#endif
+
+#include "ctdl_module.h"
+
+
/* imap_rename() uses this struct containing list of rooms to rename */
struct irl {
struct irl *next;
/*
* This function is called to register the IMAP extension with Citadel.
*/
-char *serv_imap_init(void)
+CTDL_MODULE_INIT(imap)
{
CtdlRegisterServiceHook(config.c_imap_port,
NULL, imap_greeting, imap_command_loop, NULL);
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "domain.h"
+#include "ctdl_module.h"
void inetcfg_setTo(struct CtdlMessage *msg) {
/*****************************************************************************/
-char *serv_inetcfg_init(void)
+CTDL_MODULE_INIT(inetcfg)
{
CtdlRegisterMessageHook(inetcfg_aftersave, EVT_AFTERSAVE);
inetcfg_init();
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "policy.h"
#include "database.h"
#include "vcard.h"
#include "tools.h"
+
+#include "ctdl_module.h"
+
+
+
#ifdef HAVE_LDAP
#include <ldap.h>
/*
* Initialize the LDAP connector module ... or don't, if we don't have LDAP.
*/
-char *serv_ldap_init(void)
+CTDL_MODULE_INIT(ldap)
{
#ifdef HAVE_LDAP
CtdlRegisterCleanupHook(serv_ldap_cleanup);
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#endif
+
+#include "ctdl_module.h"
+
+
/*
* Generate a randomizationalisticized token to use for authentication of
* a subscribe or unsubscribe request.
/*
* Module entry point
*/
-char *serv_listsub_init(void)
+CTDL_MODULE_INIT(listsub)
{
CtdlRegisterProtoHook(cmd_subs, "SUBS", "List subscribe/unsubscribe");
#include <arpa/inet.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "snprintf.h"
#endif
+
+#include "ctdl_module.h"
+
+
+
#ifdef HAVE_LIBSIEVE
#include "serv_sieve.h"
}
+#endif /* HAVE_LIBSIEVE */
-char *serv_managesieve_init(void)
+CTDL_MODULE_INIT(managesieve)
{
+#ifdef HAVE_LIBSIEVE
+
CtdlRegisterServiceHook(config.c_managesieve_port, /* MGSVE */
NULL,
managesieve_greeting,
managesieve_command_loop,
NULL);
- return "$Id$";
-}
-
#else /* HAVE_LIBSIEVE */
-char *serv_managesieve_init(void)
-{
lprintf(CTDL_INFO, "This server is missing libsieve. Managesieve protocol is disabled..\n");
+#endif /* HAVE_LIBSIEVE */
+
/* return our Subversion id for the Log */
return "$Id$";
}
-#endif /* HAVE_LIBSIEVE */
+
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "tools.h"
+#include "ctdl_module.h"
+
+
/*
* Other functions call this one to output data in MRTG format
*/
}
-char *serv_mrtg_init(void)
+CTDL_MODULE_INIT(mrtg)
{
CtdlRegisterProtoHook(cmd_mrtg, "MRTG", "Supply stats to MRTG");
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "serv_network.h"
#include "tools.h"
+
+#include "ctdl_module.h"
+
+
/*
* 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
}
-char *serv_netfilter_init(void)
+CTDL_MODULE_INIT(netfilter)
{
CtdlRegisterNetprocHook(filter_the_idiots);
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "snprintf.h"
#endif
+
+#include "ctdl_module.h"
+
+
+
/* Nonzero while we are doing network processing */
static int doing_queue = 0;
/*
* Module entry point
*/
-char *serv_network_init(void)
+CTDL_MODULE_INIT(network)
{
create_spool_dirs();
CtdlRegisterProtoHook(cmd_gnet, "GNET", "Get network config");
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "database.h"
#include "msgbase.h"
+
+#include "ctdl_module.h"
+
+
+
extern struct CitContext *ContextList;
}
-char *serv_newuser_init(void)
+CTDL_MODULE_INIT(newuser)
{
CtdlRegisterSessionHook(CopyNewUserGreetings, EVT_LOGIN);
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "msgbase.h"
#include "tools.h"
+#include "ctdl_module.h"
+
+
/*
* If we are in a "notes" view room, and the client has sent an RFC822
}
-char *serv_notes_init(void)
+CTDL_MODULE_INIT(notes)
{
CtdlRegisterMessageHook(serv_notes_beforesave, EVT_BEFORESAVE);
#include <ctype.h>
#include <string.h>
#include <errno.h>
-#include "sysdep_decls.h"
#include "citadel.h"
#include "server.h"
#include "citserver.h"
#include "support.h"
-#include "serv_extensions.h"
#include "user_ops.h"
#include "md5.h"
#include "tools.h"
+#include "ctdl_module.h"
+
+
void cmd_pas2(char *argbuf)
{
char pw[256];
-char *serv_pas2_init(void)
+CTDL_MODULE_INIT(pas2)
{
CtdlRegisterProtoHook(cmd_pas2, "PAS2", "APOP-based login");
#include <ctype.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#endif
+#include "ctdl_module.h"
+
+
/*
* This cleanup function blows away the temporary memory and files used by
-char *serv_pop3_init(void)
+CTDL_MODULE_INIT(pop3)
{
CtdlRegisterServiceHook(config.c_pop3_port,
NULL,
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "tools.h"
+#include "ctdl_module.h"
+
/*
* display who's online
-char *serv_rwho_init(void)
+CTDL_MODULE_INIT(rwho)
{
CtdlRegisterProtoHook(cmd_rwho, "RWHO", "Display who is online");
CtdlRegisterProtoHook(cmd_hchg, "HCHG", "Masquerade hostname");
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "policy.h"
#include "database.h"
#include "internet_addressing.h"
#include "tools.h"
+
+#include "ctdl_module.h"
+
+
#ifdef HAVE_LIBSIEVE
#include "serv_sieve.h"
return 0;
}
+#endif /* HAVE_LIBSIEVE */
-char *serv_sieve_init(void)
+CTDL_MODULE_INIT(sieve)
{
+
+#ifdef HAVE_LIBSIEVE
+
ctdl_sieve_init();
CtdlRegisterProtoHook(cmd_msiv, "MSIV", "Manage Sieve scripts");
CtdlRegisterSessionHook(perform_sieve_processing, EVT_HOUSE);
- /* return our Subversion id for the Log */
- return "$Id$";
-}
-
#else /* HAVE_LIBSIEVE */
-char *serv_sieve_init(void)
-{
lprintf(CTDL_INFO, "This server is missing libsieve. Mailbox filtering will be disabled.\n");
- /* return our Subversion id for the Log */
+#endif /* HAVE_LIBSIEVE */
+
+ /* return our Subversion id for the Log */
return "$Id$";
}
-#endif /* HAVE_LIBSIEVE */
#include <arpa/inet.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "snprintf.h"
#endif
+
+#include "ctdl_module.h"
+
+
+
struct citsmtp { /* Information about the current session */
int command_state;
char helo_node[SIZ];
-char *serv_smtp_init(void)
+CTDL_MODULE_INIT(smtp)
{
CtdlRegisterServiceHook(config.c_smtp_port, /* SMTP MTA */
#include <sys/socket.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "clientsocket.h"
+#include "ctdl_module.h"
+
+
/*
* Connect to the SpamAssassin server and scan a message.
-char *serv_spam_init(void)
+CTDL_MODULE_INIT(spam)
{
CtdlRegisterMessageHook(spam_assassin, EVT_SMTPSCAN);
#include <sys/wait.h>
#include <string.h>
#include <limits.h>
-#include "citadel.h"
-#include "server.h"
-#include "sysdep_decls.h"
-#include "citserver.h"
-#include "support.h"
-#include "config.h"
-#include "serv_extensions.h"
-#include "room_ops.h"
-#include "policy.h"
-#include "database.h"
-#include "msgbase.h"
+#include "ctdl_module.h"
extern struct CitContext *ContextList;
lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
}
-char *serv_test_init(void)
+/* To insert this module into the server activate the next block by changing the #if 0 to #if 1 */
+CTDL_MODULE_INIT(test)
{
+#if 0
CtdlRegisterCleanupHook(CleanupTest);
CtdlRegisterSessionHook(NewRoomTest, EVT_NEWROOM);
CtdlRegisterSessionHook(SessionStartTest, EVT_START);
CtdlRegisterSessionHook(SessionStopTest, EVT_STOP);
CtdlRegisterSessionHook(LoginTest, EVT_LOGIN);
+#endif
/* return our Subversion id for the Log */
return "$Id$";
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "database.h"
#include "room_ops.h"
#include "user_ops.h"
#include "euidindex.h"
+#include "ctdl_module.h"
+
/*
* Back end processing function for cmd_bmbx
}
-char *serv_upgrade_init(void)
+CTDL_MODULE_INIT(upgrade)
{
check_server_upgrades();
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "database.h"
#include "msgbase.h"
#include "tools.h"
#include "control.h"
#include "euidindex.h"
+
+#include "ctdl_module.h"
+
+
+
+
#define END_OF_MESSAGE "---eom---dbd---"
char artv_tempfilename1[PATH_MAX];
-char *serv_vandelay_init(void)
+CTDL_MODULE_INIT(vandelay)
{
CtdlRegisterProtoHook(cmd_artv, "ARTV", "import/export data store");
#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "control.h"
-#include "serv_extensions.h"
#include "room_ops.h"
#include "user_ops.h"
#include "policy.h"
#include "serv_ldap.h"
#include "serv_vcard.h"
+
+#include "ctdl_module.h"
+
+
+
/*
* set global flag calling for an aide to validate new users
*/
}
-char *serv_postfix_tcpdict(void)
-{
- CtdlRegisterServiceHook(config.c_pftcpdict_port, /* Postfix */
- NULL,
- check_get_greeting,
- check_get,
- NULL);
- return "$Id$";
-}
-
-char *serv_vcard_init(void)
+CTDL_MODULE_INIT(vcard)
{
struct ctdlroom qr;
char filename[256];
chown(filename, CTDLUID, (-1));
}
+ /* for postfix tcpdict */
+ CtdlRegisterServiceHook(config.c_pftcpdict_port, /* Postfix */
+ NULL,
+ check_get_greeting,
+ check_get,
+ NULL);
+
/* return our Subversion id for the Log */
return "$Id$";
}
#include "tools.h"
#include "citadel_dirs.c"
+#include "modules_init.h"
+
+
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
*/
lprintf(CTDL_INFO, "Initializing server extensions\n");
size = strlen(ctdl_home_directory) + 9;
+
+/*
initialize_server_extensions();
+*/
+
+ initialise_modules();
+
+
/*
* If we need host auth, start our chkpwd daemon.
#endif
#include "citadel.h"
#include "server.h"
-#include "serv_extensions.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
/* $Id$ */
+#ifndef SYSDEP_DECLS_H
+#define SYSDEP_DECLS_H
/*
* Uncomment this #define if you are a Citadel developer tracking
#include "sysdep.h"
#include "server.h"
+
/* Logging levels - correspond to syslog(3) */
enum LogLevel {
/* When about to exit the server for an unrecoverable error */
void create_maintenance_threads(void);
extern pthread_t indexer_thread_tid;
extern pthread_t checkpoint_thread_tid;
+
+#endif /* SYSDEP_DECLS_H */
--- /dev/null
+SYSTEM TESTING PROPOSAL
+
+This document is intended as a discussion of possible automated tests. It does
+not describe any existing tests.
+
+
+---
+
+
+First we should create a client that leverages expect (or something similar) to
+perform automated testing of the client interface. Tests can be written as
+expect scripts.
+
+Each system being tested will need to create an aide level user for the test
+client to connect as.
+
+The test client will create another user to carry out the tests. This allows the
+aide level user to vary the level of the test user and check the access level
+code.
+
+----
+
+
+For a first step each test site should create a test user that can send internet
+mail.
+This test user needs some sieve rules to forward mail around (eventually this
+will be created automatically by the test client). These rules will forward mail
+to other test users at other sites participating in the test system and to a
+networked room.
+Each system participating in the test should share some rooms.
+
+The idea is:
+ 1. A test site posts a message to its test user using citmail or some
+other email prog.
+ 2. The sieve rules forward the message to each of the other test users
+at the other sites.
+ 3. The sieve rules for the other test users detect that the message was
+forwarded to them and they file it into a networked room
+ 4. By virtue of the networked room the message returns to the
+originating system where the administrator can see it.
+
+Once I (davew) have written my module to alter the message body we can have it
+add text to the message to indicate the full path of the message.
+
+
#include "server.h"
#include "database.h"
#include "user_ops.h"
-#include "serv_extensions.h"
#include "sysdep_decls.h"
#include "support.h"
#include "room_ops.h"