$Log$
+ Revision 580.31 2001/09/06 01:26:39 nbryant
+ - port to Cygwin (DLL support, etc.)
+ - don't build SMTP module if there's no resolver library (eg on Windows)
+
Revision 580.30 2001/09/06 00:54:01 nbryant
updated to libtool 1.4.1 and automake 1.5
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
EXEEXT=@EXEEXT@
CX=@CX@
+SMTP=@SMTP@
+
CLIENT_TARGETS=citadel$(EXEEXT) whobbs$(EXEEXT)
-SERVER_TARGETS=citserver setup $(CHKPWD)
-SERV_MODULES=modules/serv_chat.la modules/serv_vcard.la \
- modules/serv_upgrade.la \
- modules/serv_smtp.la \
- modules/serv_pop3.la \
- modules/serv_imap.la \
- modules/serv_network.la \
- modules/serv_pas2.la \
- modules/serv_inetcfg.la \
- modules/serv_rwho.la \
- modules/serv_moderate.la \
- modules/serv_bio.la \
- modules/serv_expire.la \
- modules/serv_vandelay.la \
- modules/serv_ical.la
+SERVER_TARGETS=libcitserver.la citserver setup $(CHKPWD)
+SERV_MODULES=modules/libchat.la modules/libvcard.la \
+ modules/libupgrade.la \
+ $(SMTP) \
+ modules/libpop3.la \
+ modules/libimap.la \
+ modules/libnetwork.la \
+ modules/libpas2.la \
+ modules/libinetcfg.la \
+ modules/librwho.la \
+ modules/libmoderate.la \
+ modules/libbio.la \
+ modules/libexpire.la \
+ modules/libvandelay.la \
+ modules/libical.la
UTIL_TARGETS=aidepost netmailer netproc netsetup msgform readlog rcit \
stats citmail netpoll mailinglist userlist sendcommand \
base64 qpdecode
DATABASE=@DATABASE@
LIBTOOL=./libtool
-LTSHARE=$(LIBTOOL) $(CC) -rpath $(prefix)/modules -module -avoid-version
+LTSHARE=cd modules && ../$(LIBTOOL) $(CC) -rpath $(prefix)/modules -no-undefined -avoid-version -module
# End configuration section
VPATH=$(srcdir)
+DOMAIN=@DOMAIN@
+
SOURCES=aidepost.c citadel.c citmail.c citserver.c client_chat.c commands.c \
config.c control.c $(DATABASE) dynloader.c file_ops.c \
housekeeping.c internetmail.c ipc_c_tcp.c locate_host.c \
whobbs.c sendcommand.c mime_parser.c base64.c qpdecode.c getutline.c \
auth.c chkpwd.c html.c vcard.c serv_upgrade.c serv_vandelay.c \
serv_smtp.c serv_pop3.c internet_addressing.c parsedate.c genstamp.c \
- domain.c clientsocket.c serv_inetcfg.c serv_rwho.c serv_bio.c \
+ $(DOMAIN) clientsocket.c serv_inetcfg.c serv_rwho.c serv_bio.c \
serv_moderate.c client_passwords.c imap_misc.c \
serv_imap.c imap_tools.c imap_fetch.c imap_search.c imap_store.c \
- serv_network.c serv_pas2.c serv_ical.c md5.c
+ serv_network.c serv_pas2.c serv_ical.c md5.c server_main.c
DEP_FILES=$(SOURCES:.c=.d)
serv_modules: $(SERV_MODULES)
@cd modules && mods=`echo .libs/*.s[ol]` && test "$$mods" != '.libs/*.s[ol]' && ln -sf $$mods . || true
+ @cd modules && mods=`echo .libs/*.dll` && test "$$mods" != '.libs/*.dll' && ln -sf $$mods . || true
#
#
#
#
-SERV_OBJS = citserver.ro user_ops.ro support.ro room_ops.ro file_ops.ro \
- msgbase.ro config.ro sysdep.ro locate_host.ro housekeeping.ro \
- $(DATABASE:.c=.ro) control.ro logging.ro policy.ro dynloader.ro tools.ro \
- mime_parser.ro html.ro internet_addressing.ro \
- parsedate.ro genstamp.ro clientsocket.ro \
- $(AUTH) $(LIBOBJS:.o=.ro)
+SERV_OBJS = server_main.ro
parsedate.ro: parsedate.c
-citserver: $(SERV_OBJS) $(LIBTOOL)
- $(LIBTOOL) --mode=link $(CC) -export-dynamic $(SERV_OBJS) $(LDFLAGS) $(PTHREAD_LIBS) \
- $(LIBS) $(NETLIBS) $(GDBM) $(RESOLV) -o citserver
+LIBSERV_OBJS = user_ops.lo citserver.lo sysdep.lo dynloader.lo tools.lo $(DATABASE:.c=.lo) \
+ control.lo policy.lo config.lo support.lo room_ops.lo file_ops.lo msgbase.lo \
+ locate_host.lo housekeeping.lo logging.lo mime_parser.lo html.lo internet_addressing.lo \
+ parsedate.lo genstamp.lo clientsocket.lo $(AUTH) $(LIBOBJS:.o=.lo)
+
+libcitserver.la: $(LIBSERV_OBJS)
+ $(LIBTOOL) $(CC) -rpath $(prefix) -no-undefined -avoid-version \
+ -o libcitserver.la $(LIBSERV_OBJS) $(GDBM)
+
+citserver: $(SERV_OBJS) $(LIBTOOL) libcitserver.la
+ $(LIBTOOL) --mode=link $(CC) $(SERV_OBJS) $(LDFLAGS) $(PTHREAD_LIBS) \
+ $(LIBS) $(NETLIBS) $(RESOLV) libcitserver.la -o citserver
.c.ro:
$(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(PTHREAD_DEFS) -c $< -o $@
@test -d modules || mkdir -p modules
$(LIBTOOL) --mode=compile $(CC) $(CFLAGS) $(CPPFLAGS) $(DEFS) $(PTHREAD_DEFS) -c $< -o $@
-modules/serv_chat.la: serv_chat.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_chat.la serv_chat.lo
+modules/libchat.la: serv_chat.lo libcitserver.la $(LIBTOOL)
+ $(LTSHARE) -o libchat.la ../serv_chat.lo ../libcitserver.la
-modules/serv_test.la: serv_test.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_test.la serv_test.lo
+modules/libtest.la: serv_test.lo libcitserver.la $(LIBTOOL)
+ $(LTSHARE) -o libtest.la ../serv_test.lo ../libcitserver.la
-modules/serv_pop3.la: serv_pop3.lo md5.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_pop3.la serv_pop3.lo md5.lo
+modules/libpop3.la: serv_pop3.lo md5.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libpop3.la ../serv_pop3.lo ../md5.lo ../libcitserver.la
-modules/serv_inetcfg.la: serv_inetcfg.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_inetcfg.la serv_inetcfg.lo
+modules/libinetcfg.la: serv_inetcfg.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libinetcfg.la ../serv_inetcfg.lo ../libcitserver.la
-modules/serv_rwho.la: serv_rwho.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_rwho.la serv_rwho.lo
+modules/librwho.la: serv_rwho.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o librwho.la ../serv_rwho.lo ../libcitserver.la
-modules/serv_moderate.la: serv_moderate.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_moderate.la serv_moderate.lo
+modules/libmoderate.la: serv_moderate.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libmoderate.la ../serv_moderate.lo ../libcitserver.la
-modules/serv_bio.la: serv_bio.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_bio.la serv_bio.lo
+modules/libbio.la: serv_bio.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libbio.la ../serv_bio.lo ../libcitserver.la
-modules/serv_expire.la: serv_expire.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_expire.la serv_expire.lo
+modules/libexpire.la: serv_expire.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libexpire.la ../serv_expire.lo ../libcitserver.la
-modules/serv_vandelay.la: serv_vandelay.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_vandelay.la serv_vandelay.lo
+modules/libvandelay.la: serv_vandelay.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libvandelay.la ../serv_vandelay.lo ../libcitserver.la
-modules/serv_network.la: serv_network.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_network.la serv_network.lo
+modules/libnetwork.la: serv_network.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libnetwork.la ../serv_network.lo ../libcitserver.la
-modules/serv_upgrade.la: serv_upgrade.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_upgrade.la serv_upgrade.lo
+modules/libupgrade.la: serv_upgrade.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libupgrade.la ../serv_upgrade.lo ../libcitserver.la
-modules/serv_vcard.la: serv_vcard.lo vcard.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_vcard.la serv_vcard.lo vcard.lo
+modules/libvcard.la: serv_vcard.lo vcard.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libvcard.la ../serv_vcard.lo ../vcard.lo ../libcitserver.la
-modules/serv_smtp.la: serv_smtp.lo domain.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_smtp.la serv_smtp.lo domain.lo
+modules/libsmtp.la: serv_smtp.lo domain.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libsmtp.la ../serv_smtp.lo ../domain.lo ../libcitserver.la
-modules/serv_imap.la: serv_imap.lo imap_tools.lo imap_fetch.lo \
- imap_search.lo imap_store.lo imap_misc.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_imap.la imap_tools.lo serv_imap.lo \
- imap_fetch.lo imap_search.lo imap_store.lo imap_misc.lo
-aidepost: aidepost.o config.o $(LIBOBJS)
- $(CC) aidepost.o config.o $(LIBOBJS) $(LDFLAGS) -o aidepost
+modules/libimap.la: serv_imap.lo imap_tools.lo imap_fetch.lo \
+ imap_search.lo imap_store.lo imap_misc.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libimap.la ../imap_tools.lo ../serv_imap.lo \
+ ../imap_fetch.lo ../imap_search.lo ../imap_store.lo ../imap_misc.lo ../libcitserver.la
-modules/serv_pas2.la: serv_pas2.lo md5.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_pas2.la serv_pas2.lo md5.lo
+aidepost: aidepost.o libcitserver.la $(LIBOBJS)
+ $(LIBTOOL) $(CC) aidepost.o libcitserver.la $(LIBOBJS) $(LDFLAGS) -o aidepost
-modules/serv_ical.la: serv_ical.lo $(LIBTOOL)
- $(LTSHARE) -o modules/serv_ical.la serv_ical.lo
+modules/libpas2.la: serv_pas2.lo md5.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libpas2.la ../serv_pas2.lo ../md5.lo ../libcitserver.la
+
+modules/libical.la: serv_ical.lo $(LIBTOOL) libcitserver.la
+ $(LTSHARE) -o libical.la ../serv_ical.lo ../libcitserver.la
whobbs$(EXEEXT): whobbs.o ipc_c_tcp.o tools.o $(LIBOBJS)
$(CC) whobbs.o ipc_c_tcp.o tools.o $(LIBOBJS) $(LDFLAGS) -o whobbs $(NETLIBS)
-sendcommand: sendcommand.o ipc_c_tcp.o tools.o config.o $(LIBOBJS)
- $(CC) sendcommand.o ipc_c_tcp.o tools.o config.o \
+sendcommand: sendcommand.o ipc_c_tcp.o libcitserver.la $(LIBOBJS)
+ $(LIBTOOL) $(CC) sendcommand.o ipc_c_tcp.o libcitserver.la \
$(LIBOBJS) $(LDFLAGS) -o sendcommand $(NETLIBS)
qpdecode: qpdecode.o
rcit: rcit.o config.o
$(CC) rcit.o config.o $(LDFLAGS) -o rcit
-stats: stats.o ipc_c_tcp.o tools.o config.o $(LIBOBJS)
- $(CC) stats.o ipc_c_tcp.o tools.o config.o $(LIBOBJS) $(LDFLAGS) -o stats $(NETLIBS)
+stats: stats.o ipc_c_tcp.o libcitserver.la $(LIBOBJS)
+ $(LIBTOOL) $(CC) stats.o ipc_c_tcp.o libcitserver.la $(LIBOBJS) $(LDFLAGS) -o stats $(NETLIBS)
.PHONY: install-data install-doc install-exec clean cleaner distclean
@for i in bio bitbucket files images info modules userpics; do \
$(srcdir)/mkinstalldirs $(root)$(prefix)/$$i; \
done
- @for i in $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS) \
- $(SERV_MODULES) ; do \
+ @for i in $(CLIENT_TARGETS) $(SERVER_TARGETS) $(UTIL_TARGETS); do \
if test -f $$i; then \
echo $(LIBTOOL) --mode=install $(INSTALL) $$i $(root)$(prefix)/$$i; \
$(LIBTOOL) --mode=install $(INSTALL) $$i $(root)$(prefix)/$$i; \
fi \
done
+ @for i in $(SERV_MODULES) ; do \
+ if test -f $$i; then \
+ (cd modules && ../$(LIBTOOL) --mode=install $(INSTALL) `basename $$i` $(root)$(prefix)/$$i) ; \
+ fi \
+ done
@for i in utilsmenu weekly dnetsetup; do \
if test -f $(srcdir)/$$i; then \
echo $(INSTALL) $(srcdir)/$$i $(root)$(prefix)/$$i; \
.c.d:
@echo Checking dependencies for $<
- @$(CC) -M $(CPPFLAGS) $(PTHREAD_DEFS) $< | sed -e 's!$*.o!$*.o $*.ro $*.mo $@!' > $@
+ @$(CC) -M $(CPPFLAGS) $(PTHREAD_DEFS) $< | sed -e 's!$*.o!$*.o $*.ro $*.lo $@!' > $@
@test -s $@ || rm -f $@
Makefile: $(srcdir)/Makefile.in config.status
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#if defined(__linux) || defined(__sun) /* needed for crypt(): */
#define _XOPEN_SOURCE
#define _XOPEN_SOURCE_EXTENDED 1
*/
/* system customizations are in sysconfig.h */
+
+#ifndef CITADEL_H
+#define CITADEL_H
+
#include "sysdep.h"
#include "sysconfig.h"
#include "ipcdef.h"
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
#endif
+
+#endif /* CITADEL_H */
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "config.h"
#include "locate_host.h"
#include "room_ops.h"
#include "file_ops.h"
-#include "dynloader.h"
#include "policy.h"
#include "control.h"
#include "tools.h"
/* $Id$ */
+
+#include "dynloader.h"
+
void master_startup (void);
void master_cleanup (void);
void RemoveContext (struct CitContext *);
void GenerateRoomDisplay(char *real_room,
struct CitContext *viewed,
struct CitContext *viewer);
-extern int do_defrag;
+extern DLEXP int do_defrag;
char CtdlCheckExpress(void);
int CtdlAccessCheck(int);
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <stdarg.h>
#include "citadel.h"
+#include "server.h"
+#include "dynloader.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
#endif
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
#include <limits.h>
#include "citadel.h"
+#include "server.h"
+#include "dynloader.h"
#include "config.h"
struct config config;
perror("citadel.config");
exit(1);
}
+#ifndef __CYGWIN__
if (st.st_uid != BBSUID || st.st_mode != (S_IFREG | S_IRUSR | S_IWUSR)) {
fprintf(stderr, "check the permissions on citadel.config\n");
exit(1);
}
+#endif
fclose(cfp);
if (config.c_setup_level < REV_MIN) {
*
*/
+#include "dynloader.h"
+
void get_config(void);
void put_config(void);
-extern struct config config;
-extern char bbs_home_directory[PATH_MAX];
-extern int home_specified;
+extern DLEXP struct config config;
+extern DLEXP char bbs_home_directory[PATH_MAX];
+extern DLEXP int home_specified;
esac
fi
AC_LIBTOOL_DLOPEN
+AC_LIBTOOL_WIN32_DLL
AC_DISABLE_STATIC
AC_PROG_LIBTOOL
AC_SUBST(LIBTOOL_DEPS)
AC_DEFINE(ENABLE_CHKPWD)
CHKPWD=chkpwd
else
- AUTH=auth.ro
+ AUTH=auth.lo
fi
fi
fi
test "$db_dir" && CPPFLAGS="$CPPFLAGS -I$db_dir/include"
AC_CHECK_HEADERS(curses.h dl.h fcntl.h limits.h termios.h sys/ioctl.h sys/select.h sys/time.h syslog.h unistd.h utmp.h utmpx.h paths.h)
+AC_CHECK_HEADER(resolv.h, [SMTP=modules/libsmtp.la; DOMAIN=domain.c])
+AC_SUBST(SMTP)
+AC_SUBST(DOMAIN)
+
dnl some systems require -pthread, -D_REENTRANT, etc to be passed to cc if we
dnl include pthread.h:
save_CPPFLAGS=$CPPFLAGS
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include "citadel.h"
#include "server.h"
#include "control.h"
+#include "dynloader.h"
#include "sysdep_decls.h"
#include "support.h"
#include "config.h"
* conditions to occur. (Deadlock is bad. Eliminate.)
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
/*****************************************************************************/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "citserver.h"
#include "database.h"
#include "sysdep_decls.h"
-#include "dynloader.h"
static DB *dbp[MAXCDB]; /* One DB handle for each Citadel database */
static DB_ENV *dbenv; /* The DB environment (global) */
#include <unistd.h>
#include <string.h>
#include <netinet/in.h>
+#include <stdio.h>
#include <arpa/nameser.h>
#include <resolv.h>
#include "sysdep_decls.h"
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdio.h>
#include <stdlib.h>
while ((dptr = readdir(dir)) != NULL) {
if (strlen(dptr->d_name) < 4)
continue;
+#ifndef __CYGWIN__
if (strcasecmp(&dptr->d_name[strlen(dptr->d_name)-3], ".so"))
+#else
+ if (strcasecmp(&dptr->d_name[strlen(dptr->d_name)-4], ".dll"))
+#endif
continue;
snprintf(pathbuf, PATH_MAX, "%s/%s", pathname, dptr->d_name);
/* $Id$ */
+#ifndef DYNLOADER_H
+#define DYNLOADER_H
+
+#include "server.h"
+
void DLoader_Init(char *pathname);
int DLoader_Exec_Cmd(char *cmdbuf);
char *Dynamic_Module_Init(void);
void (*h_greeting_function) (void),
void (*h_command_function) (void) ) ;
+#endif /* DYNLOADER_H */
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "config.h"
#include "file_ops.h"
#include "sysdep_decls.h"
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#ifdef HAVE_UTMP_H
#include <stdio.h>
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include "tools.h"
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "citserver.h"
#include "config.h"
#include "housekeeping.h"
#include "sysdep_decls.h"
#include "room_ops.h"
#include "database.h"
-#include "dynloader.h"
* Functions which handle translation between HTML and plain text
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <syslog.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "control.h"
#include "sysdep_decls.h"
#include "support.h"
* to users on the Citadel system.
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
*
*/
+#include "server.h"
+
struct internet_address_list {
struct internet_address_list *next;
char ial_user[SIZ];
hostalias_gatewaydomain
};
-extern char *inetcfg;
+extern DLEXP char *inetcfg;
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "locate_host.h"
#include "sysdep_decls.h"
#include "config.h"
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/stat.h>
#include <errno.h>
#include "citadel.h"
+#include "server.h"
+#include "dynloader.h"
#include "sysdep_decls.h"
#include "mime_parser.h"
#include "tools.h"
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "database.h"
#include "msgbase.h"
#include "support.h"
#include "user_ops.h"
#include "file_ops.h"
#include "control.h"
-#include "dynloader.h"
#include "tools.h"
#include "mime_parser.h"
#include "html.h"
/* SUPPRESS 593 on yynewstate *//* Label was not used */
/* SUPPRESS 595 on yypvt *//* Automatic variable may be used before set */
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdio.h>
* Functions which manage policy for rooms (such as message expiry)
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include "citadel.h"
#include "server.h"
#include "database.h"
+#include "dynloader.h"
#include "config.h"
#include "room_ops.h"
#include "sysdep_decls.h"
* Server functions which perform operations on room objects.
*
*/
+
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "database.h"
#include "config.h"
#include "room_ops.h"
#include "citadel.h"
#include "tools.h"
#include "ipc.h"
+#include "server.h"
+#include "dynloader.h"
#include "config.h"
#define LOCKFILE "/tmp/LCK.sendcommand"
-struct config config;
-extern int home_specified;
-
-
/*
* make sure only one copy of sendcommand runs at a time, using lock files
*/
#include <limits.h>
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include <syslog.h>
#include "serv_chat.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "dynloader.h"
#include "tools.h"
#include "msgbase.h"
#include "user_ops.h"
struct ChatLine *ChatQueue = NULL;
int ChatLastMsg = 0;
-extern struct CitContext *ContextList;
/*
* New format for a message in memory
*/
+
+#ifndef SERVER_H
+#define SERVER_H
+
+#ifdef __CYGWIN__
+
+#ifdef IN_LIBCIT
+#define DLEXP __declspec(dllexport)
+#else
+#define DLEXP __declspec(dllimport)
+#endif
+
+#else
+#define DLEXP
+
+#endif /* __CYGWIN__ */
+
+#include "citadel.h"
+
#define CTDLMESSAGE_MAGIC 0x159d
struct CtdlMessage {
int cm_magic; /* Self-check */
struct CitContext *MyContext(void);
#define CC ((struct CitContext *)MyContext())
-extern struct CitContext *ContextList;
-extern int ScheduledShutdown;
-extern struct CitControl CitControl;
+extern DLEXP struct CitContext *ContextList;
+extern DLEXP int ScheduledShutdown;
+extern DLEXP struct CitControl CitControl;
struct ExpressMessage {
int loglevel;
void (*h_function_pointer) (char *);
};
-extern struct LogFunctionHook *LogHookTable;
+extern DLEXP struct LogFunctionHook *LogHookTable;
struct CleanupFunctionHook {
struct CleanupFunctionHook *next;
void (*h_function_pointer) (void);
};
-extern struct CleanupFunctionHook *CleanupHookTable;
+extern DLEXP struct CleanupFunctionHook *CleanupHookTable;
void (*h_function_pointer) (void);
int eventtype;
};
-extern struct SessionFunctionHook *SessionHookTable;
+extern DLEXP struct SessionFunctionHook *SessionHookTable;
/*
* Event types can't be enum'ed, because they must remain consistent between
void (*h_function_pointer) (char *username, long usernum);
int eventtype;
};
-extern struct UserFunctionHook *UserHookTable;
+extern DLEXP struct UserFunctionHook *UserHookTable;
#define EVT_PURGEUSER 100 /* Deleting a user */
#define EVT_OUTPUTMSG 101 /* Outputting a message */
int (*h_function_pointer) (struct CtdlMessage *msg);
int eventtype;
};
-extern struct MessageFunctionHook *MessageHookTable;
+extern DLEXP struct MessageFunctionHook *MessageHookTable;
#define EVT_BEFOREREAD 200
#define EVT_BEFORESAVE 201
int (*h_function_pointer) (char *, char *, char *);
int order;
};
-extern struct XmsgFunctionHook *XmsgHookTable;
+extern DLEXP struct XmsgFunctionHook *XmsgHookTable;
/* Priority levels for paging functions (lower is better) */
enum {
void (*h_command_function) (void) ;
int msock;
};
-extern struct ServiceFunctionHook *ServiceHookTable;
+extern DLEXP struct ServiceFunctionHook *ServiceHookTable;
void *h_ptr;
};
-extern struct TheHeap *heap;
+extern DLEXP struct TheHeap *heap;
#else
/* *************** Semi-important fields */
/* * Message text (MUST be last) */
#define FORDER "IPTAFONHRDBCEGJKLQSUVWXYZM"
+
+#endif /* SERVER_H */
* Written July 1997 by Sten Gunterberg (gunterberg@ergon.ch)
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdlib.h>
#include <unistd.h>
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
#include "sysdep.h"
#include <stdlib.h>
#endif
#include "citadel.h"
#include "server.h"
+#include "dynloader.h"
#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
#include "database.h"
#include "housekeeping.h"
-#include "dynloader.h"
#include "tools.h"
#ifdef HAVE_SYS_SELECT_H
fd_set masterfds; /* Master sockets etc. */
int masterhighest;
-static pthread_t initial_thread; /* tid for main() thread */
+pthread_t initial_thread; /* tid for main() thread */
/*
}
}
-static struct worker_node {
- pthread_t tid;
- struct worker_node *next;
-} *worker_list = NULL;
+struct worker_node *worker_list = NULL;
/*
* create a worker thread. this function must always be called from within
* an S_WORKER_LIST critical section!
*/
-static void create_worker(void) {
+void create_worker(void) {
int ret;
struct worker_node *n = mallok(sizeof *n);
}
-
-/*
- * Here's where it all begins.
- */
-int main(int argc, char **argv)
-{
- char tracefile[128]; /* Name of file to log traces to */
- int a, i; /* General-purpose variables */
- struct passwd *pw;
- int drop_root_perms = 1;
- char *moddir;
- struct worker_node *wnp;
-
- /* specify default port name and trace file */
- strcpy(tracefile, "");
-
- /* initialize the master context */
- InitializeMasterCC();
-
- /* parse command-line arguments */
- for (a=1; a<argc; ++a) {
-
- /* -t specifies where to log trace messages to */
- if (!strncmp(argv[a], "-t", 2)) {
- strcpy(tracefile, argv[a]);
- strcpy(tracefile, &tracefile[2]);
- freopen(tracefile, "r", stdin);
- freopen(tracefile, "w", stdout);
- freopen(tracefile, "w", stderr);
- }
-
- /* run in the background if -d was specified */
- else if (!strcmp(argv[a], "-d")) {
- start_daemon( (strlen(tracefile) > 0) ? 0 : 1 ) ;
- }
-
- /* -x specifies the desired logging level */
- else if (!strncmp(argv[a], "-x", 2)) {
- verbosity = atoi(&argv[a][2]);
- }
-
- else if (!strncmp(argv[a], "-h", 2)) {
- safestrncpy(bbs_home_directory, &argv[a][2],
- sizeof bbs_home_directory);
- home_specified = 1;
- }
-
- else if (!strncmp(argv[a], "-f", 2)) {
- do_defrag = 1;
- }
-
- /* -r tells the server not to drop root permissions. don't use
- * this unless you know what you're doing. this should be
- * removed in the next release if it proves unnecessary. */
- else if (!strcmp(argv[a], "-r"))
- drop_root_perms = 0;
-
- /* any other parameter makes it crash and burn */
- else {
- lprintf(1, "citserver: usage: "
- "citserver [-tTraceFile] [-d] [-f]"
- " [-xLogLevel] [-hHomeDir]\n");
- exit(1);
- }
-
- }
-
- /* Tell 'em who's in da house */
- lprintf(1,
-"\nMultithreaded message server for Citadel/UX\n"
-"Copyright (C) 1987-2001 by the Citadel/UX development team.\n"
-"Citadel/UX is free software, covered by the GNU General Public License, and\n"
-"you are welcome to change it and/or distribute copies of it under certain\n"
-"conditions. There is absolutely no warranty for this software. Please\n"
-"read the 'COPYING.txt' file for details.\n\n");
-
- /* Initialize... */
- init_sysdep();
- openlog("citserver", LOG_PID, LOG_USER);
-
- /* Load site-specific parameters */
- lprintf(7, "Loading citadel.config\n");
- get_config();
-
-
- /*
- * Do non system dependent startup functions.
- */
- master_startup();
-
- /*
- * Bind the server to a Unix-domain socket.
- */
- CtdlRegisterServiceHook(0,
- "citadel.socket",
- citproto_begin_session,
- do_command_loop);
-
- /*
- * Bind the server to our favorite TCP port (usually 504).
- */
- CtdlRegisterServiceHook(config.c_port_number,
- NULL,
- citproto_begin_session,
- do_command_loop);
-
- /*
- * Load any server-side modules (plugins) available here.
- */
- lprintf(7, "Initializing loadable modules\n");
- if ((moddir = malloc(strlen(bbs_home_directory) + 9)) != NULL) {
- sprintf(moddir, "%s/modules", bbs_home_directory);
- DLoader_Init(moddir);
- free(moddir);
- }
-
- /*
- * The rescan pipe exists so that worker threads can be woken up and
- * told to re-scan the context list for fd's to listen on. This is
- * necessary, for example, when a context is about to go idle and needs
- * to get back on that list.
- */
- if (pipe(rescan)) {
- lprintf(1, "Can't create rescan pipe!\n");
- exit(errno);
- }
-
- init_master_fdset();
-
- /*
- * Now that we've bound the sockets, change to the BBS user id and its
- * corresponding group ids
- */
- if (drop_root_perms) {
- if ((pw = getpwuid(BBSUID)) == NULL)
- lprintf(1, "WARNING: getpwuid(%d): %s\n"
- "Group IDs will be incorrect.\n", BBSUID,
- strerror(errno));
- else {
- initgroups(pw->pw_name, pw->pw_gid);
- if (setgid(pw->pw_gid))
- lprintf(3, "setgid(%d): %s\n", pw->pw_gid,
- strerror(errno));
- }
- lprintf(7, "Changing uid to %d\n", BBSUID);
- if (setuid(BBSUID) != 0) {
- lprintf(3, "setuid() failed: %s\n", strerror(errno));
- }
- }
-
- /* We want to check for idle sessions once per minute */
- CtdlRegisterSessionHook(terminate_idle_sessions, EVT_TIMER);
-
- /*
- * Now create a bunch of worker threads.
- */
- lprintf(9, "Starting %d worker threads\n", config.c_min_workers-1);
- begin_critical_section(S_WORKER_LIST);
- for (i=0; i<(config.c_min_workers-1); ++i) {
- create_worker();
- }
- end_critical_section(S_WORKER_LIST);
-
- /* Now this thread can become a worker as well. */
- initial_thread = pthread_self();
- worker_thread(NULL);
-
- /* Server is exiting. Wait for workers to shutdown. */
- lprintf(7, "Waiting for worker threads to shut down\n");
-
- begin_critical_section(S_WORKER_LIST);
- while (worker_list != NULL) {
- wnp = worker_list;
- worker_list = wnp->next;
-
- /* avoid deadlock with an exiting thread */
- end_critical_section(S_WORKER_LIST);
- if ((i = pthread_join(wnp->tid, NULL)))
- lprintf(1, "pthread_join: %s\n", strerror(i));
- phree(wnp);
- begin_critical_section(S_WORKER_LIST);
- }
- end_critical_section(S_WORKER_LIST);
-
- master_cleanup();
-
- return(0);
-}
-
-
/*
* Bind a thread to a context. (It's inline merely to speed things up.)
*/
/* $Id$ */
+
+#include "dynloader.h"
+
void lprintf (int loglevel, const char *format, ...);
void init_sysdep (void);
void begin_critical_section (int which_one);
void *worker_thread (void *arg);
inline void become_session(struct CitContext *which_con);
void CtdlRedirectOutput(FILE *fp, int sock);
+void InitializeMasterCC(void);
+void init_master_fdset(void);
+void create_worker(void);
+
+extern DLEXP int num_sessions;
+extern DLEXP volatile int time_to_die;
+extern DLEXP int verbosity;
+extern DLEXP int rescan[];
+extern DLEXP pthread_t initial_thread;
-extern int num_sessions;
-extern volatile int time_to_die;
+extern DLEXP struct worker_node {
+ pthread_t tid;
+ struct worker_node *next;
+} *worker_list;
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <stdio.h>
#include <stdlib.h>
*
*/
+#ifdef DLL_EXPORT
+#define IN_LIBCIT
+#endif
+
#include "sysdep.h"
#include <errno.h>
#include <stdlib.h>
#include "server.h"
#include "database.h"
#include "user_ops.h"
+#include "dynloader.h"
#include "sysdep_decls.h"
#include "support.h"
#include "room_ops.h"
#include "control.h"
#include "msgbase.h"
#include "config.h"
-#include "dynloader.h"
#include "tools.h"
#include "citserver.h"