? Makefile ? Makefile.in ? aclocal.m4 ? autom4te.cache ? config.log ? config.status ? configure ? ecartis-1.0-pre.tar.gz ? moddeps.tmp ? debian/Makefile ? debian/Makefile.in ? documentation/Makefile.in ? lists/Makefile ? lists/Makefile.in ? lists/test/Makefile ? lists/test/Makefile.in ? lists/test/text/Makefile ? lists/test/text/Makefile.in ? modules/Makefile ? modules/Makefile.in ? modules/acctmgr.lpm ? modules/admin.lpm ? modules/administrivia.lpm ? modules/antispam.lpm ? modules/base.lpm ? modules/bouncer.lpm ? modules/digest.lpm ? modules/ecartis ? modules/filearchive.lpm ? modules/listarchive.lpm ? modules/lsg2.lpm ? modules/pantomime.lpm ? modules/password.lpm ? modules/peruser.lpm ? modules/send.lpm ? modules/stat.lpm ? modules/toolbox.lpm ? queue/Makefile ? queue/Makefile.in ? scripts/Makefile ? scripts/Makefile.in ? src/.deps ? src/Makefile ? src/Makefile.in ? src/acctmgr.lpm ? src/admin.lpm ? src/administrivia.lpm ? src/antispam.lpm ? src/base.lpm ? src/bouncer.lpm ? src/digest.lpm ? src/ecartis ? src/filearchive.lpm ? src/listarchive.lpm ? src/lsg2.lpm ? src/modulesdone ? src/pantomime.lpm ? src/password.lpm ? src/peruser.lpm ? src/send.lpm ? src/stat.lpm ? src/toolbox.lpm ? src/inc/stamp-h1 ? src/modules/Makefile ? src/modules/Makefile.in ? src/modules/Makefile.win ? src/modules/module.mk ? src/modules/acctmgr/.deps ? src/modules/acctmgr/Makefile.win ? src/modules/admin/Makefile.in ? src/modules/admin/Makefile.win ? src/modules/administrivia/Makefile.win ? src/modules/antispam/Makefile.win ? src/modules/base/Makefile.win ? src/modules/bouncer/Makefile.win ? src/modules/digest/Makefile.win ? src/modules/filearchive/Makefile.win ? src/modules/listarchive/Makefile.win ? src/modules/lsg2/Makefile.win ? src/modules/pantomime/Makefile.win ? src/modules/password/Makefile.win ? src/modules/peruser/Makefile.win ? src/modules/send/Makefile.win ? src/modules/stat/Makefile.win ? src/modules/toolbox/Makefile.win ? src/testsuite/.deps ? src/testsuite/Makefile ? src/testsuite/Makefile.in ? src/testsuite/build_hostname-test ? src/testsuite/cmdarg-test ? src/testsuite/cmdarg-test.c ? src/testsuite/modes-test ? src/testsuite/mystring-test ? templates/Makefile ? templates/Makefile.in Index: Makefile.am =================================================================== RCS file: Makefile.am diff -N Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ Makefile.am 20 Aug 2003 05:58:04 -0000 @@ -0,0 +1,31 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = src documentation scripts templates modules queue debian lists + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = banned ecartis.aliases.dist ecartis.cfg.dist ecartis.hlp \ + ecartis.spec ECARTIS.TODO LICENSE NOTE README.ANTISPAM README.CVS \ + README.DIGEST README.LISTS spam-regexp.sample tools.ini + +if TRADITIONAL +install: all + ./mkinstalldirs $(prefix)/lists $(prefix)/queue \ + $(prefix)/modules $(prefix)/templates $(prefix)/scripts \ + $(prefix)/documentation + cp src/ecartis banned ecartis.hlp ecartis.cfg.dist ecartis.aliases.dist $(prefix)/ +@IF_DYNMODS@ for p in src/*.lpm; do cp $$p $(prefix)/modules/; done + for p in templates/*.lsc; do cp $$p $(prefix)/templates/; done + for p in scripts/*; do cp $$p $(prefix)/scripts/; done + for p in documentation/*; do cp $$p $(prefix)/documentation/; done +else +install-data-hook: + @true +endif + +pristine: distclean + +CLEANFILES = ecartis$(EXEEXT) + +check: + (cd src && make check) Index: configure.ac =================================================================== RCS file: configure.ac diff -N configure.ac --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ configure.ac 20 Aug 2003 05:58:04 -0000 @@ -0,0 +1,336 @@ +dnl -*- mode: shell-script; sh-indentation: 2; -*- +dnl $Id$ + +dnl Process this file with autoconf to produce a configure script. + +AC_INIT([ecartis], [1.0-pre]) +AC_CONFIG_SRCDIR([src/core.c]) +AM_INIT_AUTOMAKE +AC_CONFIG_HEADERS([src/inc/config.h]) +AC_PREREQ(2.50) +AC_REVISION( $Id$ ) + +dnl We take options + +DEFAULT_LOC=/usr/local + +AC_ARG_ENABLE(developer-mode, + AC_HELP_STRING([--enable-developer-mode],[Add options suitable for developers.]), + developerflags=yes) + +AC_ARG_ENABLE(traditional-install, + AC_HELP_STRING([--disable-traditional-install],[Do not try to mimic the traditional ecartis make install.]), + traditional=no, + traditional=yes) + +if test x"$traditional" = xyes; then + if test x"$prefix" = xNONE; then +dnl Install in an ecartis directory unless told otherwise. + prefix=$DEFAULT_LOC/ecartis + fi + moddir="$prefix/modules" + queuedir="$prefix/queue" + listdir="$prefix/lists" + confdir="$prefix/" + AC_MSG_WARN([Traditional install enabled, everything will be installed under $prefix.]) +else + moddir="$libdir/ecartismodules" + queuedir="$localstatedir/queue" + listdir="$localstatedir/list" + confdir="$sysconfdir/" +fi + +AC_SUBST(moddir) +AC_SUBST(queuedir) +AC_SUBST(listdir) +AC_SUBST(confdir) + +AC_ARG_ENABLE(dynamic-modules, + AC_HELP_STRING([--enable-dynamic-modules],[Use dynamic modules, can be force, yes, no or maybe (default).]), + dynmods=$enable_dynamic_modules, + dynmods=maybe) + +AC_ARG_ENABLE(hitching-lock, + AC_HELP_STRING([--enable-hitching-lock],[Use hitching lock, for distributed file systems (e.g. NFS) where flock/fcntl doesn't work.]), + CPPFLAGS="$CPPFLAGS -DUSE_HITCHING_LOCK") + +dnl Checks for programs. +AC_PROG_CC +AC_PROG_MAKE_SET +AM_PROG_CC_STDC +AC_PROG_GCC_TRADITIONAL + +if test "x$am_cv_prog_cc_stdc" = xno ; then + AC_MSG_ERROR([the C compiler doesn't handle ANSI-C]) +fi + +AC_ARG_VAR([AR], [Path to ar]) +if test x"$AR" = x; then + AC_PATH_PROG([AR], [ar], [no], [/:$PATH:/usr/ccs/bin]) +fi + +AC_ARG_VAR([RANLIB], [Path to ranlib]) +if test x"$RANLIB" = x; then + AC_PATH_PROG([RANLIB], [ranlib], [no], [/:$PATH:/usr/ccs/bin]) +fi + +if test x"$RANLIB" = xno -o x"$AR" = xno; then + AC_MSG_ERROR([Failed to find either ar or ranlib]) +fi + +dnl Checks for header files. +AC_HEADER_STDC + +AC_HEADER_TIME +AC_HEADER_MAJOR + +AC_HEADER_STDC + + +case $target_os in *cygwin* ) using_cygwin=yes; AC_DEFINE_UNQUOTED(USING_CYGWIN, 1, Are we using CygWin?) ;; * ) using_cygwin=no;; +esac + + +dnl Checks for header files. + +AC_CHECK_HEADERS([ sys/types.h bstring.h ctype.h dirent.h dlfcn.h errno.h fcntl.h \ +io.h netdb.h netinet/in.h poll.h pwd.h share.h signal.h stdarg.h \ +stdio.h stdlib.h string.h strings.h sysexits.h sys/file.h sys/socket.h \ +sys/stat.h sys/time.h sys/types.h time.h unistd.h winsock2.h \ +inttypes.h poll.h sysexits.h crypt.h]) + +dnl Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +AC_C_INLINE +AC_TYPE_UID_T +AC_TYPE_SIZE_T + +AC_CHECK_TYPE( dl_funcptr, AC_DEFINE(HAVE_DL_FUNCPTR, 1, Define if you have dl_funcptr),, dlfcn ) +AC_CHECK_TYPES(time_t) + +AC_STRUCT_TM +AC_STRUCT_TIMEZONE + +dnl Check for libraries we might need. + +AC_SEARCH_LIBS(dlopen, dl) +AC_SEARCH_LIBS(crypt, crypt) +AC_SEARCH_LIBS(gethostbyname, nsl) +AC_SEARCH_LIBS(socket, socket,,,-lnsl) + + +dnl Checks for library functions. +AC_FUNC_ALLOCA + +dnl AC_FUNC_MALLOC +dnl This checks that malloc(0) != 0. We should probably use a wrapped malloc anyway. + +AC_FUNC_STRFTIME +AC_FUNC_ERROR_AT_LINE + + +dnl Checks for library functions. + +AC_CHECK_FUNCS(crypt snprintf vsnprintf _vsnprintf flock dlopen dlclose dlsym bcopy memmove strerror strchr strrchr fcntl usleep Sleep) + + + + + +dnl In case we don't have strerror, check for sys_errlist + +if test x"$ac_cv_func_strerror" = xyes; then + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]], + [[extern int sys_nerr;]] + [[extern char *sys_errlist[];]] + [[return sys_nerr+sys_errlist[0][0];]])], + [AC_DEFINE(HAVE_SYS_ERRLIST, 1, System has sys_errlist and sys_nerr)]) +fi + + +dnl Find out if we have a good or bad strftime +dnl Should we check for this at runtime? I doubt. + +AC_RUN_IFELSE([AC_LANG_PROGRAM([[#ifdef TIME_WITH_SYS_TIME]] +[[#include ]] +[[#endif]] +[[#include ]] +[[#include ]], +[[char s[1000];]] +[[struct tm t;]] +[[#ifdef HAVE_STRUCT_TM_TM_ZONE]] +[[t.tm_zone="CET";]] +[[t.tm_gmtoff=3600;]] +[[#endif]] +[[timezone = -3600;]] +[[tzname[0] = "CET";]] +[[daylight = 1;]] +[[strftime( s, 99, "%z", &t);]] +[[return strcmp("+0100", s);]])], + [AC_DEFINE(HAVE_GNU_STRFTIME, 1, strftime supports rfc822 numeric timezone)], + [AC_MSG_NOTICE(Your system has a dumb strftime.)], + [AC_MSG_NOTICE(Cross compiling - assuming destination has a dumb strftime.)]) + +dnl Maybe this can be resolved by changing the order? The correct way of writing seems to be +dnl %+0.2d. Leave it for now. + +AC_RUN_IFELSE([AC_LANG_PROGRAM( +[[#include ]] +[[#include ]], +[[#if defined(HAVE_SNPRINTF) && defined(HAVE_STRCMP)]] +[[char s[100];]] +[[snprintf( s, 99, "%+.02d", 4 );]] +[[return strcmp( s, "+04" );]] +[[#else /* Systems without snprintf are probably broken :) */]] +[[return 1;]] +[[#endif]] +)], + , + [AC_DEFINE(MY_PRINTF_IS_BRAINDEAD, 1, printf handles %+.02d incorrectly )], + [AC_MSG_NOTICE(Cross compiling - assuming working printf.)]) + + + + + +dnl Whatever to enable dynamic modules +IF_DYNMODS='#' + +AC_ARG_VAR(DYNMODS_LDFLAGS, [Extra flags for linking dynamic modules. Shall probably contain '-o $(MODULE).lpm'.]) +AC_ARG_VAR(DYNMODS_CFLAGS, [Extra flags for compiling dynamic modules.]) +AC_ARG_VAR(UNDERSCORE_PREFIX, [Whatever symbols in dynamic modules are prefixed by an underscore.]) + +if test x"$dynmods" != xno -a x"$ac_cv_func_dlopen" = xyes; then + dnl Dynmods not disabled and we have dynmod. + + case "$dynmods" in + force) + AC_DEFINE(USE_DYNMODS, 1, Use dynamic modules) + IF_DYNMODS='' + ;; + yes) + dnl Make certain the user has defined the flags. + if test x"$DYNMODS_LDFLAGS" != x -a x"$DYNMODS_CFLAGS" != x; then + AC_DEFINE(USE_DYNMODS, 1, Use dynamic modules) + IF_DYNMODS='' + else + AC_MSG_ERROR([You must give at least DYNMODS_LDFLAGS and DYNMODS_CFLAGS or use force-mode.]) + fi + ;; + maybe) + dnl Maybe use dynmods + dnl Ugly check to find dynamic modules behaviour, only supports gcc for the moment. + + if test "x$GCC" = xyes ; then + + AC_LANG_CONFTEST( AC_LANG_SOURCE( [[int testpnm() {return 0;} ]])) + $CC -shared -fPIC conftest.c -o conftest.so + nameform=`strings -a conftest.so | grep -i testpnm | head -1` + + if test x"$UNDERSCORE_PREFIX" = x; then + if test x"$nameform" = x_testpnm ; then + UNDERSCORE_PREFIX=yes + IF_DYNMODS='' + AC_DEFINE(USE_DYNMODS, 1, Use dynamic modules.) + fi + if test x"$nameform" = xtestpnm ; then + IF_DYNMODS='' + AC_DEFINE(USE_DYNMODS, 1, Use dynamic modules.) + fi + else + dnl UNDERSCORE_PREFIX set + IF_DYNMODS='' + AC_DEFINE(USE_DYNMODS, 1, Use dynamic modules.) + fi + if test x"$DYNMODS_LDFLAGS" = x; then + DYNMODS_LDFLAGS='-shared -o $(MODULE).lpm' + fi + if test x"$DYNMODS_CFLAGS" = x; then + DYNMODS_CFLAGS='-fPIC' + fi + fi + ;; + esac +fi + +dnl +AC_SUBST(DYNMODS_LDFLAGS) +AC_SUBST(DYNMODS_CFLAGS) +AC_SUBST(IF_DYNMODS) + +if test x"$UNDERSCORE_PREFIX" = xyes; then + AC_DEFINE(HAVE_UNDERSCORE_PREFIX, 1, Symbols are prefixed by a single underscore) +fi + +if test x"$IF_DYNMODS" = 'x#'; then + AC_MSG_NOTICE([Dynamic modules are disabled.]) +else + AC_MSG_NOTICE([Dynamic modules are enabled.]) + AC_MSG_NOTICE([Extra compiler options "$DYNMODS_CFLAGS".]) + AC_MSG_NOTICE([Extra linker options "$DYNMODS_LDFLAGS".]) + + if test x"$UNDERSCORE_PREFIX" = xyes; then + AC_MSG_NOTICE([Symbols are prefixed by an underscore in shared objects.]) + fi +fi + +dnl Give a sensible default for enabled modules (all of them). +AC_ARG_VAR(ENABLED_MODULES, [List of enabled modules.]) + +if test x"$ENABLED_MODULES" = x -o x"$ENABLED_MODULES" = xall; then + ENABLED_MODULES="acctmgr admin administrivia antispam base bouncer digest filearchive listarchive lsg2 pantomime password peruser send stat toolbox" +fi + +AC_MSG_NOTICE([Enabled modules: $ENABLED_MODULES]) + +dnl Gah! + +MODLIBS_PREREQS=moddeps.tmp +rm -f "$MODLIBS_PREREQS" + +echo '# Module dependencies, calculated by configure' >> "$MODLIBS_PREREQS" + +dnl tr [A-Z] [a-z] seems to be the most portable + +for p in $ENABLED_MODULES; do + mlc=`echo $p | tr @<:@A-Z@:>@ @<:@a-z@:>@` + muc=`echo $p | tr @<:@a-z@:>@ @<:@A-Z@:>@` + + MODLIBS="$MODLIBS lib$mlc.a" + echo "lib$mlc.a: modulesdone" >> "$MODLIBS_PREREQS" + echo >> "$MODLIBS_PREREQS" + CPPFLAGS="$CPPFLAGS -D$muc" +done + +echo '# cut' >> "$MODLIBS_PREREQS" + +AC_SUBST(MODLIBS) +AC_SUBST_FILE(MODLIBS_PREREQS) + + + + +dnl Whatever to do a traditional install +AM_CONDITIONAL(TRADITIONAL, [test "x$traditional" = xyes]) + +dnl Set these flags *last*, or else the test programs won't compile + +if test "x$GCC" = xyes -a "x$developerflags" = xyes ; then + # Using -ggdb3 makes (some versions of) Redhat's gcc-2.96 dump core + if "$CC" --version | grep '^2\.96$' 1>/dev/null 2>&1; then + true + else + CFLAGS="$CFLAGS -ggdb3" + fi + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1" + CFLAGS="$CFLAGS -Wall -W -Wpointer-arith -Wbad-function-cast -Wnested-externs -Wcast-align" +fi + +AC_ARG_VAR(CFLAGS,Extra flags to pass the compiler) +AC_ARG_VAR(CPPFLAGS,Extra flags to pass the preprocessor) + +AC_OUTPUT([Makefile templates/Makefile documentation/Makefile \ + src/Makefile scripts/Makefile modules/Makefile \ + src/modules/Makefile debian/Makefile \ + lists/test/text/Makefile lists/test/Makefile lists/Makefile \ + queue/Makefile src/modules/module.mk src/testsuite/Makefile]) Index: tools.ini =================================================================== RCS file: tools.ini diff -N tools.ini --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ tools.ini 20 Aug 2003 05:58:04 -0000 @@ -0,0 +1,15 @@ +[NMAKE] +all: winfix + cd src + nmake /f Makefile.win + cd .. + +install: all + cd src + nmake /f Makefile.win install + cd .. + +winfix: src\inc\config.h.win + copy src\inc\config.h.win src\inc\config.h + + Index: debian/Makefile.am =================================================================== RCS file: debian/Makefile.am diff -N debian/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ debian/Makefile.am 20 Aug 2003 05:58:04 -0000 @@ -0,0 +1,17 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = . + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = README.debian README.debian-source changelog conffiles \ + control copyright cron.weekly debian-Makefile.diff \ + debian-configs.diff debian-ecartis-cfg.diff \ + debian-listargate.diff dirs docs ecartis-cgi.dirs \ + ecartis-cgi.postinst postinst rules + + + + + + Index: documentation/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/documentation/Makefile,v retrieving revision 1.1 diff -u -r1.1 Makefile --- documentation/Makefile 13 Oct 2002 08:10:13 -0000 1.1 +++ documentation/Makefile 20 Aug 2003 05:58:05 -0000 @@ -1,94 +1,405 @@ +# Makefile.in generated by automake 1.7.3 from Makefile.am. +# documentation/Makefile. Generated from Makefile.in by configure. -# stuff for LaTeX 2e itself -# -LATEX = /usr/local/bin/latex - -# PDF macros -# -PDFLATEX = /usr/local/bin/pdflatex - -# PostScript macros -# -DVIPS = /usr/local/bin/dvips - -# TEXT macros -# -W3M = /usr/local/bin/w3m - -# HTML macros -# -LATEX2HTML = /usr/local/bin/latex2html -# directories to contain HTML output -HTMLSPLITDIR = html-split -HTMLSINGLEDIR = html-single -# arguments for latex2html to generate a split document -HTMLSPLIT = -dir ${HTMLSPLITDIR} -mkdir -local_icons -white -noaddress -noinfo -# arguments for latex2html to generate a single document -HTMLSINGLE = -dir ${HTMLSINGLEDIR} -mkdir -white -noaddress -noinfo -split 0 - -# Which make to use? make or gmake? -MAKE = make - -all: txt html ps pdf dvi - -txt: ecartis.txt - -html: ecartis.html - -ps: ecartis.ps - -pdf: ecartis.pdf - -dvi: ecartis.dvi - -ecartis.pdf: ecartis.dvi - ${MAKE} clean_pdf - # must run twice to get TOC - ${PDFLATEX} ecartis - ${PDFLATEX} ecartis - -ecartis.ps: ecartis.dvi - ${DVIPS} -o ecartis.ps ecartis - -ecartis.txt: ${HTMLSINGLEDIR}/ecartis.html - ${W3M} -dump ${HTMLSINGLEDIR}/ecartis.html > ecartis.txt - -ecartis.html: ${HTMLSINGLEDIR}/ecartis.html - -${HTMLSINGLEDIR}/ecartis.html: ecartis.dvi - ${MAKE} distclean_html - ${LATEX2HTML} ${HTMLSPLIT} ecartis - ${LATEX2HTML} ${HTMLSINGLE} ecartis - -ecartis: ecartis.dvi - -ecartis.dvi: ecartis.sty ecartis.tex - # must run twice to get TOC - ${LATEX} ecartis - ${LATEX} ecartis - -distclean: clean distclean_dvi distclean_pdf distclean_ps distclean_txt \ - distclean_html - -clean: clean_dvi clean_pdf - -distclean_dvi: clean_dvi - rm -Rf ecartis.dvi - -clean_dvi: - rm -Rf ecartis.aux ecartis.log ecartis.toc - -distclean_pdf: - rm -Rf ecartis.pdf - -clean_pdf: - rm -Rf ecartis.aux ecartis.log ecartis.out ecartis.toc - -distclean_ps: - rm -Rf ecartis.ps - -distclean_txt: - rm -Rf ecartis.txt - -distclean_html: - rm -Rf ${HTMLSPLITDIR} ${HTMLSINGLEDIR} +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 +# Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + + +srcdir = . +top_srcdir = .. + +pkgdatadir = $(datadir)/ecartis +pkglibdir = $(libdir)/ecartis +pkgincludedir = $(includedir)/ecartis +top_builddir = .. + +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +ACLOCAL = ${SHELL} /space/1/ecartis/ac/ecartis/missing --run aclocal-1.7 +ALLOCA = +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /space/1/ecartis/ac/ecartis/missing --run tar +AR = /usr/bin/ar +AUTOCONF = ${SHELL} /space/1/ecartis/ac/ecartis/missing --run autoconf +AUTOHEADER = ${SHELL} /space/1/ecartis/ac/ecartis/missing --run autoheader +AUTOMAKE = ${SHELL} /space/1/ecartis/ac/ecartis/missing --run automake-1.7 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -g -O2 +CPP = gcc -E +CPPFLAGS = -DACCTMGR -DADMIN -DADMINISTRIVIA -DANTISPAM -DBASE -DBOUNCER -DDIGEST -DFILEARCHIVE -DLISTARCHIVE -DLSG2 -DPANTOMIME -DPASSWORD -DPERUSER -DSEND -DSTAT -DTOOLBOX +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +DYNMODS_CFLAGS = -fPIC +DYNMODS_LDFLAGS = -shared -o $(MODULE).lpm +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = grep -E +ENABLED_MODULES = acctmgr admin administrivia antispam base bouncer digest filearchive listarchive lsg2 pantomime password peruser send stat toolbox +EXEEXT = +IF_DYNMODS = +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBOBJS = +LIBS = -lcrypt -ldl +LTLIBOBJS = +MAKEINFO = ${SHELL} /space/1/ecartis/ac/ecartis/missing --run makeinfo +MODLIBS = libacctmgr.a libadmin.a libadministrivia.a libantispam.a libbase.a libbouncer.a libdigest.a libfilearchive.a liblistarchive.a liblsg2.a libpantomime.a libpassword.a libperuser.a libsend.a libstat.a libtoolbox.a +OBJEXT = o +PACKAGE = ecartis +PACKAGE_BUGREPORT = +PACKAGE_NAME = ecartis +PACKAGE_STRING = ecartis 1.0-pre +PACKAGE_TARNAME = ecartis +PACKAGE_VERSION = 1.0-pre +PATH_SEPARATOR = : +RANLIB = /usr/bin/ranlib +SET_MAKE = +SHELL = /bin/sh +STRIP = +TRADITIONAL_FALSE = +TRADITIONAL_TRUE = # +UNDERSCORE_PREFIX = +VERSION = 1.0-pre +ac_ct_CC = gcc +ac_ct_STRIP = +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__include = include +am__leading_dot = . +am__quote = +bindir = ${exec_prefix}/bin +build_alias = +confdir = ${prefix}/etc/ +datadir = ${prefix}/share +exec_prefix = ${prefix} +host_alias = +includedir = ${prefix}/include +infodir = ${prefix}/info +install_sh = /space/1/ecartis/ac/ecartis/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +listdir = ${prefix}/var/list +localstatedir = ${prefix}/var +mandir = ${prefix}/man +moddir = ${exec_prefix}/lib/ecartismodules +oldincludedir = /usr/include +prefix = /tmp/ecaf +program_transform_name = s,x,x, +queuedir = ${prefix}/var/queue +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = + +SUBDIRS = . + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = ecartis.tex ecartis.sty +subdir = documentation +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/inc/config.h +CONFIG_CLEAN_FILES = +DIST_SOURCES = + +RECURSIVE_TARGETS = info-recursive dvi-recursive pdf-recursive \ + ps-recursive install-info-recursive uninstall-info-recursive \ + all-recursive install-data-recursive install-exec-recursive \ + installdirs-recursive install-recursive uninstall-recursive \ + check-recursive installcheck-recursive +DIST_COMMON = Makefile.am Makefile.in +DIST_SUBDIRS = $(SUBDIRS) +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign documentation/Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @set fnord $$MAKEFLAGS; amf=$$2; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ETAGS = etags +ETAGSFLAGS = + +CTAGS = ctags +CTAGSFLAGS = + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique + +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = .. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d $(distdir)/$$subdir \ + || mkdir $(distdir)/$$subdir \ + || exit 1; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" \ + distdir=../$(distdir)/$$subdir \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: + +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-recursive + +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am clean \ + clean-generic clean-recursive ctags ctags-recursive distclean \ + distclean-generic distclean-recursive distclean-tags distdir \ + dvi dvi-am dvi-recursive info info-am info-recursive install \ + install-am install-data install-data-am install-data-recursive \ + install-exec install-exec-am install-exec-recursive \ + install-info install-info-am install-info-recursive install-man \ + install-recursive install-strip installcheck installcheck-am \ + installdirs installdirs-am installdirs-recursive \ + maintainer-clean maintainer-clean-generic \ + maintainer-clean-recursive mostlyclean mostlyclean-generic \ + mostlyclean-recursive pdf pdf-am pdf-recursive ps ps-am \ + ps-recursive tags tags-recursive uninstall uninstall-am \ + uninstall-info-am uninstall-info-recursive uninstall-recursive + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: Index: documentation/Makefile.am =================================================================== RCS file: documentation/Makefile.am diff -N documentation/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ documentation/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,7 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = . + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = ecartis.tex ecartis.sty Index: lists/Makefile.am =================================================================== RCS file: lists/Makefile.am diff -N lists/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lists/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,9 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = test + +AUTOMAKE_OPTIONS = foreign + + + + Index: lists/test/Makefile.am =================================================================== RCS file: lists/test/Makefile.am diff -N lists/test/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lists/test/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,11 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = text + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = config cookies users + + + + Index: lists/test/text/Makefile.am =================================================================== RCS file: lists/test/text/Makefile.am diff -N lists/test/text/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ lists/test/text/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,12 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = blacklist.txt closed-post.txt footer.txt intro.txt + + + + + Index: modules/Makefile.am =================================================================== RCS file: modules/Makefile.am diff -N modules/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ modules/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,14 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = . + +AUTOMAKE_OPTIONS = foreign + + +CLEANFILES = modules/acctmgr.lpm modules/admin.lpm \ +modules/administrivia.lpm modules/antispam.lpm modules/base.lpm \ +modules/bouncer.lpm modules/digest.lpm modules/filearchive.lpm \ +modules/listarchive.lpm modules/lsg2.lpm modules/pantomime.lpm \ +modules/password.lpm modules/peruser.lpm modules/send.lpm \ +modules/stat.lpm modules/toolbox.lpm + Index: queue/Makefile.am =================================================================== RCS file: queue/Makefile.am diff -N queue/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ queue/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,9 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = . + +AUTOMAKE_OPTIONS = foreign + + + + Index: scripts/Makefile.am =================================================================== RCS file: scripts/Makefile.am diff -N scripts/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ scripts/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,9 @@ +## Process this file with automake to produce Makefile.in + +SUBDIRS = . + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = lsg2.cgi.dist + + Index: src/Makefile.am =================================================================== RCS file: src/Makefile.am diff -N src/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/Makefile.am 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,62 @@ +SUBDIRS = . testsuite +DIST_SUBDIRS = modules testsuite + +AUTOMAKE_OPTIONS = foreign + +AM_CPPFLAGS = -DMODDIR=\""$(moddir)"\" \ + -DLISTDIR=\""$(listdir)"\" \ + -DQUEUDIR=\""$(queuedir)"\" \ + -DCONFDIR=\""$(confdir)"\" + +if !TRADITIONAL +install-exec-hook: modulesdone +@IF_DYNMODS@ $(mkinstalldirs) @moddir@/ +@IF_DYNMODS@ for p in *.lpm; do $(INSTALL_DATA) $$p @moddir@/$$p; done || exit 1; + @true +endif + +sbin_PROGRAMS = ecartis + +CLEANFILES = modulesdone + +libecartis_a_SOURCES = alias.c cmdarg.c codes.c command.c cookie.c core.c \ + dynmod.c fileapi.c file.c flag.c forms.c funcparse.c hooks.c \ + internal.c io.c lcgi.c liscript.c list.c lma.c moderate.c modes.c \ + module.c mysignal.c mystring.c parse.c passwd.c regerror.c regexp.c \ + regsub.c rfc2047.c smtp.c snprintf.c staticmod.c submodes.c tolist.c \ + trust.c unhtml.c unmime.c upgrade.c user.c userstat.c variables.c \ + winio.c winmod.c xmalloc.c + +ecartis_SOURCES = $(libecartis_a_SOURCES) main.c + +noinst_HEADERS = inc/config.h.in inc/alias.h inc/build.h inc/cmdarg.h \ + inc/codes.h inc/command.h inc/common.h inc/compat.h \ + inc/cookie.h inc/core.h inc/file.h inc/fileapi.h inc/flag.h \ + inc/forms.h inc/funcparse.h inc/hooks.h inc/init.h \ + inc/internal.h inc/lcgi.h inc/liscript.h inc/list.h \ + inc/lpm-api.h inc/lpm-def.h inc/lpm-mods.h inc/lpm.h \ + inc/moderate.h inc/modes.h inc/module.h inc/mysignal.h \ + inc/mystring.h inc/parse.h inc/passwd.h inc/regexp.h \ + inc/regmagic.h inc/rfc2047.h inc/smtp.h inc/snprintf.h inc/sockio.h \ + inc/submodes.h inc/tolist.h inc/trust.h inc/unhtml.h \ + inc/unmime.h inc/upgrade.h inc/user.h inc/userstat.h \ + inc/variables.h inc/version.h inc/config.h.win inc/xmalloc.h + +noinst_LIBRARIES = libecartis.a + +EXTRA_DIST = Makefile.win + +# configure creates a list of the statically linked modules +# (we always include them when linking, with dynamic modules, they are ignored). + +ecartis_LDADD = @MODLIBS@ +ecartis_DEPENDENCIES = modulesdone + +# configure fixes rules for them too. +@MODLIBS_PREREQS@ + +modulesdone: + (cd modules; $(MAKE) all) && touch modulesdone + +check: libecartis.a testsuite modulesdone + (cd testsuite; make check) Index: src/Makefile.dist =================================================================== RCS file: /usr/cvsroot/ecartis/src/Makefile.dist,v retrieving revision 1.7 diff -u -r1.7 Makefile.dist --- src/Makefile.dist 5 Oct 2002 19:44:53 -0000 1.7 +++ src/Makefile.dist 20 Aug 2003 05:58:05 -0000 @@ -137,7 +137,7 @@ ifndef SUNOS_5 CFLAGS=-I./inc ${GNU_STRFTIME} ${NEED_SNPRINTF} ${NEED_FLOCK} ${DEC_UNIX} ${IRIX} ${USE_HITCHING_LOCK} ${NO_MEMMOVE} ${NEED_STRERROR} ${NO_TM_GMTOFF} ${HAVE_TZNAME} ${HAVE_TIMEZONE} ${NEED_STRCHR} ${NEED_STRRCHR} ${MY_PRINTF_IS_BRAINDEAD} ${DETECT_BROKEN_HOSTNAME} else -CFLAGS=-I./inc -DSUNOS_5 ${GNU_STRFTIME} ${NEED_SNPRINTF} ${NEED_FLOCK} ${USE_HITCHING_LOCK} ${NO_MEMMOVE} ${NEED_STRERROR} ${NO_TM_GMTOFF} ${HAVE_TZNAME} ${HAVE_TIMEZONE} ${NEED_STRCHR} ${NEED_STRRCHR} ${MY_PRINTF_IS_BRAINDEAD} +CFLAGS=-I./inc -DSUNOS_5 ${GNU_STRFTIME} ${NEED_SNPRINTF} ${NEED_FLOCK} ${USE_HITCHING_LOCK} ${NO_MEMMOVE} ${NEED_STRERROR} ${NO_TM_GMTOFF} ${HAVE_TZNAME} ${HAVE_TIMEZONE} ${NEED_STRCHR} ${NEED_STRRCHR} ${MY_PRINTF_IS_BRAINDEAD} -D_XOPEN_SOURCE=500 -D_XOPEN_SOURCE_EXTENDED=1 endif # Now set up the initial library path. Once again, SUNOS_5 makes this Index: src/Makefile.win =================================================================== RCS file: src/Makefile.win diff -N src/Makefile.win --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/Makefile.win 20 Aug 2003 05:58:05 -0000 @@ -0,0 +1,56 @@ +CFLAGS = -Iinc -DWIN32 /TC +LIBS = ws2_32.lib + +LS_BOUNCER=bouncer +LS_LISTARCHIVE=listarchive +LS_FILEARCHIVE=filearchive +LS_ADMIN=admin +LS_ACCTMGR=acctmgr +LS_STAT=stat +LS_SEND=send +LS_BASE=base +LS_DIGEST=digest +LS_ANTISPAM=antispam +LS_ADMINISTRIVIA=administrivia +LS_TOOLBOX=toolbox +LS_PANTOMIME=pantomime +LS_LISTARGATE=lsg2 +LS_PASSWORD=password +LS_PERUSER=peruser + + + +MODULES=$(LS_BOUNCER) $(LS_LISTARCHIVE) $(LS_FILEARCHIVE) $(LS_ADMIN) \ +$(LS_ACCTMGR) $(LS_STAT) $(LS_SEND) $(LS_BASE) $(LS_DIGEST) \ +$(LS_ANTISPAM) $(LS_ADMINISTRIVIA) $(LS_TOOLBOX) $(LS_PANTOMIME) \ +$(LS_LISTARGATE) $(LS_PASSWORD) $(LS_PERUSER) + +all: targets + +OBJS=alias.obj command.obj user.obj parse.obj list.obj core.obj forms.obj smtp.obj \ + regerror.obj regsub.obj regexp.obj flag.obj cookie.obj file.obj module.obj \ + fileapi.obj variables.obj internal.obj cmdarg.obj modes.obj \ + unmime.obj codes.obj hooks.obj tolist.obj mystring.obj lma.obj \ + userstat.obj snprintf.obj moderate.obj mysignal.obj unhtml.obj \ + liscript.obj submodes.obj lcgi.obj upgrade.obj passwd.obj \ + funcparse.obj trust.obj rfc2047.obj winio.obj winmod.obj \ + xmalloc.o + +targets: make_modules ecartis + +ecartis: $(OBJS) + $(CC) $(EXTRA_LFLAGS) $(LFLAGS) /Feecartis.exe $(OBJS) $(EXTRA_LIBS) $(LIBS) + +make_modules: + set MOD_TARGETS=$(MODULES) + cd modules + nmake /f Makefile.win + cd .. + + +install: targets + copy ecartis.exe ..\ + copy *.dll ..\modules\ + +.c.obj: + $(CC) $(WFLAGS) $(CFLAGS) $(EXTRA_CDEFS) $(EXTRA_CFLAGS) -c $*.c Index: src/alias.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/alias.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 alias.c --- src/alias.c 5 Aug 2001 21:15:35 -0000 1.1.1.1 +++ src/alias.c 20 Aug 2003 05:58:05 -0000 @@ -5,15 +5,18 @@ * : This is usually used to alias variables to older names, * : allowing older config files to work invisibly. */ - #include #include +#include #include #include +#include "config.h" +#include "compat.h" #include "alias.h" #include "core.h" #include "mystring.h" +#include "xmalloc.h" struct alias_info *aliases = NULL; @@ -60,7 +63,7 @@ void init_aliases(void) { int i; - aliases = (struct alias_info *)malloc(sizeof(struct alias_info)); + aliases = (struct alias_info *)xmalloc(sizeof(struct alias_info)); for(i = 0; i < ALIASHASH; i++) aliases->bucket[i] = NULL; } @@ -94,9 +97,9 @@ } /* Allocate and store. */ - temp = (struct alias_data *)malloc(sizeof(struct alias_data)); - temp->aliasname = strdup(alias); - temp->realname = strdup(real); + temp = (struct alias_data *)xmalloc(sizeof(struct alias_data)); + temp->aliasname = xstrdup(alias); + temp->realname = xstrdup(real); temp->next = aliases->bucket[hash]; aliases->bucket[hash] = temp; return 1; Index: src/cmdarg.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/cmdarg.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 cmdarg.c --- src/cmdarg.c 5 Aug 2001 21:15:26 -0000 1.1.1.1 +++ src/cmdarg.c 20 Aug 2003 05:58:05 -0000 @@ -7,9 +7,12 @@ * --- */ +#include "config.h" #include #include + #include "cmdarg.h" +#include "xmalloc.h" struct listserver_cmdarg *args = NULL; @@ -71,11 +74,11 @@ void add_cmdarg(const char *arg, int params, char *pdesc, CmdArgFn fn) { struct listserver_cmdarg *tmp; - tmp = (struct listserver_cmdarg *)malloc(sizeof(struct listserver_cmdarg)); + tmp = (struct listserver_cmdarg *)xmalloc(sizeof(struct listserver_cmdarg)); tmp->parmdesc = NULL; - tmp->arg = strdup(arg); + tmp->arg = xstrdup(arg); if(pdesc) - tmp->parmdesc = strdup(pdesc); + tmp->parmdesc = xstrdup(pdesc); tmp->params = params; tmp->fn = fn; Index: src/codes.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/codes.c,v retrieving revision 1.6 diff -u -r1.6 codes.c --- src/codes.c 7 Feb 2003 22:26:58 -0000 1.6 +++ src/codes.c 20 Aug 2003 05:58:05 -0000 @@ -16,6 +16,7 @@ #include #include #include +#include "config.h" #include "codes.h" #include "core.h" #include "fileapi.h" Index: src/command.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/command.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 command.c --- src/command.c 5 Aug 2001 21:15:26 -0000 1.1.1.1 +++ src/command.c 20 Aug 2003 05:58:05 -0000 @@ -1,10 +1,13 @@ -#include #include #include +#include +#include -#include "command.h" #include "config.h" +#include "command.h" +#include "common.h" #include "core.h" +#include "xmalloc.h" struct listserver_cmd *commands = NULL; @@ -41,21 +44,21 @@ { struct listserver_cmd *temp; - temp = (struct listserver_cmd *)malloc(sizeof(struct listserver_cmd)); + temp = (struct listserver_cmd *)xmalloc(sizeof(struct listserver_cmd)); - temp->name = strdup(name); - temp->desc = strdup(desc); + temp->name = xstrdup(name); + temp->desc = xstrdup(desc); temp->syntax = NULL; temp->altsyntax = NULL; temp->adminsyntax = NULL; if(syntax) { - temp->syntax = strdup(syntax); + temp->syntax = xstrdup(syntax); } if(altsyntax) { - temp->altsyntax = strdup(altsyntax); + temp->altsyntax = xstrdup(altsyntax); } if(adminsyntax) { - temp->adminsyntax = strdup(adminsyntax); + temp->adminsyntax = xstrdup(adminsyntax); } temp->flags = flags; temp->cmd = cmd; Index: src/cookie.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/cookie.c,v retrieving revision 1.5 diff -u -r1.5 cookie.c --- src/cookie.c 11 Aug 2002 22:25:09 -0000 1.5 +++ src/cookie.c 20 Aug 2003 05:58:05 -0000 @@ -1,18 +1,50 @@ +#include "config.h" + +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_TIME_H #include +#endif + +#ifdef HAVE_CTYPE_H #include +#endif -#ifndef WIN32 +#if defined( TIME_WITH_SYS_TIME ) && defined( HAVE_SYS_TIME_H ) #include +#endif + +#ifdef HAVE_SYS_TYPES_H #include +#endif + +#ifdef HAVE_DIRENT_H #include +#endif + +#ifdef HAVE_SYS_STAT_H #include +#endif + +#ifdef HAVE_UNISTD_H #include #endif -#include "config.h" +#include "common.h" #include "core.h" #include "list.h" #include "user.h" @@ -21,6 +53,7 @@ #include "compat.h" #include "cookie.h" #include "mystring.h" +#include "xmalloc.h" struct cookie_data *cookies; static int gcookiecount; @@ -65,13 +98,13 @@ log_printf(0, "Reregistration of cookie type '%c'\n", type); return; } - temp = (struct cookie_data *)malloc(sizeof(struct cookie_data)); + temp = (struct cookie_data *)xmalloc(sizeof(struct cookie_data)); temp->type = type; temp->create = create; temp->destroy = destroy; temp->expire = NULL; if(expirevar) - temp->expire = strdup(expirevar); + temp->expire = xstrdup(expirevar); temp->next = cookies; cookies = temp; } @@ -79,7 +112,7 @@ /* Generates a cookie. 'encstring' is the string to encode, * finalstr is the buffer for the resulting cookie. This is * used internally. */ -void gen_cookie(const char *encstring, char *finalstr) +void gen_cookie(const char *encstring, char *finalstr, int finlen) { char tbuf[SMALL_BUF]; signed char *tptr; @@ -108,17 +141,7 @@ gcookiecount++; -#ifdef OBSDMOD - buffer_printf(finalstr, BIG_BUF - 1, "%lX:%X.%X:%s", (long)now, (int)getpid(), - gcookiecount, tbuf); -#else -#if DEC_UNIX || _AIX - buffer_printf(finalstr, BIG_BUF - 1, "%X:%X.%X:%s", now, (int)getpid(), gcookiecount, tbuf); -#else - buffer_printf(finalstr, BIG_BUF - 1, "%lX:%X.%X:%s", now, (int)getpid(), gcookiecount, - tbuf); -#endif /* DEC_UNIX */ -#endif /* OBSDMOD */ + buffer_printf(finalstr, BIG_BUF - 1, "%lX:%X.%X:%s", (long)now, (int)getpid(), gcookiecount, tbuf); } /* Used internally, checks an plain-text string against the encoded @@ -134,7 +157,7 @@ memset(buffer, 0, sizeof(buffer)); - gen_cookie(match,buffer); + gen_cookie(match,buffer,sizeof(buffer)); tcheck = (char *)strrchr(cookie,':'); tcheck2 = (char *)strrchr(buffer,':'); @@ -152,7 +175,7 @@ /* Requests a cookie. Filename is the cookiefile to place it in, * cookiedata is the string to tie to the cookie, and cookie is * a buffer to place the cookie into. */ -int request_cookie(const char *filename, char *cookie, char type, +int request_cookie(const char *filename, char *cookie, int cookielen, char type, const char *cookiedata) { FILE *cookiefile; @@ -171,7 +194,7 @@ if (!cookiefor) cookiefor = get_string("realsender"); - gen_cookie(cookiefor,cookie); + gen_cookie(cookiefor,cookie,cookielen); write_file(cookiefile,"%s : %c%s\n", cookie, type, cookiedata); close_file(cookiefile); @@ -186,7 +209,7 @@ * cookie is the cookie to check for, and reason is a buffer to place * the reason for the cookie into (the cookiedata from above). */ int verify_cookie(const char *filename, const char *cookie, char type, - char *data) + char *data, int datalen) { FILE *cookiefile; char cookiestring[BIG_BUF]; @@ -228,7 +251,7 @@ temp->type); return 0; } - buffer_printf(data, BIG_BUF - 1, "%s", tval+1); + buffer_printf(data, datalen - 1, "%s", tval+1); } } } @@ -313,7 +336,7 @@ if(cookiestring[strlen(cookiestring)-1] == '\n') cookiestring[strlen(cookiestring)-1] = '\0'; /* smash newline*/ if(strstr(loc, partial)) { - res = strdup(cookiestring); + res = xstrdup(cookiestring); done = 1; } } @@ -382,11 +405,9 @@ char buf[BIG_BUF]; char buf2[BIG_BUF]; char cookie[BIG_BUF]; -#ifdef OBSDMOD - long cookiedate; -#else + time_t cookiedate; -#endif + int age; time_t old = time(NULL); FILE *oldfile, *newfile; @@ -403,26 +424,19 @@ while(read_file(buf, sizeof(buf), oldfile)) { -#ifdef OBSDMOD - long expiretime = 0; -#else - time_t expiretime = 0; -#endif + time_t expiretime = 0; + long cookietmp; + char *tmp; char type = ' '; int bogus = 1; struct cookie_data *temp = NULL; /* Now you know the deep, dark secret of why the first chunk of * the cookie is a hexadecimal timestamp. Easier to expire. :) */ -#ifdef OBSDMOD - sscanf(buf, "%lX:%s", &cookiedate, &cookie[0]); -#else -#if DEC_UNIX || _AIX - sscanf(buf, "%X:%s", &cookiedate, &cookie[0]); -#else - sscanf(buf, "%lX:%s", &cookiedate, &cookie[0]); -#endif -#endif + + sscanf(buf, "%lX:%s", &cookietmp, cookie); + cookiedate = cookietmp; + stringcpy(buf2, buf); if(buf2[strlen(buf2)-1] == '\n') buf2[strlen(buf2)-1] = '\0'; /* smash newline*/ @@ -441,15 +455,11 @@ * own timeout inside their data */ if(strcasecmp(temp->expire, "$$COOKIE$$") == 0) { -#ifdef OBSDMOD - sscanf(tmp, "%lX;", &expiretime); -#else -#if DEC_UNIX || _AIX - sscanf(tmp, "%X;", &expiretime); -#else - sscanf(tmp, "%lX;", &expiretime); -#endif -#endif + long expiretmp; + + sscanf(tmp, "%lX;", &expiretmp); + expiretime = expiretmp; + } else if(get_var(temp->expire)) { age = get_seconds(temp->expire); old -= age; @@ -503,7 +513,7 @@ if (!get_bool("expire-all-cookies")) return; - status = walk_lists(&tbuf[0]); + status = walk_lists(tbuf, sizeof(tbuf)); while(status) { if(list_valid(tbuf)) { listdir_file(buf, tbuf, "cookies"); @@ -515,7 +525,7 @@ expire_cookies(buf); } } - status = next_lists(&tbuf[0]); + status = next_lists(tbuf, sizeof(tbuf)); } wipe_vars(VAR_LIST|VAR_TEMP); } Index: src/core.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/core.c,v retrieving revision 1.9 diff -u -r1.9 core.c --- src/core.c 5 Apr 2003 04:44:24 -0000 1.9 +++ src/core.c 20 Aug 2003 05:58:06 -0000 @@ -1,31 +1,75 @@ +#include "config.h" + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H #include -#include -#include +#endif + +#ifdef HAVE_STDLIB_H #include -#include +#endif + +#ifdef HAVE_STDARG_H +#include +#endif + +#ifdef HAVE_ERRNO_H #include +#endif + +#ifdef HAVE_TIME_H +#include +#endif -#ifdef IRIX_IS_CRAP +#if defined(TIME_WITH_SYS_TIME) && defined(HAVE_SYS_TIME_H) +#include +#endif + +#ifdef HAVE_POLL_H #include #endif -#ifndef WIN32 -#include +#ifdef HAVE_SYS_STAT_H #include +#endif + +#ifdef HAVE_SYS_TYPES_H #include +#endif + +#ifdef HAVE_UNISTD_H #include +#endif + +#ifdef HAVE_NETDB_H #include +#endif + +#ifdef HAVE_PWD_H #include +#endif + +#ifdef HAVE_WINSOCK2_H +#include +#endif /* Fix for brain-dead IRIX system headers */ #undef EX_OK +#ifdef HAVE_SYSEXITS_H #include #endif #include "alias.h" #include "list.h" -#include "config.h" +#include "common.h" #include "command.h" #include "parse.h" #include "init.h" @@ -54,22 +98,17 @@ #include "lcgi.h" #include "funcparse.h" #include "trust.h" +#include "xmalloc.h" #ifdef WIN32 extern void sock_init(); #endif -#ifdef _AIX +#if !defined(HAVE_STRERROR) && defined(HAVE_SYS_ERRLIST) extern int sys_nerr; extern char *sys_errlist[]; #endif -#ifdef DEC_UNIX_USLEEP -/* We need to give a function definition for usleep, or else - * DEC's compiler barfs. This is the old (pre-ANSI) version */ -extern void usleep __((unsigned int)); -#endif /* DEC_UNIX_USLEEP */ - int messagecnt; extern void build_lpm_api(); @@ -79,20 +118,17 @@ void build_hostname(char *buffer, int len) { - char *hostnameholder; + char* hostnameholder = xmalloc(len); struct hostent *he; int i; - hostnameholder = (char *)malloc(len); - if (!hostnameholder) { - buffer_printf(buffer, len - 1, "unknown-hostname"); - return; - } + if (!hostnameholder) + exit(EX_TEMPFAIL); if (gethostname(hostnameholder, len) == -1) { /* gethostname() failed, just put something there. */ buffer_printf(buffer, len - 1, "unknown-hostname"); - free(hostnameholder); + free(hostnameholder); return; } @@ -101,11 +137,13 @@ if (strchr(hostnameholder, 'n')) { /* Looks FQDN already; just return. */ + free(hostnameholder); return; } he = gethostbyname(hostnameholder); if (!he) { /* Couldn't look it up; do a best guess. */ + free(hostnameholder); return; } @@ -114,10 +152,12 @@ for (i = 0; he->h_aliases[i]; i++) { if (strchr(he->h_aliases[i], '.')) { buffer_printf(buffer, len - 1, "%s", he->h_aliases[i]); + free(hostnameholder); return; } } } + free(hostnameholder); } /* Sends a textfile (filename) to address in addy. */ @@ -363,7 +403,7 @@ } write_file(perrfile, "\n"); va_start(vargs, statustext); - vsprintf(buf, statustext, vargs); + buffer_printf(buf, sizeof(buf) -1, statustext, vargs); va_end(vargs); tmp = buf; col = 0; @@ -383,7 +423,7 @@ } /* Quotes last command, used by status/error outputs. */ -void quote_command() +void quote_command( void ) { char outbuf[BIG_BUF]; @@ -588,7 +628,7 @@ #endif va_start(vargs, format); - vsprintf(mybuf, format, vargs); + buffer_printf(mybuf, sizeof(mybuf) - 1 , format, vargs); write_file(logfile, "%s", mybuf); #ifdef DEBUG fprintf(stderr, "%s", mybuf); @@ -616,7 +656,7 @@ fprintf(stderr, mybuf); va_start(vargs, format); - vsprintf(mybuf, format, vargs); + buffer_printf(mybuf, sizeof(mybuf) - 1, format, vargs); fprintf(stderr,"%s", mybuf); va_end(vargs); @@ -643,7 +683,7 @@ buffer_printf(mybuf, sizeof(mybuf) - 1, "%s.perr", get_string("queuefile")); if ((perrfile = open_file(mybuf,"a")) != NULL) { va_start(vargs, format); - vsprintf(mybuf, format, vargs); + buffer_printf(mybuf, sizeof(mybuf) - 1, format, vargs); write_file(perrfile, "%s", mybuf); va_end(vargs); close_file(perrfile); @@ -658,15 +698,8 @@ char tbuf[SMALL_BUF]; time(&now); -#ifdef OBSDMOD + buffer_printf(tbuf, sizeof(tbuf) - 1, "%s/queue/%lX%d", get_string("listserver-data"), (long)now, (int)getpid()); -#else -# if DEC_UNIX || _AIX - buffer_printf(tbuf, sizeof(tbuf) - 1, "%s/queue/%X%d", get_string("listserver-data"), now, (int)getpid()); -# else /* ! DEC_UNIX */ - buffer_printf(tbuf, sizeof(tbuf) - 1, "%s/queue/%lX%d", get_string("listserver-data"), now, (int)getpid()); -# endif -#endif set_var("queuefile", &tbuf[0], VAR_GLOBAL); return 1; @@ -891,130 +924,6 @@ nuke_aliases(); } -int main (int argc, char** argv) -{ - char *temp; - int errors = 0; - int exitearly = 0; - int count = 0; - char buf[BIG_BUF]; - - buffer_printf(pathname, sizeof(pathname) - 1, "%s", argv[0]); - temp = strrchr(pathname, '/'); - -#ifdef WIN32 - if(!temp) - temp = strrchr(pathname, '\\'); -#endif - - if (temp) - *(temp) = '\0'; - else - buffer_printf(pathname, sizeof(pathname) - 1, "."); - - argv++; - - init_signals(); - init_listserver(); - - new_flags(); - new_commands(); - new_hooks(); - new_files(); - new_cmdargs(); - new_modes(); - new_tolist(); - new_mime_handlers(); - new_submodes(); - new_cgi_hooks(); - new_cgi_modes(); - new_cgi_tempvars(); - new_funcs(); - - init_internal(); - build_lpm_api(); -#ifdef DYNMOD - log_printf(9,"Preparing to load dynamic modules...\n"); - init_modrefs(); -#endif - log_printf(9,"Loading modules...\n"); - load_all_modules(); - /* - * Reload the global config file to pick up any variables defined by - * the modules - */ - read_conf(GLOBAL_CFG_FILE, VAR_GLOBAL); - log_printf(9,"Initializing modules...\n"); - init_all_modules(); - - if(!get_var("lists-root")) { - buffer_printf(buf, sizeof(buf) - 1, "%s/lists", get_string("listserver-data")); - set_var("lists-root", buf, VAR_GLOBAL); - } else { - const char *listsroot = get_var_unexpanded("lists-root"); - - /* redirect lists-root to be relative to listserver-data */ - buffer_printf(buf, sizeof(buf) - 1, "%s/%s", get_string("listserver-data"), listsroot); - set_var("lists-root", buf, VAR_GLOBAL); - } - - init_restricted_vars(); - - generate_queue(); - - - while(*argv) { - struct listserver_cmdarg *tmp = find_cmdarg(argv[0]); - if(!tmp) { - buffer_printf(buf, sizeof(buf) - 1, "Unrecognized command line argument '%s'.", argv[0]); - internal_error(buf); - errors = 1; - exitearly = 1; - break; - } else { - int res = tmp->fn(++argv, ++count); - if(res == CMDARG_ERR) { - exitearly = 1; - errors = 1; - break; - } else if(res == CMDARG_EXIT) { - exitearly = 1; - break; - } - argv += tmp->params; - } - } - - if(!exitearly) { - /* - * this has to go here so that cookies expire before they can be used - * if they are stale. It has to come after the argument parsing so - * that virtual host files are picked up correctly. - */ - log_printf(8, "Expiring old cookies.\n"); - expire_all_cookies(); - log_printf(8, "Done expiring old cookies.\n"); - wipe_vars(VAR_LIST|VAR_TEMP); - - /* - * Now, we need to initialize the list config file if we have a current - * list - */ - if(get_var("list")) list_read_conf(); - - if (init_queuefile()) { - if(parse_message() == PARSE_ERR) - errors = 1; - } - } - - finish_listserver(); - - if(!errors) - return 0; - else - return EX_TEMPFAIL; -} /* Bounce a message */ void bounce_message(void) @@ -1236,11 +1145,20 @@ const char *resolve_error(int error) { +#ifdef HAVE_STRERROR + return strerror(error); +#else +# ifdef HAVE_SYS_ERRLIST const char *tmp; - - if (error > sys_nerr) tmp = &def_err[0]; else tmp = sys_errlist[error]; - + if (error > sys_nerr) + tmp = def_err; + else + tmp = sys_errlist[error]; return tmp; +# else + return def_err; +# endif /* HAVE_SYS_ERRLIST */ +#endif /* HAVE_STRERROR */ } void nosuch(const char *listname) @@ -1256,27 +1174,27 @@ void get_date(char *buffer, int len, time_t now) { -#if defined(WIN32) || !defined(GNU_STRFTIME) +#if defined(WIN32) || !defined(HAVE_GNU_STRFTIME) char tstr[80]; # ifdef WIN32 static set_tz = 0; static TIME_ZONE_INFORMATION tzInfo; static long tzType; static long bias; -# endif -# ifdef NO_TM_GMTOFF +# else +# ifndef HAVE_STRUCT_TM_TM_ZONE static int set_tz = 0; static long bias; struct tm tmptime = *gmtime(&now); +# endif # endif #endif - struct tm *tm_now = localtime(&now); - + struct tm *tm_now = localtime(&now); #ifndef WIN32 -# ifdef GNU_STRFTIME +# ifdef HAVE_GNU_STRFTIME strftime(buffer, len - 1,"%a, %d %b %Y %H:%M:%S %z (%Z)",tm_now); # else -# ifdef NO_TM_GMTOFF +# ifndef HAVE_STRUCT_TM_TM_ZONE /* * This isn't the best answer, and I will need access to a solaris * box to get a better one @@ -1359,16 +1277,16 @@ } void do_sleep(int millis) { -#ifndef WIN32 -# ifdef NEED_USLEEP +#ifndef HAVE_USLEEP +# ifndef HAVE_SLEEP struct timeval tv; tv.tv_usec = millis * 1000; select(0, NULL, NULL, NULL, &tv); # else - usleep(millis*1000); + Sleep(millis); # endif #else - Sleep(millis); + usleep(millis*1000); #endif } Index: src/dynmod.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/dynmod.c,v retrieving revision 1.3 diff -u -r1.3 dynmod.c --- src/dynmod.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/dynmod.c 20 Aug 2003 05:58:06 -0000 @@ -1,14 +1,41 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H #include +#endif + +#ifdef HAVE_UNISTD_H #include +#endif + +#ifdef HAVE_DIRENT_H #include +#endif + +#ifdef HAVE_SYS_STAT_H #include +#endif /* All Our Happy Includes! */ #include "cmdarg.h" #include "command.h" +#include "common.h" #include "cookie.h" #include "core.h" #include "file.h" @@ -29,6 +56,7 @@ #include "user.h" #include "variables.h" #include "funcparse.h" +#include "xmalloc.h" /* And the API structure */ #include "lpm-api.h" @@ -37,33 +65,21 @@ extern struct LPMAPI API; -#if defined(__linux__) -#define HAS_DYNAMIC_LINK -#endif - -#if defined(BSDMOD) -#define HAS_DYNAMIC_LINK -#endif - -#if defined (BSDIMOD) -#define HAS_DYNAMIC_LINK -#endif - - -#ifndef HAS_DYNAMIC_LINK -#error Your OS has not been ported to Dynamic link yet. Undefine DYNMOD. -#endif +#ifdef USE_DYNMODS #ifndef MAX_FNAME #define MAX_FNAME 1024 #endif -#ifdef HAS_DYNAMIC_LINK +#ifdef HAVE_DLFCN_H #include -#ifndef _DL_FUNCPTR_DEFINED +#endif + +#ifndef HAVE_DL_FUNCPTR typedef void (*dl_funcptr)(); #endif -#ifdef OBSDMOD + +#ifdef HAVE_UNDERSCORE_PREFIX #define LOAD_FUNCNAME_PATTERN "_%.200s_load" #define INIT_FUNCNAME_PATTERN "_%.200s_init" #define UNLOAD_FUNCNAME_PATTERN "_%.200s_unload" @@ -78,11 +94,7 @@ #define LISTUPGRADE_FUNCNAME_PATTERN "%.200s_upgradelist" #define SWITCH_FUNCNAME_PATTERN "%.200s_switch_context" #endif -#endif /* HAS_DYNAMIC_LINK */ -#ifdef OBSDMOD -# define RTLD_LISTSERVER 0 -#endif #ifndef RTLD_LISTSERVER # ifdef RTLD_GLOBAL # ifdef RTLD_NOW @@ -93,12 +105,14 @@ # else # ifdef RTLD_NOW # define RTLD_LISTSERVER (RTLD_NOW) -# else -# error Could not find appropriate definition for RTLD_LISTSERVER. # endif # endif #endif +#ifndef RTLD_LISTSERVER +#define RTLD_LISTSERVER 0 +#endif + struct listserver_modref *mod_handles; /* Initialize module references */ @@ -112,9 +126,9 @@ { struct listserver_modref *tempref; - tempref = (struct listserver_modref *)malloc(sizeof(struct listserver_modref)); + tempref = (struct listserver_modref *)xmalloc(sizeof(struct listserver_modref)); tempref->handle = handle; - tempref->name = strdup(name); + tempref->name = xstrdup(name); tempref->next = mod_handles; mod_handles = tempref; } @@ -153,7 +167,7 @@ return -1; } buffer_printf(funcname, sizeof(funcname) - 1, LOAD_FUNCNAME_PATTERN, modname); - loadFunc = dlsym(dlHandle, funcname); + loadFunc = (dl_funcptr) dlsym(dlHandle, funcname); if(loadFunc) { (*loadFunc)(&API); add_modref(dlHandle, modname); @@ -174,7 +188,7 @@ tempref = mod_handles; while(tempref) { buffer_printf(funcname, sizeof(funcname) - 1, INIT_FUNCNAME_PATTERN, tempref->name); - initFunc = dlsym(tempref->handle, funcname); + initFunc = (dl_funcptr) dlsym(tempref->handle, funcname); if(initFunc) (*initFunc)(); tempref = tempref->next; @@ -192,7 +206,7 @@ tempref = mod_handles; while(tempref) { buffer_printf(funcname, sizeof(funcname) - 1, UNLOAD_FUNCNAME_PATTERN, tempref->name); - unloadFunc = dlsym(tempref->handle, funcname); + unloadFunc = (dl_funcptr) dlsym(tempref->handle, funcname); if(unloadFunc) (*unloadFunc)(); tempref = tempref->next; @@ -210,7 +224,7 @@ tempref = mod_handles; while(tempref) { buffer_printf(funcname, sizeof(funcname) - 1, UPGRADE_FUNCNAME_PATTERN, tempref->name); - upgradeFunc = dlsym(tempref->handle, funcname); + upgradeFunc = (dl_funcptr) dlsym(tempref->handle, funcname); if(upgradeFunc) (*upgradeFunc)(prev, cur); tempref = tempref->next; @@ -228,7 +242,7 @@ tempref = mod_handles; while(tempref) { buffer_printf(funcname, sizeof(funcname) - 1, LISTUPGRADE_FUNCNAME_PATTERN, tempref->name); - upgradeFunc = dlsym(tempref->handle, funcname); + upgradeFunc = (dl_funcptr) dlsym(tempref->handle, funcname); if(upgradeFunc) (*upgradeFunc)(prev, cur); tempref = tempref->next; @@ -246,7 +260,7 @@ tempref = mod_handles; while(tempref) { buffer_printf(funcname, sizeof(funcname) - 1, SWITCH_FUNCNAME_PATTERN, tempref->name); - switchFunc = dlsym(tempref->handle, funcname); + switchFunc = (dl_funcptr) dlsym(tempref->handle, funcname); if(switchFunc) (*switchFunc)(); tempref = tempref->next; @@ -263,7 +277,7 @@ int status; LDIR mydir; - status = walk_dir(get_string("listserver-modules"), &modname[0], &mydir); + status = walk_dir(get_string("listserver-modules"), modname, sizeof(modname), &mydir); while(status) { if(strcasestr(modname, ".lpm")) { @@ -281,3 +295,7 @@ } return 1; } +#else /* USE_DYNMODS */ + static int dummy; /* C89 */ +#endif + Index: src/file.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/file.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 file.c --- src/file.c 5 Aug 2001 21:15:27 -0000 1.1.1.1 +++ src/file.c 20 Aug 2003 05:58:06 -0000 @@ -2,7 +2,9 @@ #include #include +#include "config.h" #include "file.h" +#include "xmalloc.h" struct list_file *listfilerec; @@ -43,10 +45,10 @@ temp = find_file(filename); if (!temp) { - temp = (struct list_file *)malloc(sizeof(struct list_file)); - temp->name = strdup(filename); - temp->varname = strdup(varname); - temp->desc = strdup(desc); + temp = (struct list_file *)xmalloc(sizeof(struct list_file)); + temp->name = xstrdup(filename); + temp->varname = xstrdup(varname); + temp->desc = xstrdup(desc); temp->flags = flags; temp->next = listfilerec; listfilerec = temp; Index: src/fileapi.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/fileapi.c,v retrieving revision 1.5 diff -u -r1.5 fileapi.c --- src/fileapi.c 5 Apr 2003 04:44:24 -0000 1.5 +++ src/fileapi.c 20 Aug 2003 05:58:06 -0000 @@ -1,22 +1,53 @@ -#include +#include "config.h" + +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_ERRNO_H #include +#endif +#ifdef HAVE_TIME_H #include +#endif +#if defined( TIME_WITH_SYS_TIME ) && defined( HAVE_SYS_TIME_H ) +#include +#endif +#ifdef HAVE_SYS_STAT_H #include - -#ifndef WIN32 +#endif +#ifdef HAVE_SYS_FILE_H #include +#endif +#if defined( TIME_WITH_SYS_TIME ) && defined( HAVE_SYS_TIME_H ) #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_FCNTL_H #include -#else +#endif +#ifdef HAVE_IO_H /* W32 */ #include -#include -#endif /* WIN32 */ +#endif +#ifdef HAVE_SHARE_H +#include /* WIN32 */ +#endif #include "core.h" + +#include "common.h" #include "compat.h" + #include "fileapi.h" #include "mystring.h" #include "variables.h" @@ -25,17 +56,12 @@ #define MAX_FNAME 1024 #endif -#ifdef NEED_STRERROR +#ifndef HAVE_STRERROR #define strerror(a) sys_errlist[(a)] #endif #ifdef USE_HITCHING_LOCK -/* This should probably be more global, but for now, this is okay */ -#ifdef NO_MEMMOVE -#define memmove(dst, src, len) bcopy(src, dst, len) -#endif - #ifndef MAXHOSTNAMELEN #define MAXHOSTNAMELEN 256 #endif @@ -110,6 +136,7 @@ unlink(hitchfile); if (res != -1 || sb.st_nlink == 2) { /* success */ + /* FIXME */ if ((lockfiles[openfiles].lockfn = strdup(lockfile)) == NULL) { unlink(lockfile); return -1; @@ -200,7 +227,7 @@ #ifndef WIN32 int file_lock (int fd, int operation) { -#ifndef NEED_FLOCK +#ifdef HAVE_FLOCK while (flock(fd, operation) == -1) { log_printf(10, "Error gaining %s flock lock: (%s)\n", (operation & LOCK_NB) ? "non-blocking" : "blocking", @@ -237,7 +264,7 @@ if (operation & LOCK_NB) return -1; } return 0; -#endif /* NEED_FLOCK */ +#endif /* HAVE_FLOCK */ } #endif /* WIN32 */ @@ -425,7 +452,7 @@ return 1; } -int walk_dir(const char *path, char *buffer, LDIR *dir) +int walk_dir(const char *path, char *buffer, int bufsize, LDIR *dir) { #ifndef WIN32 struct dirent *dp; @@ -443,7 +470,7 @@ if (dp) { log_printf(15,"DIRWALK: found (%s)\n", dp->d_name); - buffer_printf(buffer, BIG_BUF - 1, "%s", dp->d_name); + buffer_printf(buffer, bufsize - 1, "%s", dp->d_name); *dir = dw_df; return 1; } else { Index: src/flag.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/flag.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 flag.c --- src/flag.c 5 Aug 2001 21:15:28 -0000 1.1.1.1 +++ src/flag.c 20 Aug 2003 05:58:06 -0000 @@ -1,10 +1,28 @@ -#include +#include "config.h" + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_CTYPE_H #include +#endif -#include "config.h" +#include "common.h" #include "flag.h" +#include "xmalloc.h" struct listserver_flag *flagdata; @@ -41,9 +59,9 @@ if (!tempflag) { char *tptr; - tempflag = (struct listserver_flag *)malloc(sizeof(struct listserver_flag)); - tempflag->name = strdup(name); - tempflag->desc = strdup(desc); + tempflag = (struct listserver_flag *)xmalloc(sizeof(struct listserver_flag)); + tempflag->name = xstrdup(name); + tempflag->desc = xstrdup(desc); tptr = tempflag->name; while(*tptr) { Index: src/forms.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/forms.c,v retrieving revision 1.3 diff -u -r1.3 forms.c --- src/forms.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/forms.c 20 Aug 2003 05:58:06 -0000 @@ -2,13 +2,18 @@ #include #include -#ifndef WIN32 +#include "config.h" + +#ifdef HAVE_SYS_TIME_H #include +#endif + +#ifdef HAVE_UNISTD_H #include -#endif /* WIN32 */ +#endif #include "core.h" -#include "config.h" +#include "common.h" #include "smtp.h" #include "list.h" #include "variables.h" Index: src/funcparse.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/funcparse.c,v retrieving revision 1.3 diff -u -r1.3 funcparse.c --- src/funcparse.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/funcparse.c 20 Aug 2003 05:58:06 -0000 @@ -1,21 +1,40 @@ -#include +#include "config.h" + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_CTYPE_H #include -#include "config.h" +#endif + +#include "common.h" #include "core.h" #include "liscript.h" #include "variables.h" #include "funcparse.h" #include "mystring.h" +#include "xmalloc.h" struct listserver_funcdef *funcs = NULL; void add_func(const char *name, int nargs, const char *desc, FuncFn fn) { - struct listserver_funcdef *temp = (struct listserver_funcdef *)malloc(sizeof (struct listserver_funcdef)); - temp->funcname = strdup(name); - temp->desc = strdup(desc); + struct listserver_funcdef *temp = (struct listserver_funcdef *)xmalloc(sizeof (struct listserver_funcdef)); + temp->funcname = xstrdup(name); + temp->desc = xstrdup(desc); temp->nargs = nargs; temp->fn = fn; temp->next = funcs; @@ -56,38 +75,38 @@ return NULL; } -int parse_function(const char *buf, char *result, char *error); +int parse_function(const char *buf, char *result, int ressize, char *error, int errsize); -int eval_literal(const char *buf, char *result, char *error) +int eval_literal(const char *buf, char *result, int ressize, char *error, int errsize) { while(*buf && isspace((int)*buf)) buf++; log_printf(20, "eval_litaral -- evaluating '%s'\n", buf); if(!*buf) { /* No value isn't legal */ - strncpy(result, "0", BIG_BUF - 1); - if(error) strncpy(error, "No value present", BIG_BUF - 1); + strncpy(result, "0", ressize - 1); + if(error) strncpy(error, "No value present", errsize - 1); return 0; } else if(*buf == '$') { /* Treat it as a variable */ char varbuf[BIG_BUF]; int res; buffer_printf(varbuf, sizeof(varbuf) - 1, "[%s]", buf); - res = liscript_parse_line(varbuf, result, BIG_BUF - 1); + res = liscript_parse_line(varbuf, result, ressize - 1); if(!res) { - strncpy(result, "0", BIG_BUF - 1); - if(error) buffer_printf(error, BIG_BUF - 1, "Unable to parse variable '%s'", buf); + strncpy(result, "0", ressize - 1); + if(error) buffer_printf(error, errsize - 1, "Unable to parse variable '%s'", buf); } else { log_printf(20, "eval_litaral -- var evaled to '%s'\n", result); } return res; } else { - strncpy(result, buf, BIG_BUF - 1); + strncpy(result, buf, ressize - 1); if(!strcasecmp(result, "yes") || !strcasecmp(result, "true") || !strcasecmp(result, "no") || !strcasecmp(result, "false")) { if(!strcasecmp(result, "yes") || !strcasecmp(result, "true")) - strncpy(result, "1", BIG_BUF - 1); + strncpy(result, "1", ressize - 1); else - strncpy(result, "0", BIG_BUF - 1); + strncpy(result, "0", ressize - 1); log_printf(20, "eval_literal -- boolean evaled to '%s'\n", result); } else { log_printf(20, "eval_literal -- literal evaled to '%s'\n", result); @@ -96,7 +115,7 @@ return 1; } -int parse_args(const char *buf, char **argv, char *error) +int parse_args(const char *buf, char **argv, char *error, int errsize) { char curarg[BIG_BUF]; int is_func = 0; @@ -108,7 +127,7 @@ /* Sanity check */ if(!argv) { - if(error) strncpy(error, "Argv was null to parse_args.", BIG_BUF - 1); + if(error) strncpy(error, "Argv was null to parse_args.", errsize - 1); return 0; } @@ -118,7 +137,7 @@ if(*buf == ',' && depth == 0) { /* We should have an argument */ if(!curarg[0]) { - if(error) strncpy(error, "Empty argument passed.", BIG_BUF - 1); + if(error) strncpy(error, "Empty argument passed.", errsize - 1); return 0; } @@ -128,14 +147,14 @@ /* Evaluate the argument */ if(is_func) { - res = parse_function(curarg, tempres, error); + res = parse_function(curarg, tempres, sizeof(tempres), error, errsize); if(!res) return 0; } else { - res = eval_literal(curarg, tempres, error); + res = eval_literal(curarg, tempres, sizeof(tempres), error, errsize); if(!res) return 0; } /* Build the result string */ - argv[count++] = strdup(tempres); + argv[count++] = xstrdup(tempres); memset(curarg, 0, sizeof(curarg)); is_func = 0; arg = curarg; @@ -151,37 +170,37 @@ /* Copy over the last arg */ if(!curarg[0]) { - if(error) strncpy(error, "Empty argument passed.", BIG_BUF - 1); + if(error) strncpy(error, "Empty argument passed.", errsize - 1); return 0; } /* Evaluate the argument */ if(is_func) { - res = parse_function(curarg, tempres, error); + res = parse_function(curarg, tempres, sizeof(tempres), error, errsize); if(!res) return 0; } else { - res = eval_literal(curarg, tempres, error); + res = eval_literal(curarg, tempres, sizeof(tempres), error, errsize); if(!res) return 0; } /* Build the result string */ - argv[count++] = strdup(tempres); + argv[count++] = xstrdup(tempres); return 1; } -int parse_function(const char *buf, char *result, char *error) +int parse_function(const char *buf, char *result, int ressize, char *error, int errsize) { char *temp = NULL; char buf1[BIG_BUF]; /* sanity check */ if(!result) { - if(error) strncpy(error, "Result buffer required.", BIG_BUF - 1); + if(error) strncpy(error, "Result buffer required.", errsize - 1); return 0; } /* Check for an initial buffer */ if(!buf) { - strncpy(result, "0", BIG_BUF - 1); - if(error) strncpy(error, "No initial buffer", BIG_BUF - 1); + strncpy(result, "0", ressize - 1); + if(error) strncpy(error, "No initial buffer", errsize - 1); return 0; } @@ -194,8 +213,8 @@ while(*temp && *temp != '(') temp++; if(!*temp) { /* No function found, treat as literal */ - int res = eval_literal(buf, result, error); - if(!res) strncpy(result, "0", BIG_BUF - 1); + int res = eval_literal(buf, result, ressize, error, errsize ); + if(!res) strncpy(result, "0", ressize - 1); return res; } else { /* there is a function name, look it up */ @@ -208,8 +227,8 @@ log_printf(20, "parse_function -- Evaluating function '%s'\n", buf1); if(!funcdef) { /* No such function */ - strncpy(result, "0", BIG_BUF - 1); - if(error) buffer_printf(error, BIG_BUF - 1,"No such function as '%s'", buf1); + strncpy(result, "0", ressize - 1); + if(error) buffer_printf(error, errsize - 1,"No such function as '%s'", buf1); return 0; } else { /* Okay.. We have a valid function. Let's build the arg buf */ @@ -239,16 +258,16 @@ /* Make sure we ended at depth 0 */ if(depth != 0) { - strncpy(result, "0", BIG_BUF - 1); - if(error) strncpy(error, "Missing end parenthesis", BIG_BUF - 1); + strncpy(result, "0", ressize - 1); + if(error) strncpy(error, "Missing end parenthesis", errsize - 1); return 0; } /* Check the argument count */ if(count != funcdef->nargs) { - strncpy(result, "0", BIG_BUF - 1); + strncpy(result, "0", ressize - 1); if(error) - buffer_printf(error, BIG_BUF - 1, "Function '%s' has %d args, %d found", + buffer_printf(error, errsize - 1, "Function '%s' has %d args, %d found", funcdef->funcname, funcdef->nargs, count); return 0; } @@ -260,18 +279,18 @@ */ while(isspace((int)*temp)) temp++; if(*temp) { - strncpy(result, "0", BIG_BUF - 1); - if(error) strncpy(error, "Garbage past end of expression", BIG_BUF - 1); + strncpy(result, "0", ressize - 1); + if(error) strncpy(error, "Garbage past end of expression", errsize - 1); return 0; } if(funcdef->nargs) { argv = (char **)calloc(funcdef->nargs, sizeof(char *)); for(i = 0; i < funcdef->nargs; i++) argv[i] = NULL; - count = parse_args(argbuf, argv, error); + count = parse_args(argbuf, argv, error, errsize); if(!count) { /* Error should be filled out by parse_args */ - strncpy(result, "0", BIG_BUF - 1); + strncpy(result, "0", ressize - 1); /* Deallocate argv and any values it has */ for(i = 0; i < funcdef->nargs; i++) if(argv[i]) free(argv[i]); @@ -279,13 +298,13 @@ return 0; } } - count = funcdef->fn(argv, result, error); + count = funcdef->fn(argv, result, ressize, error, errsize); /* * If count is 0 here we had an error in the function and * want to wipe result. Error should be filled by function * called. */ - if(!count) strncpy(result, "0", BIG_BUF - 1); + if(!count) strncpy(result, "0", ressize - 1); if(funcdef->nargs) { /* Deallocate argv and any values it has */ for(i = 0; i < funcdef->nargs; i++) Index: src/hooks.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/hooks.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 hooks.c --- src/hooks.c 5 Aug 2001 21:15:28 -0000 1.1.1.1 +++ src/hooks.c 20 Aug 2003 05:58:06 -0000 @@ -2,10 +2,12 @@ #include #include -#include "hooks.h" #include "config.h" +#include "hooks.h" +#include "common.h" #include "core.h" #include "variables.h" +#include "xmalloc.h" struct listserver_hook *hooks = NULL; @@ -37,9 +39,9 @@ { struct listserver_hook *temp, **temp2; - temp = (struct listserver_hook *)malloc(sizeof(struct listserver_hook)); + temp = (struct listserver_hook *)xmalloc(sizeof(struct listserver_hook)); - temp->type = strdup(type); + temp->type = xstrdup(type); temp->priority = priority; temp->hook = hook; @@ -61,7 +63,7 @@ oldhooktype = NULL; if (get_var("hooktype")) { - oldhooktype = strdup(get_var("hooktype")); + oldhooktype = xstrdup(get_var("hooktype")); } count = 0; Index: src/internal.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/internal.c,v retrieving revision 1.7 diff -u -r1.7 internal.c --- src/internal.c 13 Mar 2003 01:29:18 -0000 1.7 +++ src/internal.c 20 Aug 2003 05:58:06 -0000 @@ -1,11 +1,26 @@ +#include "config.h" + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_CTYPE_H #include +#endif -#ifndef WIN32 +#ifdef HAVE_UNISTD_H #include -#endif /* WIN32 */ +#endif +#include "common.h" #include "core.h" #include "cmdarg.h" #include "modes.h" Index: src/io.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/io.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 io.c --- src/io.c 5 Aug 2001 21:15:29 -0000 1.1.1.1 +++ src/io.c 20 Aug 2003 05:58:06 -0000 @@ -1,24 +1,54 @@ +#include "config.h" + +#ifdef HAVE_STDIO_H #include +#endif +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STDARG_H #include +#endif +#ifdef HAVE_TIME_H +#include +#endif +#if defined( TIME_WITH_SYS_TIME ) && defined( HAVE_SYS_TIME_H ) #include +#endif +#ifdef HAVE_SYS_TYPES_H #include +#endif +#ifdef HAVE_SYS_SOCKET_H #include +#endif +#ifdef HAVE_NETINET_IN_H #include +#endif +#ifdef HAVE_NETDB_H #include +#endif +#ifdef HAVE_UNISTD_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_FCNTL_H #include +#endif +#ifdef HAVE_ERRNO_H #include - -#ifdef IRIX_IS_CRAP -#include -#endif /* IRIX_IS_CRAP */ +#endif #include "compat.h" +#include "common.h" #include "core.h" #include "sockio.h" #include "variables.h" +#include "mystring.h" /* Write a formatted string to a socket */ int sock_printf(LSOCKET sock, char *format, ...) @@ -30,10 +60,10 @@ if (sock == -1) return 0; va_start(vargs, format); - vsprintf(mybuf, format, vargs); + buffer_printf(mybuf, HUGE_BUF, format, vargs); va_end(vargs); - result = write(sock, &mybuf[0], strlen(mybuf)); + result = write(sock, mybuf, strlen(mybuf)); /* Ricardo-debug */ log_printf(10, "IO OUT: %s\n", mybuf); @@ -130,7 +160,7 @@ name.sin_port = htons(port); name.sin_family = AF_INET; - bcopy((char *)conhost->h_addr, (char *)&name.sin_addr, conhost->h_length); + memmove((char *)&name.sin_addr, (char *)conhost->h_addr, conhost->h_length); mysock = socket(AF_INET, SOCK_STREAM, 0); addr_len = sizeof(name); Index: src/lcgi.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/lcgi.c,v retrieving revision 1.4 diff -u -r1.4 lcgi.c --- src/lcgi.c 9 Mar 2003 22:03:26 -0000 1.4 +++ src/lcgi.c 20 Aug 2003 05:58:07 -0000 @@ -1,13 +1,25 @@ -#include +#include "config.h" + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif #include "core.h" -#include "config.h" +#include "common.h" #include "fileapi.h" #include "lcgi.h" #include "liscript.h" #include "mystring.h" #include "variables.h" +#include "xmalloc.h" struct listserver_cgi_hook *cgi_hooks; struct listserver_cgi_mode *cgi_modes; @@ -36,10 +48,10 @@ { struct listserver_cgi_hook *temphook; - temphook = (struct listserver_cgi_hook *)malloc(sizeof(struct + temphook = (struct listserver_cgi_hook *)xmalloc(sizeof(struct listserver_cgi_hook)); - temphook->name = strdup(name); + temphook->name = xstrdup(name); temphook->hook = function; temphook->next = cgi_hooks; @@ -199,10 +211,10 @@ { struct listserver_cgi_mode *temphook; - temphook = (struct listserver_cgi_mode *)malloc(sizeof(struct + temphook = (struct listserver_cgi_mode *)xmalloc(sizeof(struct listserver_cgi_mode)); - temphook->name = strdup(name); + temphook->name = xstrdup(name); temphook->mode = function; temphook->next = cgi_modes; @@ -248,11 +260,11 @@ { struct listserver_cgi_tempvar *tempvar; - tempvar = (struct listserver_cgi_tempvar *)malloc(sizeof(struct + tempvar = (struct listserver_cgi_tempvar *)xmalloc(sizeof(struct listserver_cgi_tempvar)); - tempvar->name = strdup(name); - tempvar->value = strdup(val); + tempvar->name = xstrdup(name); + tempvar->value = xstrdup(val); tempvar->next = cgi_tempvars; cgi_tempvars = tempvar; Index: src/liscript.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/liscript.c,v retrieving revision 1.3 diff -u -r1.3 liscript.c --- src/liscript.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/liscript.c 20 Aug 2003 05:58:07 -0000 @@ -1,22 +1,50 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STDARG_H +#include +#endif + +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_CTYPE_H #include -#include +#endif + +#ifdef HAVE_TIME_H #include -#ifndef WIN32 +#endif + +#if defined(TIME_WITH_SYS_TIME) && defined(HAVE_SYS_TIME_H) #include +#endif + +#ifdef HAVE_UNISTD_H #include #endif -#include #include "core.h" -#include "config.h" +#include "common.h" #include "mystring.h" #include "fileapi.h" #include "variables.h" #include "liscript.h" #include "funcparse.h" #include "userstat.h" +#include "xmalloc.h" #define LPARSE_NORMAL 0 #define LPARSE_PREBLOCK 1 @@ -259,7 +287,7 @@ } */ } - outptr = strdup(tempbuffer); + outptr = xstrdup(tempbuffer); return outptr; } @@ -624,7 +652,7 @@ if (logicparam) { char resbuf[BIG_BUF]; char errbuf[BIG_BUF]; - res = parse_function(logicparam, resbuf, errbuf); + res = parse_function(logicparam, resbuf, BIG_BUF, errbuf, BIG_BUF); if(res) { log_printf(15, "Function '%s' eval to '%s'\n", logicparam, resbuf); ifresult = !(!(atoi(resbuf))); @@ -1116,7 +1144,7 @@ if (logicparam) { char resbuf[BIG_BUF]; char errbuf[BIG_BUF]; - res = parse_function(logicparam, resbuf, errbuf); + res = parse_function(logicparam, resbuf, BIG_BUF, errbuf, BIG_BUF); if(res) { log_printf(15, "Function '%s' eval to '%s'\n", logicparam, resbuf); ifresult = !(!(atoi(resbuf))); @@ -1315,7 +1343,7 @@ if (logicparam) { char resbuf[BIG_BUF]; char errbuf[BIG_BUF]; - res = parse_function(logicparam, resbuf, errbuf); + res = parse_function(logicparam, resbuf, BIG_BUF, errbuf, BIG_BUF); if(res) { log_printf(15, "Function '%s' eval to '%s'\n", logicparam, resbuf); ifresult = !(!(atoi(resbuf))); Index: src/list.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/list.c,v retrieving revision 1.3 diff -u -r1.3 list.c --- src/list.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/list.c 20 Aug 2003 05:58:07 -0000 @@ -1,16 +1,39 @@ +#include "config.h" + +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_CTYPE_H #include +#endif + +#ifdef HAVE_STRING_H #include -#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif -#ifndef WIN32 +#ifdef HAVE_UNISTD_H #include +#endif + +#ifdef HAVE_SYS_STAT_H #include -#endif // WIN32 +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif #include "list.h" -#include "config.h" +#include "common.h" #include "smtp.h" #include "user.h" #include "core.h" @@ -20,6 +43,7 @@ #include "lpm-mods.h" #include "submodes.h" #include "cookie.h" +#include "xmalloc.h" /* Get the list directory -- must be freed */ char *list_directory(const char *listname) @@ -39,7 +63,7 @@ free(tlistname); /* Return a list directory */ - return strdup(buffer); + return xstrdup(buffer); } /* Shorthand, because I got tired of using list_directory everywhere */ @@ -345,15 +369,15 @@ void push_dirstack(LDIR dir, const char *path) { - struct d_ent *tmp = (struct d_ent *)malloc(sizeof(struct d_ent)); + struct d_ent *tmp = (struct d_ent *)xmalloc(sizeof(struct d_ent)); tmp->next = dirs; tmp->dir = dir; - tmp->path = strdup(path); + tmp->path = xstrdup(path); log_printf(15, "push_dirstack: pushed %s\n", path); dirs = tmp; } -int step_list(char *buffer, int status, int readfirst) +int step_list(char *buffer, int bufsize, int status, int readfirst) { LDIR tmp = peek_dirstack(); const char *path = get_dirstack_path(); @@ -371,9 +395,9 @@ return 1; else { buffer_printf(buf, sizeof(buf) - 1, "%s/%s", path, buffer); - status = walk_dir(buf, buffer, &tmp); + status = walk_dir(buf, buffer, bufsize, &tmp); push_dirstack(tmp, buf); - return step_list(buffer, status, 0); + return step_list(buffer, bufsize, status, 0); } } } @@ -389,16 +413,16 @@ return 0; } -int walk_lists(char *buffer) +int walk_lists(char *buffer, int bufsize) { LDIR tmp; - int status = walk_dir(get_string("lists-root"), buffer, &tmp); + int status = walk_dir(get_string("lists-root"), buffer, bufsize, &tmp); if(!status) return status; push_dirstack(tmp, get_string("lists-root")); - return step_list(buffer, status, 0); + return step_list(buffer, bufsize, status, 0); } -int next_lists(char *buffer) +int next_lists(char *buffer, int bufsize) { - return step_list(buffer, 1, 1); + return step_list(buffer, bufsize, 1, 1); } Index: src/lma.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/lma.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lma.c --- src/lma.c 5 Aug 2001 21:15:29 -0000 1.1.1.1 +++ src/lma.c 20 Aug 2003 05:58:07 -0000 @@ -1,6 +1,9 @@ /* Module API */ /* All Our Happy Includes! */ +#include "config.h" +#include "common.h" + #include "alias.h" #include "cmdarg.h" #include "command.h" Index: src/main.c =================================================================== RCS file: src/main.c diff -N src/main.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/main.c 20 Aug 2003 05:58:07 -0000 @@ -0,0 +1,232 @@ +#include "config.h" + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STDARG_H +#include +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef HAVE_POLL_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#if defined(TIME_WITH_SYS_TIME) && defined(HAVE_SYS_TIME_H) +#include +#endif + +#ifdef HAVE_SYS_STAT_H +#include +#endif + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_NETDB_H +#include +#endif + +#ifdef HAVE_PWD_H +#include +#endif + +#ifdef HAVE_WINSOCK2_H +#include +#endif + +/* Fix for brain-dead IRIX system headers */ +#undef EX_OK + +#ifdef HAVE_SYSEXITS_H +#include +#endif + +#include "alias.h" +#include "list.h" +#include "common.h" +#include "command.h" +#include "parse.h" +#include "init.h" +#include "forms.h" +#include "flag.h" +#include "file.h" +#include "regexp.h" +#include "smtp.h" +#include "lpm-mods.h" +#include "fileapi.h" +#include "variables.h" +#include "core.h" +#include "cookie.h" +#include "cmdarg.h" +#include "internal.h" +#include "modes.h" +#include "mysignal.h" +#include "hooks.h" +#include "user.h" +#include "tolist.h" +#include "compat.h" +#include "unmime.h" +#include "liscript.h" +#include "mystring.h" +#include "submodes.h" +#include "lcgi.h" +#include "funcparse.h" +#include "trust.h" + + + + +extern void build_lpm_api(); + +extern char pathname[BIG_BUF]; + +int main (int argc, char** argv) +{ + char *temp; + int errors = 0; + int exitearly = 0; + int count = 0; + char buf[BIG_BUF]; + + buffer_printf(pathname, sizeof(pathname) - 1, "%s", argv[0]); + temp = strrchr(pathname, '/'); + +#ifdef HAVE_STRRCHR + if(!temp) + temp = strrchr(pathname, '\\'); +#endif + + if (temp) + *(temp) = '\0'; + else + buffer_printf(pathname, sizeof(pathname) - 1, "."); + + argv++; + + init_signals(); + init_listserver(); + + new_flags(); + new_commands(); + new_hooks(); + new_files(); + new_cmdargs(); + new_modes(); + new_tolist(); + new_mime_handlers(); + new_submodes(); + new_cgi_hooks(); + new_cgi_modes(); + new_cgi_tempvars(); + new_funcs(); + + init_internal(); + build_lpm_api(); +#ifdef DYNMOD + log_printf(9,"Preparing to load dynamic modules...\n"); + init_modrefs(); +#endif + log_printf(9,"Loading modules...\n"); + load_all_modules(); + /* + * Reload the global config file to pick up any variables defined by + * the modules + */ + read_conf(GLOBAL_CFG_FILE, VAR_GLOBAL); + log_printf(9,"Initializing modules...\n"); + init_all_modules(); + + if(!get_var("lists-root")) { + buffer_printf(buf, sizeof(buf) - 1, "%s/lists", get_string("listserver-data")); + set_var("lists-root", buf, VAR_GLOBAL); + } else { + const char *listsroot = get_var_unexpanded("lists-root"); + + /* redirect lists-root to be relative to listserver-data */ + buffer_printf(buf, sizeof(buf) - 1, "%s/%s", get_string("listserver-data"), listsroot); + set_var("lists-root", buf, VAR_GLOBAL); + } + + init_restricted_vars(); + + generate_queue(); + + + while(*argv) { + struct listserver_cmdarg *tmp = find_cmdarg(argv[0]); + if(!tmp) { + buffer_printf(buf, sizeof(buf) - 1, "Unrecognized command line argument '%s'.", argv[0]); + internal_error(buf); + errors = 1; + exitearly = 1; + break; + } else { + int res = tmp->fn(++argv, ++count); + if(res == CMDARG_ERR) { + exitearly = 1; + errors = 1; + break; + } else if(res == CMDARG_EXIT) { + exitearly = 1; + break; + } + argv += tmp->params; + } + } + + if(!exitearly) { + /* + * this has to go here so that cookies expire before they can be used + * if they are stale. It has to come after the argument parsing so + * that virtual host files are picked up correctly. + */ + log_printf(8, "Expiring old cookies.\n"); + expire_all_cookies(); + log_printf(8, "Done expiring old cookies.\n"); + wipe_vars(VAR_LIST|VAR_TEMP); + + /* + * Now, we need to initialize the list config file if we have a current + * list + */ + if(get_var("list")) list_read_conf(); + + if (init_queuefile()) { + if(parse_message() == PARSE_ERR) + errors = 1; + } + } + + finish_listserver(); + + if(!errors) + return 0; + else + return EX_TEMPFAIL; +} Index: src/moderate.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/moderate.c,v retrieving revision 1.6 diff -u -r1.6 moderate.c --- src/moderate.c 27 Feb 2003 23:49:24 -0000 1.6 +++ src/moderate.c 20 Aug 2003 05:58:08 -0000 @@ -1,7 +1,22 @@ +#include "config.h" + +#ifdef HAVE_STRING_H #include -#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif +#include "common.h" #include "fileapi.h" #include "variables.h" #include "list.h" @@ -104,7 +119,7 @@ free(listdir); - if (!request_cookie(cookiefile,&cookie[0], 'M', tfilebuf)) { + if (!request_cookie(cookiefile, cookie, BIG_BUF, 'M', tfilebuf)) { filesys_error(cookiefile); close_file(newfile); unlink_file(tfilebuf); @@ -365,7 +380,7 @@ free(listdir); - if (verify_cookie(cookiefile, cookie, 'M', &cookiedata[0])) { + if (verify_cookie(cookiefile, cookie, 'M', cookiedata, BIG_BUF)) { gotcookie = 1; buffer_printf(corecookie, sizeof(corecookie) - 1, "%s", cookie); del_cookie(cookiefile,cookie); @@ -391,7 +406,7 @@ free(listdir); - if (verify_cookie(cookiefile, cookie, 'M', &cookiedata[0])) { + if (verify_cookie(cookiefile, cookie, 'M', cookiedata, BIG_BUF)) { FILE *infile2; char subbuffer[BIG_BUF]; @@ -504,7 +519,7 @@ free(listdir); - if (verify_cookie(cookiefile,cookie, 'M', &cookiedata[0])) { + if (verify_cookie(cookiefile,cookie, 'M', cookiedata, sizeof(cookiedata))) { gotcookie = 1; if (!exists_file(&cookiedata[0])) { Index: src/modes.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modes.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 modes.c --- src/modes.c 5 Aug 2001 21:15:29 -0000 1.1.1.1 +++ src/modes.c 20 Aug 2003 05:58:08 -0000 @@ -1,6 +1,19 @@ -#include +#include "config.h" + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + #include "modes.h" +#include "xmalloc.h" struct listserver_mode *modes = NULL; @@ -41,8 +54,9 @@ void add_mode(const char *mode, ModeFn fn) { struct listserver_mode *tmp; - tmp = (struct listserver_mode *)malloc(sizeof(struct listserver_mode)); - tmp->modename = strdup(mode); + tmp = (struct listserver_mode *)xmalloc(sizeof(struct listserver_mode)); + + tmp->modename = xstrdup(mode); tmp->modefn = fn; tmp->next = modes; Index: src/module.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/module.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 module.c --- src/module.c 5 Aug 2001 21:15:29 -0000 1.1.1.1 +++ src/module.c 20 Aug 2003 05:58:08 -0000 @@ -1,12 +1,24 @@ #include "config.h" -#include "module.h" +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif -#ifndef WIN32 +#ifdef HAVE_UNISTD_H #include -#endif // WIN32 +#endif + +#include "common.h" +#include "module.h" +#include "xmalloc.h" struct listserver_module *modules; @@ -36,9 +48,9 @@ { struct listserver_module *tempmod; - tempmod = (struct listserver_module *)malloc(sizeof(struct listserver_module)); - tempmod->name = strdup(name); - tempmod->desc = strdup(desc); + tempmod = (struct listserver_module *)xmalloc(sizeof(struct listserver_module)); + tempmod->name = xstrdup(name); + tempmod->desc = xstrdup(desc); tempmod->next = modules; modules = tempmod; } Index: src/mysignal.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/mysignal.c,v retrieving revision 1.2 diff -u -r1.2 mysignal.c --- src/mysignal.c 9 Nov 2001 07:58:14 -0000 1.2 +++ src/mysignal.c 20 Aug 2003 05:58:08 -0000 @@ -1,10 +1,11 @@ #include "config.h" +#include "common.h" #include "mysignal.h" #include #include -#ifndef WIN32 +#ifdef HAVE_SYSEXITS_H #include #endif Index: src/mystring.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/mystring.c,v retrieving revision 1.7 diff -u -r1.7 mystring.c --- src/mystring.c 11 Aug 2002 22:25:09 -0000 1.7 +++ src/mystring.c 20 Aug 2003 05:58:08 -0000 @@ -1,23 +1,42 @@ -#include +#include "config.h" + +#ifdef HAVE_STRING_H #include -#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H #include +#endif -#include "config.h" +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_CTYPE_H +#include +#endif + +#include "common.h" +#include "compat.h" #include "mystring.h" #include "snprintf.h" #include "core.h" +#include "xmalloc.h" -int buffer_printf(char *buffer, int length, char *format, ...) +int buffer_printf(char *buffer, int length, const char *format, ...) { va_list vargs; int fulllen; va_start(vargs, format); -#ifdef WIN32 +#ifdef HAVE__VSNPRINTF fulllen = _vsnprintf(buffer, length, format, vargs); #else -#ifdef NEED_SNPRINTF +#ifndef HAVE_VSNPRINTF fulllen = my_vsnprintf(buffer, length, format, vargs); #else fulllen = vsnprintf(buffer, length, format, vargs); @@ -30,7 +49,7 @@ /* This creates a NEW string, so it needs to be freed */ char *lowerstr(const char *str) { - char *ret = strdup(str); + char *ret = xstrdup(str); char *s = ret; while(*s) { *s = tolower(*s); @@ -42,7 +61,7 @@ /* This creates a NEW string, so it needs to be freed */ char *upperstr(const char *str) { - char *ret = strdup(str); + char *ret = xstrdup(str); char *s = ret; while(*s) { *s = toupper(*s); @@ -70,39 +89,31 @@ void strreplace(char *newstr, int len, const char *base, const char *orig, const char *replace) { -#ifndef WIN32 - char xbuf[len]; - char buf[len]; -#else char *xbuf, *buf; -#endif + int i = 0, j = 0; - int k; + int k = strlen(replace); + int olen = strlen(orig); + int blen = strlen(base); -#ifdef WIN32 - xbuf = (char *)malloc(len); - buf = (char *)malloc(len); -#endif + int totlen = blen + k + 1; - k = strlen(replace); + xbuf = (char *)xmalloc(totlen); + buf = (char *)xmalloc(totlen); -#ifndef WIN32 - bcopy(base, xbuf, strlen(base) + 1); -#else - memcpy(xbuf, base, strlen(base) + 1); -#endif + memmove(xbuf, base, blen + 1); buf[0] = '\0'; while (xbuf[i]) { - if (!strncmp(xbuf + i, orig, strlen(orig))) { + if (!strncmp(xbuf + i, orig, olen)) { if ((j + k + 1) < len) { strncat(buf, replace, len - 1 - strlen(buf)); - i += strlen(orig); + i += olen; j += k; } } else { - if ((j + 1) < len) { + if ((j + 1) < totlen) { buf[j++] = xbuf[i++]; buf[j] = '\0'; } @@ -110,48 +121,38 @@ } buffer_printf(newstr, len, "%s", buf); -#ifdef WIN32 if(xbuf) free(xbuf); if(buf) free(buf); -#endif } void strcasereplace(char *newstr, int len, const char *base, const char *orig, const char *replace) { -#ifndef WIN32 - char xbuf[len]; - char buf[len]; -#else char *xbuf, *buf; -#endif + int i = 0, j = 0; - int k; + int k = strlen(replace); + int olen = strlen(orig); + int blen = strlen(base); -#ifdef WIN32 - xbuf = (char *)malloc(len); - buf = (char *)malloc(len); -#endif + int totlen = blen + k + 1; - k = strlen(replace); + xbuf = (char *)xmalloc(totlen); + buf = (char *)xmalloc(totlen); -#ifndef WIN32 - bcopy(base, xbuf, strlen(base) + 1); -#else - memcpy(xbuf, base, strlen(base) + 1); -#endif + memmove(xbuf, base, blen + 1); buf[0] = '\0'; while (xbuf[i]) { - if (!strncasecmp(xbuf + i, orig, strlen(orig))) { + if (!strncasecmp(xbuf + i, orig, olen)) { if ((j + k + 1) < len) { strncat(buf, replace, len - 1 - strlen(buf)); - i += strlen(orig); + i += olen; j += k; } } else { - if ((j + 1) < len) { + if ((j + 1) < totlen) { buf[j++] = xbuf[i++]; buf[j] = '\0'; } @@ -159,10 +160,8 @@ } buffer_printf(newstr, len, "%s", buf); -#ifdef WIN32 free(xbuf); free(buf); -#endif } int address_match(const char *addy1, const char *addy2) @@ -234,30 +233,34 @@ } /* Strips off leading and trailing whitespace, if any */ +/* Length is implicit - the string mustn't grow */ void trim(char *instr) { char *tmpstr; + int i = strlen( instr ); unsigned int counter; /* Find first non-whitespace in the input string. */ - for (counter = 0; counter < strlen(instr); counter++) { + for (counter = 0; counter < i; counter++) { if (!isspace((int)instr[counter])) break; } if (counter) { /* If found leading whitespace... */ /* Copy the part after initial spaces to tmpstr. */ - tmpstr = strdup(instr + counter); + tmpstr = xstrdup(instr + counter); /* Now copy this back to instr, overwriting what was there. */ - strncpy(instr, tmpstr, BIG_BUF - 1); + strncpy(instr, tmpstr, i); free(tmpstr); /* And free the memory used. */ } - + + i -= counter; /* We've shortened the string */ + /* Now find any trailing whitespaces. */ - while (instr[0] && isspace((int)instr[strlen(instr) - 1])) - instr[strlen(instr) - 1] = 0; + while (instr[0] && isspace((int)instr[ i - 1])) + instr[ --i ] = 0; } Index: src/parse.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/parse.c,v retrieving revision 1.4 diff -u -r1.4 parse.c --- src/parse.c 11 Aug 2002 22:25:09 -0000 1.4 +++ src/parse.c 20 Aug 2003 05:58:08 -0000 @@ -1,13 +1,30 @@ -#include +#include "config.h" + +#ifdef HAVE_STRING_H #include -#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif -#ifndef WIN32 +#ifdef HAVE_CTYPE_H +#include +#endif + +#ifdef HAVE_UNISTD_H #include #endif -#include "config.h" +#include "common.h" #include "user.h" #include "list.h" #include "command.h" @@ -19,6 +36,7 @@ #include "variables.h" #include "modes.h" #include "mystring.h" +#include "xmalloc.h" FILE *adminspitfile; @@ -181,7 +199,7 @@ } mysize = strlen(input_line) + 3; - outparse = (char *)malloc(mysize); + outparse = (char *)xmalloc(mysize); memset(outparse,0,mysize); ptr2 = outparse; ptr = input_line; Index: src/passwd.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/passwd.c,v retrieving revision 1.3 diff -u -r1.3 passwd.c --- src/passwd.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/passwd.c 20 Aug 2003 05:58:08 -0000 @@ -1,22 +1,40 @@ #include "config.h" + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_CTYPE_H +#include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#ifdef HAVE_CRYPT_H +#include +#endif + +#include "common.h" #include "fileapi.h" #include "passwd.h" #include "variables.h" #include "mystring.h" #include "internal.h" #include "core.h" -#include - -#ifndef UNCRYPTED_PASS -/* Buuuuusted glibc behavior. Why can't I just include crypt without - getting linker errors anymore under glibc 2.1?? */ -#define __USE_XOPEN -#include - -# ifdef SUNOS_5 -# include -# endif -#endif void set_pass(const char *user, const char *newpass) { @@ -24,7 +42,7 @@ char buf[BIG_BUF]; char passbuf[BIG_BUF]; -#ifndef UNCRYPTED_PASS +#ifdef HAVE_CRYPT buffer_printf(passbuf, sizeof(passbuf) - 1, "^ %s", crypt(newpass, "SP")); #else buffer_printf(passbuf, sizeof(passbuf) - 1, "%s", newpass); @@ -127,7 +145,7 @@ if(p[strlen(p)-1] == '\n') p[strlen(p)-1] = '\0'; /* trounce the newline */ -#ifndef UNCRYPTED_PASS +#ifdef HAVE_CRYPT /* Check if we are a crypted password */ if(strncmp(p,"^ ",2) == 0) { char *pt, pbuffer[BIG_BUF]; Index: src/rfc2047.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/rfc2047.c,v retrieving revision 1.3 diff -u -r1.3 rfc2047.c --- src/rfc2047.c 14 Sep 2002 16:49:34 -0000 1.3 +++ src/rfc2047.c 20 Aug 2003 05:58:08 -0000 @@ -21,6 +21,7 @@ #include #include #include +#include "config.h" #include "core.h" #include "fileapi.h" #include "variables.h" @@ -273,10 +274,9 @@ } *d = 0; - if (strlen(d0) > (unsigned int)maxlen) { - d0[maxlen-1] = '\0'; - } - strcpy(dest, d0); + strncpy(dest, d0, maxlen-1); + dest[maxlen-1] = '\0'; + log_printf(5, "Subject: %s\n", dest); safe_free((void **)&d0); } Index: src/smtp.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/smtp.c,v retrieving revision 1.5 diff -u -r1.5 smtp.c --- src/smtp.c 14 Aug 2003 16:42:20 -0000 1.5 +++ src/smtp.c 20 Aug 2003 05:58:08 -0000 @@ -2,13 +2,16 @@ #include #include -#ifndef WIN32 +#include "config.h" +#ifdef HAVE_UNISTD_H #include -#else +#endif + +#ifdef HAVE_WINSOCK2_H #include #endif -#include "config.h" +#include "common.h" #include "sockio.h" #include "variables.h" #include "core.h" Index: src/snprintf.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/snprintf.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 snprintf.c --- src/snprintf.c 5 Aug 2001 21:15:30 -0000 1.1.1.1 +++ src/snprintf.c 20 Aug 2003 05:58:08 -0000 @@ -55,7 +55,8 @@ * up * **************************************************************/ -#ifdef NEED_SNPRINTF +#include "config.h" +#if !defined( HAVE_VSNPRINTF ) && !defined( HAVE__VSNPRINTF ) #include #include @@ -618,4 +619,6 @@ va_end(args); return(strlen(str)); } -#endif /* NEED_SNPRINTF */ +#else /* !defined( HAVE_VSNPRINTF ) && !defined( HAVE__VSNPRINTF ) */ +static int dummy; /* May not have empty source files in C89 */ +#endif Index: src/staticmod.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/staticmod.c,v retrieving revision 1.2 diff -u -r1.2 staticmod.c --- src/staticmod.c 8 Nov 2001 18:20:15 -0000 1.2 +++ src/staticmod.c 20 Aug 2003 05:58:08 -0000 @@ -1,4 +1,6 @@ /* All Our Happy Includes! */ +#include "config.h" +#include "common.h" #include "cmdarg.h" #include "command.h" #include "cookie.h" @@ -28,6 +30,8 @@ extern struct LPMAPI API; +#ifndef USE_DYNMODS + #ifdef LISTARCHIVE extern void listarchive_load(struct LPMAPI *api); extern void listarchive_init(void); @@ -486,3 +490,6 @@ /* Add any extra modules you want linked in here */ return 1; } +#else /* USE_DYNMODS */ + static int dummy; +#endif Index: src/submodes.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/submodes.c,v retrieving revision 1.3 diff -u -r1.3 submodes.c --- src/submodes.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/submodes.c 20 Aug 2003 05:58:08 -0000 @@ -1,7 +1,22 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H #include +#endif +#include "common.h" #include "flag.h" #include "core.h" #include "variables.h" @@ -9,6 +24,7 @@ #include "submodes.h" #include "list.h" #include "mystring.h" +#include "xmalloc.h" struct submode *submodes; @@ -93,10 +109,10 @@ flagend = strchr(flag, '|'); } if(!valid) continue; - newmode = (struct submode *)malloc(sizeof(struct submode)); - newmode->modename = strdup(modename); - newmode->flaglist = strdup(modeflags); - newmode->description = desc ? strdup(desc) : NULL; + newmode = (struct submode *)xmalloc(sizeof(struct submode)); + newmode->modename = xstrdup(modename); + newmode->flaglist = xstrdup(modeflags); + newmode->description = desc ? xstrdup(desc) : NULL; newmode->next = submodes; submodes = newmode; } Index: src/tolist.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/tolist.c,v retrieving revision 1.10 diff -u -r1.10 tolist.c --- src/tolist.c 11 Aug 2002 22:25:09 -0000 1.10 +++ src/tolist.c 20 Aug 2003 05:58:09 -0000 @@ -1,6 +1,23 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H #include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "common.h" #include "tolist.h" #include "fileapi.h" #include "variables.h" @@ -11,10 +28,7 @@ #include "hooks.h" #include "list.h" #include "mystring.h" - -#ifndef WIN32 -#include -#endif +#include "xmalloc.h" /* These are only used in 'normal' (non megalist) mode */ static int elements; @@ -89,7 +103,7 @@ char *listdir; if(get_bool("megalist")) { - thelist = strdup(list); + thelist = xstrdup(list); return; } @@ -104,16 +118,16 @@ return; while(user_read(fp, &luser)) { - l = (struct listinfo *)malloc(sizeof(struct listinfo)); - l->listname = strdup(list); - l->listflags = strdup(luser.flags); + l = (struct listinfo *)xmalloc(sizeof(struct listinfo)); + l->listname = xstrdup(list); + l->listflags = xstrdup(luser.flags); user = find_user(luser.address); if(user) { l->next = user->linfo; } else { - user = (struct tolist *)malloc(sizeof(struct tolist)); + user = (struct tolist *)xmalloc(sizeof(struct tolist)); user->next = sendtolist; - user->address = strdup(luser.address); + user->address = xstrdup(luser.address); sendtolist = user; elements++; l->next = NULL; @@ -139,9 +153,9 @@ if(thelist && strcmp(thelist, list) != 0) return; if(!thelist) - thelist = strdup(list); - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + thelist = xstrdup(list); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 1; tmp->flagged = 1; tmp->next = tolist_flags; @@ -164,16 +178,16 @@ while(user_read(fp, &luser)) { if(strstr(luser.flags, tbuf) == NULL) continue; - l = (struct listinfo *)malloc(sizeof(struct listinfo)); - l->listname = strdup(list); - l->listflags = strdup(luser.flags); + l = (struct listinfo *)xmalloc(sizeof(struct listinfo)); + l->listname = xstrdup(list); + l->listflags = xstrdup(luser.flags); user = find_user(luser.address); if(user) { l->next = user->linfo; } else { - user = (struct tolist *)malloc(sizeof(struct tolist)); + user = (struct tolist *)xmalloc(sizeof(struct tolist)); user->next = sendtolist; - user->address = strdup(luser.address); + user->address = xstrdup(luser.address); sendtolist = user; elements++; l->next = NULL; @@ -199,9 +213,9 @@ if(thelist && strcmp(thelist, list) != 0) return; if(!thelist) - thelist = strdup(list); - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + thelist = xstrdup(list); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 1; tmp->flagged = 0; tmp->next = tolist_flags; @@ -224,16 +238,16 @@ while(user_read(fp, &luser)) { if(strstr(luser.flags, tbuf) != NULL) continue; - l = (struct listinfo *)malloc(sizeof(struct listinfo)); - l->listname = strdup(list); - l->listflags = strdup(luser.flags); + l = (struct listinfo *)xmalloc(sizeof(struct listinfo)); + l->listname = xstrdup(list); + l->listflags = xstrdup(luser.flags); user = find_user(luser.address); if(user) { l->next = user->linfo; } else { - user = (struct tolist *)malloc(sizeof(struct tolist)); + user = (struct tolist *)xmalloc(sizeof(struct tolist)); user->next = sendtolist; - user->address = strdup(luser.address); + user->address = xstrdup(luser.address); sendtolist = user; elements++; l->next = NULL; @@ -327,9 +341,9 @@ if(thelist && strcmp(thelist, prilist) != 0) return; if(!thelist) - thelist = strdup(prilist); - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + thelist = xstrdup(prilist); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 0; tmp->flagged = 1; tmp->next = tolist_flags; @@ -373,8 +387,8 @@ if(get_bool("megalist")) { struct tolist_flag *tmp; - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 0; tmp->flagged = 1; tmp->next = tolist_flags; @@ -418,8 +432,8 @@ if(get_bool("megalist")) { struct tolist_flag *tmp; - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 0; tmp->flagged = 0; tmp->next = tolist_flags; @@ -466,9 +480,9 @@ if(thelist && strcmp(thelist, prilist) != 0) return; if(!thelist) - thelist = strdup(prilist); - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + thelist = xstrdup(prilist); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 0; tmp->flagged = 0; tmp->next = tolist_flags; @@ -517,9 +531,9 @@ if(thelist && strcmp(thelist, list) != 0) return; if(!thelist) - thelist = strdup(list); - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + thelist = xstrdup(list); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 0; tmp->flagged = 1; tmp->next = tolist_flags; @@ -582,9 +596,9 @@ if(thelist && strcmp(thelist, list) != 0) return; if(!thelist) - thelist = strdup(list); - tmp = (struct tolist_flag *)malloc(sizeof(struct tolist_flag)); - tmp->flag = strdup(flag); + thelist = xstrdup(list); + tmp = (struct tolist_flag *)xmalloc(sizeof(struct tolist_flag)); + tmp->flag = xstrdup(flag); tmp->add = 0; tmp->flagged = 0; tmp->next = tolist_flags; @@ -658,8 +672,8 @@ if (admin2) return 1; } - cbuf1 = strdup(t1->address); - cbuf2 = strdup(t2->address); + cbuf1 = xstrdup(t1->address); + cbuf2 = xstrdup(t2->address); cptr1 = strrchr(cbuf1,'.'); cptr2 = strrchr(cbuf2,'.'); @@ -795,7 +809,7 @@ if (!elements) return; - arr = (struct tolist **)malloc(sizeof(struct tolist *)*elements); + arr = (struct tolist **)xmalloc(sizeof(struct tolist *)*elements); if(!arr) return; tmp = sendtolist; @@ -877,13 +891,13 @@ log_printf(15, "START_TOLIST (megalist) Opened %s\n", thelist); while(user_read(listfile, &touser)) { if(tolist_user_matches_flags(&touser)) { - current = (struct tolist *)malloc(sizeof(struct tolist)); - current->linfo = (struct listinfo *)malloc(sizeof(struct listinfo)); + current = (struct tolist *)xmalloc(sizeof(struct tolist)); + current->linfo = (struct listinfo *)xmalloc(sizeof(struct listinfo)); current->next = NULL; current->linfo->next = NULL; - current->address = strdup(touser.address); - current->linfo->listname = strdup(thelist); - current->linfo->listflags = strdup(touser.flags); + current->address = xstrdup(touser.address); + current->linfo->listname = xstrdup(thelist); + current->linfo->listflags = xstrdup(touser.flags); log_printf(15, "START_TOLIST (megalist) returning %s\n", current->address); return current; } @@ -917,8 +931,8 @@ current->linfo->next = NULL; if(current->address) free(current->address); if(current->linfo->listflags) free(current->linfo->listflags); - current->address = strdup(touser.address); - current->linfo->listflags = strdup(touser.flags); + current->address = xstrdup(touser.address); + current->linfo->listflags = xstrdup(touser.flags); log_printf(15, "NEXT_TOLIST (megalist) returning %s\n", current->address); return current; } Index: src/trust.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/trust.c,v retrieving revision 1.3 diff -u -r1.3 trust.c --- src/trust.c 11 Aug 2002 22:25:09 -0000 1.3 +++ src/trust.c 20 Aug 2003 05:58:09 -0000 @@ -1,10 +1,31 @@ +#include "config.h" + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_CTYPE_H +#include +#endif #include "fileapi.h" #include "variables.h" -#include "config.h" +#include "common.h" #include "core.h" #include "mystring.h" +#include "xmalloc.h" int is_trusted(const char *list) { Index: src/unhtml.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/unhtml.c,v retrieving revision 1.4 diff -u -r1.4 unhtml.c --- src/unhtml.c 14 Aug 2003 16:42:20 -0000 1.4 +++ src/unhtml.c 20 Aug 2003 05:58:09 -0000 @@ -1,17 +1,30 @@ /* Sparks' Simple Little Hack of an HTML -> Text Convertor, v0.5 */ -#include +#include "config.h" +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H #include +#endif +#ifdef HAVE_STRINGS_H +#include +#endif +#ifdef HAVE_STDIO_H +#include +#endif +#ifdef HAVE_CTYPE_H #include -#include +#endif -#ifndef WIN32 +#ifdef HAVE_UNISTD_H #include #endif #include "fileapi.h" -#include "config.h" +#include "common.h" #include "compat.h" #include "mystring.h" +#include "xmalloc.h" /* Our parse modes. */ #define HTMLPARSE_NORMAL 0 @@ -39,15 +52,15 @@ if (numlinks == 99) return numlinks; - newlink = (struct html_link *)malloc(sizeof(struct html_link)); + newlink = (struct html_link *)xmalloc(sizeof(struct html_link)); if (!links) { numlinks = 0; - links = (struct html_link **)malloc(sizeof(struct html_link *) * 99); + links = (struct html_link **)xmalloc(sizeof(struct html_link *) * 99); } numlinks++; - newlink->url = strdup(url); + newlink->url = xstrdup(url); links[numlinks - 1] = newlink; return numlinks; @@ -109,7 +122,7 @@ char tempbuf[1024]; va_start(vargs,format); - vsprintf(tempbuf,format,vargs); + buffer_printf(tempbuf, 1024, format, vargs); va_end(vargs); /* FC : BIG BUG !!! BIG BUG !!! changed 1024 to 79 !!! Index: src/unmime.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/unmime.c,v retrieving revision 1.10 diff -u -r1.10 unmime.c --- src/unmime.c 14 Aug 2003 16:42:20 -0000 1.10 +++ src/unmime.c 20 Aug 2003 05:58:09 -0000 @@ -1,10 +1,27 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_CTYPE_H #include -#include +#endif #include "compat.h" -#include "config.h" +#include "common.h" #include "core.h" #include "fileapi.h" #include "variables.h" @@ -14,6 +31,7 @@ #include "codes.h" #include "rfc2047.h" #include "moderate.h" +#include "xmalloc.h" struct mime_handler *mime_handlers; @@ -148,7 +166,7 @@ length = strlen(temp2); - tptr = (char *)malloc(length + 1); + tptr = (char *)xmalloc(length + 1); memset(tptr,0,length + 1); buffer_printf(tptr,length + 1,"%s",temp2); @@ -161,9 +179,9 @@ if (!field) return NULL; - header = (struct mime_header *)malloc(sizeof(struct mime_header)); + header = (struct mime_header *)xmalloc(sizeof(struct mime_header)); header->numfields = 1; - header->fields = (struct mime_field **)malloc(sizeof(struct mime_field *)); + header->fields = (struct mime_field **)xmalloc(sizeof(struct mime_field *)); header->fields[0] = field; return header; @@ -252,7 +270,7 @@ *tptr++ = 0; - name = (char *)malloc(strlen(finalbuf) + 1); + name = (char *)xmalloc(strlen(finalbuf) + 1); buffer_printf(name,strlen(finalbuf) + 1,"%s",finalbuf); /* Eat whitespace */ @@ -261,7 +279,7 @@ tptr2 = strchr(tptr,';'); if (tptr2) *tptr2++ = 0; - value = (char *)malloc(strlen(tptr) + 1); + value = (char *)xmalloc(strlen(tptr) + 1); buffer_printf(value,strlen(tptr) + 1,"%s",tptr); params = NULL; @@ -270,11 +288,11 @@ tptr = tptr2; while (isspace((int)*tptr)) tptr++; - params = (char *)malloc(strlen(tptr) + 1); + params = (char *)xmalloc(strlen(tptr) + 1); buffer_printf(params,strlen(tptr) + 1,"%s",tptr); } - field = (struct mime_field *)malloc(sizeof(struct mime_field)); + field = (struct mime_field *)xmalloc(sizeof(struct mime_field)); field->name = name; field->value = value; field->params = params; @@ -307,7 +325,7 @@ { struct mime_handler *handler, **temp; - handler = (struct mime_handler *)malloc(sizeof(struct mime_handler)); + handler = (struct mime_handler *)xmalloc(sizeof(struct mime_handler)); handler->mimetype = lowerstr(mimetype); handler->handler = function; handler->priority = priority; @@ -401,10 +419,10 @@ * This is pretty hackish, but, eh... */ if (readlast && !subheader && firstfile) { - field = (struct mime_field *)malloc(sizeof(struct mime_field)); + field = (struct mime_field *)xmalloc(sizeof(struct mime_field)); - field->name = strdup("Content-type"); - field->value = strdup("text/plain"); + field->name = xstrdup("Content-type"); + field->value = xstrdup("text/plain"); field->params = NULL; subheader = mime_addheader(subheader,field); @@ -513,7 +531,7 @@ int boundcount; char tbuf[BIG_BUF]; - boundaries = (char **)malloc(2 * sizeof(char *)); + boundaries = (char **)xmalloc(2 * sizeof(char *)); buffer_printf(tbuf, sizeof(tbuf) - 1, "--%s", bound); boundaries[0] = &tbuf[0]; boundcount = 1; @@ -531,7 +549,7 @@ int boundcount; char tbuf[BIG_BUF]; - boundaries = (char **)malloc(2 * sizeof(char *)); + boundaries = (char **)xmalloc(2 * sizeof(char *)); buffer_printf(tbuf, sizeof(tbuf) - 1, "--%s", bound); boundaries[0] = &tbuf[0]; boundcount = 1; Index: src/upgrade.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/upgrade.c,v retrieving revision 1.2 diff -u -r1.2 upgrade.c --- src/upgrade.c 11 Aug 2002 23:11:43 -0000 1.2 +++ src/upgrade.c 20 Aug 2003 05:58:09 -0000 @@ -1,21 +1,17 @@ #include #include #include +#include "config.h" -#ifndef UNCRYPTED_PASS -/* Keep glibc happy */ -#define __USE_XOPEN - -/* Keep SunOS happy, too... */ -# ifdef SUNOS_5 -# include -# endif +#ifdef HAVE_UNISTD_H +#include #endif -#ifndef WIN32 -#include -#endif /* WIN32 */ +#ifdef HAVE_CRYPT_H +#include +#endif +#include "common.h" #include "core.h" #include "cmdarg.h" #include "modes.h" @@ -74,7 +70,7 @@ } printf("done!\n"); -#ifndef UNCRYPTED_PASS +#ifdef HAVE_CRYPT /* Convert us to a crypted password file */ buffer_printf(tbuf, sizeof(tbuf) - 1, "%s", get_string("pwdfile")); buffer_printf(tbuf2, sizeof(tbuf2) - 1, "%s.pwdchange", get_string("pwdfile")); @@ -143,7 +139,7 @@ upgrade_all_modules(prev, cur); /* Now handle per list upgrade of all lists and all modules per list */ - status = walk_lists(&tbuf[0]); + status = walk_lists(tbuf, sizeof(tbuf)); while(status) { if(list_valid(tbuf)) { /* switch context to the new list */ @@ -152,7 +148,7 @@ upgrade_list(prev, cur); listupgrade_all_modules(prev, cur); } - status = next_lists(&tbuf[0]); + status = next_lists(tbuf, sizeof(tbuf)); } return 1; } Index: src/user.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/user.c,v retrieving revision 1.3 diff -u -r1.3 user.c --- src/user.c 11 Aug 2002 22:25:10 -0000 1.3 +++ src/user.c 20 Aug 2003 05:58:10 -0000 @@ -1,16 +1,36 @@ -#include -#include +#include "config.h" + +#ifdef HAVE_STRING_H #include -#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif -#ifndef WIN32 +#ifdef HAVE_CTYPE_H +#include +#endif + +#ifdef HAVE_UNISTD_H #include #endif #include "core.h" #include "list.h" -#include "config.h" +#include "common.h" #include "smtp.h" #include "user.h" #include "flag.h" @@ -19,6 +39,7 @@ #include "mystring.h" #include "compat.h" #include "submodes.h" +#include "xmalloc.h" int inbody; int request_type; Index: src/userstat.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/userstat.c,v retrieving revision 1.3 diff -u -r1.3 userstat.c --- src/userstat.c 11 Aug 2002 22:25:10 -0000 1.3 +++ src/userstat.c 20 Aug 2003 05:58:10 -0000 @@ -1,16 +1,36 @@ +#include "config.h" + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H #include +#endif + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_CTYPE_H #include -#include +#endif + +#ifdef HAVE_ERRNO_H #include -#include +#endif -#ifndef WIN32 +#ifdef HAVE_UNISTD_H #include #endif #include "core.h" #include "list.h" -#include "config.h" +#include "common.h" #include "smtp.h" #include "user.h" #include "flag.h" Index: src/variables.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/variables.c,v retrieving revision 1.7 diff -u -r1.7 variables.c --- src/variables.c 27 Feb 2003 23:49:24 -0000 1.7 +++ src/variables.c 20 Aug 2003 05:58:10 -0000 @@ -1,8 +1,26 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_CTYPE_H #include -#include +#endif +#include "common.h" #include "alias.h" #include "variables.h" #include "core.h" @@ -11,6 +29,7 @@ #include "liscript.h" #include "fileapi.h" #include "trust.h" +#include "xmalloc.h" static const char *_sortorder = NULL; struct list_vars *listdata = NULL; @@ -253,8 +272,8 @@ } hash = var_hash(varname); - temp = (struct var_data *)malloc(sizeof(struct var_data)); - temp->name = strdup(varname); + temp = (struct var_data *)xmalloc(sizeof(struct var_data)); + temp->name = xstrdup(varname); temp->description = NULL; temp->section = NULL; temp->example = NULL; @@ -267,11 +286,11 @@ temp->choices = NULL; temp->type = type; if(desc) - temp->description = strdup(desc); + temp->description = xstrdup(desc); if(section) - temp->section = strdup(section); + temp->section = xstrdup(section); if(example) - temp->example = strdup(example); + temp->example = xstrdup(example); if(defval) { /* lets do some validation of the variables */ switch (temp->type) { @@ -280,7 +299,7 @@ break; case VAR_CHOICE: { char *deftmp, *delim, *dv; - deftmp = strdup(defval); + deftmp = xstrdup(defval); delim = strchr(deftmp, ':'); dv = strchr(deftmp, '|'); if(delim == NULL || dv == NULL) { @@ -305,10 +324,10 @@ free(deftmp); return; } - temp->choices = strdup(delim+1); + temp->choices = xstrdup(delim+1); if(delim != defval) { *delim = '\0'; - temp->defval = strdup(defval); + temp->defval = xstrdup(defval); } free(deftmp); } @@ -318,31 +337,31 @@ if(atoi(defval) || !strcasecmp(defval, "yes") || !strcasecmp(defval, "on") || !strcasecmp(defval, "y") || !strcasecmp(defval, "true")) { - temp->defval = strdup("1"); + temp->defval = xstrdup("1"); } else { - temp->defval = strdup("0"); + temp->defval = xstrdup("0"); } break; case VAR_TIME: if(atoi(defval)) { - temp->defval = strdup(defval); + temp->defval = xstrdup(defval); } else { char buf[BIG_BUF]; time_t now = time(NULL); buffer_printf(buf, sizeof(buf) - 1, "%d", (int)now); - temp->defval = strdup(buf); + temp->defval = xstrdup(buf); } break; case VAR_INT: if(atoi(defval)) { - temp->defval = strdup(defval); + temp->defval = xstrdup(defval); } else { - temp->defval = strdup("0"); + temp->defval = xstrdup("0"); } break; case VAR_DURATION: case VAR_STRING: - temp->defval = strdup(defval); + temp->defval = xstrdup(defval); break; default: /* We should never get here!! */ @@ -427,7 +446,7 @@ log_printf(0, "Attempt to set invalid value for choice variable '%s'\n", varname); return; } - temp = strdup(varval); + temp = xstrdup(varval); break; } case VAR_BOOL: @@ -435,33 +454,33 @@ if(atoi(varval) || !strcasecmp(varval, "yes") || !strcasecmp(varval, "on") || !strcasecmp(varval, "y") || !strcasecmp(varval, "true")) { - temp = strdup("1"); + temp = xstrdup("1"); } else { - temp = strdup("0"); + temp = xstrdup("0"); } } break; case VAR_TIME: if(varval && atoi(varval)) { - temp = strdup(varval); + temp = xstrdup(varval); } else { char buf[BIG_BUF]; time_t now = time(NULL); buffer_printf(buf, sizeof(buf) - 1, "%d", (int)now); - temp = strdup(buf); + temp = xstrdup(buf); } break; case VAR_INT: if(varval && atoi(varval)) { - temp = strdup(varval); + temp = xstrdup(varval); } else { - temp = strdup("0"); + temp = xstrdup("0"); } break; case VAR_DURATION: case VAR_STRING: if(varval) - temp = strdup(varval); + temp = xstrdup(varval); break; default: /* We should never get here!! */ @@ -559,7 +578,7 @@ liscript_parse_line(c, tbuf, sizeof(tbuf) - 1); if(tmp->expanded) free(tmp->expanded); log_printf(19,"Expanded '%s' -> '%s'\n", c, tbuf); - tmp->expanded = strdup(tbuf); + tmp->expanded = xstrdup(tbuf); c = tmp->expanded; } } @@ -567,7 +586,7 @@ } /* Convert the raw data to a boolean value and return it */ -const int get_bool(const char *varname) +int get_bool(const char *varname) { struct var_data *tmp = find_var_rec(varname); const char *c; @@ -589,7 +608,7 @@ } /* Convert the raw data to an integer and return it */ -const int get_number(const char *varname) +int get_number(const char *varname) { struct var_data *tmp = find_var_rec(varname); const char *c; @@ -654,7 +673,7 @@ liscript_parse_line(c, tbuf, sizeof(tbuf) - 1); if(tmp->expanded) free(tmp->expanded); log_printf(19,"Expanded '%s' -> '%s'\n", c, tbuf); - tmp->expanded = strdup(tbuf); + tmp->expanded = xstrdup(tbuf); return tmp->expanded; } } @@ -662,7 +681,7 @@ } /* Parse the string for a date format and return it as a number of seconds */ -const int get_seconds(const char *varname) +int get_seconds(const char *varname) { struct var_data *tmp = find_var_rec(varname); const char *c; @@ -701,7 +720,7 @@ void init_vars(void) { int i; - listdata = (struct list_vars *)malloc(sizeof(struct list_vars)); + listdata = (struct list_vars *)xmalloc(sizeof(struct list_vars)); for(i = 0; i < HASHSIZE; i++) listdata->bucket[i] = NULL; } @@ -714,7 +733,7 @@ count = count_all_vars(); - sortedvars = (struct var_data **)malloc(sizeof(struct var_data *)*count); + sortedvars = (struct var_data **)xmalloc(sizeof(struct var_data *)*count); if(!sortedvars) { log_printf(0, "Unable to allocate memory for sorting.\n"); return NULL; @@ -888,7 +907,7 @@ return; } - arr = (struct var_data **)malloc(sizeof(struct var_data *)*count); + arr = (struct var_data **)xmalloc(sizeof(struct var_data *)*count); if(!arr) { log_printf(0, "Unable to allocate memory for sorting.\n"); close_file(ofile); @@ -1429,7 +1448,7 @@ count = count_all_vars(); - arr = (struct var_data **)malloc(sizeof(struct var_data *)*count); + arr = (struct var_data **)xmalloc(sizeof(struct var_data *)*count); if(!arr) { log_printf(0, "Unable to allocate memory for sorting.\n"); close_file(ofile); Index: src/winio.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/winio.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 winio.c --- src/winio.c 5 Aug 2001 21:15:33 -0000 1.1.1.1 +++ src/winio.c 20 Aug 2003 05:58:10 -0000 @@ -4,14 +4,20 @@ #include #include #include + +#include "config.h" +#ifdef HAVE_WINSOCK2_H #include +#endif +#include "common.h" #include "compat.h" #include "core.h" #include "variables.h" #include "sockio.h" +#ifdef WIN32 void sock_init() { WSADATA wsaData; @@ -34,7 +40,7 @@ if (sock == -1) return 0; va_start(vargs, format); - vsprintf(mybuf, format, vargs); + buffer_printf(mybuf, BIG_BUF - 1, format, vargs); va_end(vargs); result = send(sock, &mybuf[0], strlen(mybuf), 0); @@ -167,4 +173,6 @@ return (closesocket(sock)); } - +#else /* WIN32 */ + static int dummy; +#endif Index: src/winmod.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/winmod.c,v retrieving revision 1.3 diff -u -r1.3 winmod.c --- src/winmod.c 11 Aug 2002 22:25:10 -0000 1.3 +++ src/winmod.c 20 Aug 2003 05:58:10 -0000 @@ -1,6 +1,7 @@ #include #include "config.h" +#include "common.h" #include "lpm-mods.h" #include "cmdarg.h" @@ -28,8 +29,10 @@ #include "user.h" #include "variables.h" #include "funcparse.h" +#include "xmalloc.h" #include "lpm-api.h" +#ifdef WIN32 #define LOAD_FUNCNAME_PATTERN "%.200s_load" #define INIT_FUNCNAME_PATTERN "%.200s_init" @@ -53,9 +56,9 @@ { struct listserver_modref *tempref; - tempref = (struct listserver_modref *)malloc(sizeof(struct listserver_modref)); + tempref = (struct listserver_modref *)xmalloc(sizeof(struct listserver_modref)); tempref->handle = handle; - tempref->name = strdup(modname); + tempref->name = xstrdup(modname); tempref->next = mod_handles; mod_handles = tempref; } @@ -243,3 +246,6 @@ return 1; } +#else /* WIN32 */ + static int dummy; +#endif Index: src/xmalloc.c =================================================================== RCS file: src/xmalloc.c diff -N src/xmalloc.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/xmalloc.c 20 Aug 2003 05:58:10 -0000 @@ -0,0 +1,52 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H +#include +#endif + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_SYSEXITS_H +#include +#else +#define EX_TEMPFAIL 1 +#endif + +#include "xmalloc.h" + +void* xmalloc( size_t size ) +{ + void* p = malloc( size ); + + if( !p ) + exit( EX_TEMPFAIL ); + + return p; +} + +void* xrealloc( void* o, size_t size ) +{ + void* p = realloc( o, size ); + + if( !p ) + exit( EX_TEMPFAIL ); + + return p; +} + +char* xstrdup( const char* s ) +{ + char* p = strdup( s ); + + if( !p ) + exit( EX_TEMPFAIL ); + + return p; + +} Index: src/inc/common.h =================================================================== RCS file: src/inc/common.h diff -N src/inc/common.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/inc/common.h 20 Aug 2003 05:58:10 -0000 @@ -0,0 +1,30 @@ +#ifndef _COMMON_H +#define _COMMON_H + +#include "compat.h" +#include "version.h" + +#define SMALL_BUF 256 +#define BIG_BUF 1024 +#define HUGE_BUF 2048 + +#ifdef HAVE_UNISTD_H +#include +#endif + +/* This one to help typing safe code in strings functions */ +#define SAFELEN(x) (sizeof(x) - 1) +/* These two as new str... SAFE functions */ +/* (in waiting for a new library of SAFE strings manipulations functions) */ +/* TO USE ONLY THEN x is fully know (local or global defined char array) !!! + not when x is a pointer received as a argument of a function... */ +#define stringcat(dest,src) strncat(dest, src, sizeof(dest) - 1 - strlen(dest)) +#define stringcpy(dest,src) strncpy(dest, src, sizeof(dest) - 1) + +#define SERVICE_NAME_UC "ECARTIS" +#define SERVICE_NAME_MC "Ecartis" +#define SERVICE_NAME_LC "ecartis" +#define GLOBAL_CFG_FILE CONFDIR"ecartis.cfg" +#define SERVICE_ADDRESS "ecartis@localhost" + +#endif /* _COMMON_H */ Index: src/inc/compat.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/compat.h,v retrieving revision 1.2 diff -u -r1.2 compat.h --- src/inc/compat.h 5 Apr 2003 04:44:24 -0000 1.2 +++ src/inc/compat.h 20 Aug 2003 05:58:10 -0000 @@ -1,25 +1,36 @@ #ifndef _COMPAT_H #define _COMPAT_H +#include "config.h" -# ifdef sun /* We need to define externs for sys_errlist manually */ -extern char *sys_errlist[]; -extern int sys_nerr; - -# ifndef SUNOS_5 /* Well, then we must be SunOS 4 */ -# define RTLD_LISTSERVER (1) -# endif +#ifdef HAVE_BSTRING_H +#include +#endif -# endif +#if !defined( HAVE_MEMMOVE ) && defined( HAVE_BCOPY ) +#define memmove(dst, src, len) bcopy(src, dst, len) +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#if defined(TIME_WITH_SYS_TIME) && defined(HAVE_SYS_TIME_H) +#include +#endif + +#ifndef HAVE_TIME_T +typedef long time_t; +#endif -#ifdef NEED_STRRCHR +#ifndef HAVE_STRRCHR #define strrchr(x, y) rindex((x), (y)) #endif -#ifdef NEED_STRCHR +#ifndef HAVE_STRCHR #define strchr(x, y) index((x), (y)) #endif -# ifdef WIN32 +#ifdef WIN32 # define strcasecmp(x,y) _stricmp(x,y) # define strncasecmp(x,y,z) _strnicmp(x,y,z) # define chdir(x) _chdir(x) @@ -31,14 +42,5 @@ # define EX_TEMPFAIL 75 # define UNCRYPTED_PASS # endif - -#ifdef IRIX_IS_CRAP -#include /* required for rindex() */ -#include /* required for bcopy() */ -#endif /* IRIX_IS_CRAP */ - -#if defined(SUNOS_5) || defined(_AIX) -# include /* required for some string functions */ -#endif #endif /* _COMPAT_H */ Index: src/inc/config.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/config.h,v retrieving revision 1.2 diff -u -r1.2 config.h --- src/inc/config.h 11 Aug 2002 23:21:22 -0000 1.2 +++ src/inc/config.h 20 Aug 2003 05:58:11 -0000 @@ -1,26 +1,258 @@ -#ifndef _CONFIG_H -#define _CONFIG_H +/* src/inc/config.h. Generated by configure. */ +/* src/inc/config.h.in. Generated from configure.ac by autoheader. */ -#include "compat.h" -#include "version.h" +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ -#define SMALL_BUF 256 -#define BIG_BUF 1024 -#define HUGE_BUF 2048 - -/* This one to help typing safe code in strings functions */ -#define SAFELEN(x) (sizeof(x) - 1) -/* These two as new str... SAFE functions */ -/* (in waiting for a new library of SAFE strings manipulations functions) */ -/* TO USE ONLY THEN x is fully know (local or global defined char array) !!! - not when x is a pointer received as a argument of a function... */ -#define stringcat(dest,src) strncat(dest, src, sizeof(dest) - 1 - strlen(dest)) -#define stringcpy(dest,src) strncpy(dest, src, sizeof(dest) - 1) - -#define SERVICE_NAME_UC "ECARTIS" -#define SERVICE_NAME_MC "Ecartis" -#define SERVICE_NAME_LC "ecartis" -#define GLOBAL_CFG_FILE "ecartis.cfg" -#define SERVICE_ADDRESS "ecartis@localhost" +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ -#endif /* _CONFIG_H */ +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the `bcopy' function. */ +#define HAVE_BCOPY 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BSTRING_H */ + +/* Define to 1 if you have the `crypt' function. */ +#define HAVE_CRYPT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CRYPT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the `dlclose' function. */ +#define HAVE_DLCLOSE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `dlopen' function. */ +#define HAVE_DLOPEN 1 + +/* Define to 1 if you have the `dlsym' function. */ +#define HAVE_DLSYM 1 + +/* Define if you have dl_funcptr */ +/* #undef HAVE_DL_FUNCPTR */ + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the `fcntl' function. */ +#define HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `flock' function. */ +#define HAVE_FLOCK 1 + +/* strftime supports rfc822 numeric timezone */ +#define HAVE_GNU_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETDB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_PWD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHARE_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the `Sleep' function. */ +/* #undef HAVE_SLEEP */ + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +#define HAVE_STRUCT_TM_TM_ZONE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYSEXITS_H 1 + +/* System has sys_errlist and sys_nerr */ +#define HAVE_SYS_ERRLIST 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if the system has the type `time_t'. */ +#define HAVE_TIME_T 1 + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +#define HAVE_TM_ZONE 1 + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +/* #undef HAVE_TZNAME */ + +/* Symbols are prefixed by a single underscore */ +/* #undef HAVE_UNDERSCORE_PREFIX */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `usleep' function. */ +#define HAVE_USLEEP 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#define HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINSOCK2_H */ + +/* Define to 1 if you have the `_vsnprintf' function. */ +/* #undef HAVE__VSNPRINTF */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + +/* printf handles %+.02d incorrectly */ +#define MY_PRINTF_IS_BRAINDEAD 1 + +/* Name of package */ +#define PACKAGE "ecartis" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "ecartis" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "ecartis 1.0-pre" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "ecartis" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.0-pre" + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + +/* Define to 1 if your declares `struct tm'. */ +/* #undef TM_IN_SYS_TIME */ + +/* Use dynamic modules. */ +#define USE_DYNMODS 1 + +/* Are we using CygWin? */ +/* #undef USING_CYGWIN */ + +/* Version number of package */ +#define VERSION "1.0-pre" + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `int' if doesn't define. */ +/* #undef gid_t */ + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +/* #undef inline */ + +/* Define to `unsigned' if does not define. */ +/* #undef size_t */ + +/* Define to `int' if doesn't define. */ +/* #undef uid_t */ Index: src/inc/config.h.in =================================================================== RCS file: src/inc/config.h.in diff -N src/inc/config.h.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/inc/config.h.in 20 Aug 2003 05:58:11 -0000 @@ -0,0 +1,257 @@ +/* src/inc/config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define to 1 if you have the `bcopy' function. */ +#undef HAVE_BCOPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_BSTRING_H + +/* Define to 1 if you have the `crypt' function. */ +#undef HAVE_CRYPT + +/* Define to 1 if you have the header file. */ +#undef HAVE_CRYPT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_DIRENT_H + +/* Define to 1 if you have the `dlclose' function. */ +#undef HAVE_DLCLOSE + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `dlopen' function. */ +#undef HAVE_DLOPEN + +/* Define to 1 if you have the `dlsym' function. */ +#undef HAVE_DLSYM + +/* Define if you have dl_funcptr */ +#undef HAVE_DL_FUNCPTR + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the `fcntl' function. */ +#undef HAVE_FCNTL + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define to 1 if you have the `flock' function. */ +#undef HAVE_FLOCK + +/* strftime supports rfc822 numeric timezone */ +#undef HAVE_GNU_STRFTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_IO_H + +/* Define to 1 if you have the `memmove' function. */ +#undef HAVE_MEMMOVE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_PWD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SHARE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if you have the `Sleep' function. */ +#undef HAVE_SLEEP + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDARG_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR + +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the `strftime' function. */ +#undef HAVE_STRFTIME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `strrchr' function. */ +#undef HAVE_STRRCHR + +/* Define to 1 if `tm_zone' is member of `struct tm'. */ +#undef HAVE_STRUCT_TM_TM_ZONE + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSEXITS_H + +/* System has sys_errlist and sys_nerr */ +#undef HAVE_SYS_ERRLIST + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define to 1 if the system has the type `time_t'. */ +#undef HAVE_TIME_T + +/* Define to 1 if your `struct tm' has `tm_zone'. Deprecated, use + `HAVE_STRUCT_TM_TM_ZONE' instead. */ +#undef HAVE_TM_ZONE + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +#undef HAVE_TZNAME + +/* Symbols are prefixed by a single underscore */ +#undef HAVE_UNDERSCORE_PREFIX + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to 1 if you have the `usleep' function. */ +#undef HAVE_USLEEP + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* Define to 1 if you have the header file. */ +#undef HAVE_WINSOCK2_H + +/* Define to 1 if you have the `_vsnprintf' function. */ +#undef HAVE__VSNPRINTF + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +#undef MAJOR_IN_MKDEV + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#undef MAJOR_IN_SYSMACROS + +/* printf handles %+.02d incorrectly */ +#undef MY_PRINTF_IS_BRAINDEAD + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + +/* Define to 1 if your declares `struct tm'. */ +#undef TM_IN_SYS_TIME + +/* Use dynamic modules. */ +#undef USE_DYNMODS + +/* Are we using CygWin? */ +#undef USING_CYGWIN + +/* Version number of package */ +#undef VERSION + +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const + +/* Define to `int' if doesn't define. */ +#undef gid_t + +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to `unsigned' if does not define. */ +#undef size_t + +/* Define to `int' if doesn't define. */ +#undef uid_t Index: src/inc/config.h.win =================================================================== RCS file: src/inc/config.h.win diff -N src/inc/config.h.win --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/inc/config.h.win 20 Aug 2003 05:58:11 -0000 @@ -0,0 +1,120 @@ +/* Handcrafted config.h for Windows VC98 */ + + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +#define HAVE_MEMORY_H 1 +#define HAVE_SHARE_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_IO_H 1 + +/* Define to 1 if you have the `Sleep' function. */ +#define HAVE_SLEEP 1 + +/* Define to 1 if you have the `snprintf' function. */ +#define HAVE_SNPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* System has sys_errlist and sys_nerr */ +#define HAVE_SYS_ERRLIST 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if the system has the type `time_t'. */ +#define HAVE_TIME_T 1 + + +/* Define to 1 if you don't have `tm_zone' but do have the external array + `tzname'. */ +#define HAVE_TZNAME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the `_vsnprintf' function. */ +#define HAVE__VSNPRINTF 1 + +/* Name of package */ +#define PACKAGE "Ecartis" + +/* Define to the address where bug reports for this package should be sent. */ +#undef PA_BUGREPORT + +/* Define to the full name of this package. */ +#define PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "ecartis-1.0pre" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "1.0-pre" + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS + + +/* Version number of package */ +#define VERSION + +/* Define to `int' if doesn't define. */ +#define gid_t int + +/* Define to `unsigned' if does not define. */ +#ifndef _SIZE_T_DEFINED +#define size_t int +#define _SIZE_T_DEFINED +#endif + +/* Define to `int' if doesn't define. */ +#define uid_t int + + +/* Ugly. */ + +#define S_IRUSR _S_IREAD +#define S_IWUSR _S_IWRITE +#define S_IRGRP 0 +#define S_IROTH 0 + + + Index: src/inc/cookie.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/cookie.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 cookie.h --- src/inc/cookie.h 5 Aug 2001 21:15:39 -0000 1.1.1.1 +++ src/inc/cookie.h 20 Aug 2003 05:58:11 -0000 @@ -14,10 +14,10 @@ extern void register_cookie(char type, const char *expirevar, CookieFn create, CookieFn destroy); extern int match_cookie(const char *cookie, const char *match); -extern int request_cookie(const char *filename, char *cookie, +extern int request_cookie(const char *filename, char *cookie, int cookielen, char cookietype, const char *cookiedata); extern int verify_cookie(const char *filename, const char *cookie, - char cookietype, char *cookiedata); + char cookietype, char *cookiedata, int datalen); extern int del_cookie(const char *filename, const char *cookie); extern void expire_cookies(const char *filename); extern void expire_all_cookies(void); Index: src/inc/core.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/core.h,v retrieving revision 1.2 diff -u -r1.2 core.h --- src/inc/core.h 30 Apr 2002 18:59:46 -0000 1.2 +++ src/inc/core.h 20 Aug 2003 05:58:11 -0000 @@ -1,13 +1,15 @@ #ifndef _CORE_H #define _CORE_H +#include "config.h" + #include #include -#ifndef WIN32 + +#if defined(HAVE_SYS_TIME_H) && defined(TIME_WITH_SYS_TIME) #include #endif -#include "config.h" extern int send_textfile(const char *address, const char *textfile); extern int send_textfile_expand(const char *address, const char *textfile); @@ -33,5 +35,11 @@ extern int expand_append(const char *mainfile, const char *liscript); extern void build_hostname(char *buffer, int len); extern int generate_queue(); + +extern void init_listserver(); +extern void finish_listserver(); + +extern int init_queuefile(); + #endif /* _CORE_H */ Index: src/inc/fileapi.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/fileapi.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 fileapi.h --- src/inc/fileapi.h 5 Aug 2001 21:15:39 -0000 1.1.1.1 +++ src/inc/fileapi.h 20 Aug 2003 05:58:11 -0000 @@ -1,14 +1,15 @@ #ifndef _FILEAPI_H #define _FILEAPI_H +#include "config.h" #include -#ifndef WIN32 +#ifdef HAVE_SYS_FILE_H # include #endif - -#ifndef WIN32 # include + +#ifdef HAVE_DIRENT_H # include # define LDIR DIR* #else @@ -47,7 +48,7 @@ extern int replace_file(const char *src, const char *dest); -extern int walk_dir(const char *path, char *buffer, LDIR *dir); +extern int walk_dir(const char *path, char *buffer, int bufsize, LDIR *dir); extern int next_dir(LDIR dir, char *buffer); extern int close_dir(LDIR dir); Index: src/inc/funcparse.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/funcparse.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 funcparse.h --- src/inc/funcparse.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/funcparse.h 20 Aug 2003 05:58:11 -0000 @@ -1,6 +1,6 @@ #ifndef __FUNCPARSE_H #define __FUNCPARSE_H -typedef int(*FuncFn)(char **argv, char *result, char *error); +typedef int(*FuncFn)(char **argv, char *result, int ressize, char *error, int errsize); struct listserver_funcdef { @@ -11,13 +11,13 @@ struct listserver_funcdef *next; }; -#define FUNC_HANDLER(a) int a(char **argv, char *result, char *error) +#define FUNC_HANDLER(a) int a(char **argv, char *result, int ressize, char *error, int errsize) extern void add_func(const char *name, int nargs, const char *desc, FuncFn fn); extern void new_funcs(void); extern void nuke_funcs(void); extern struct listserver_funcdef *find_func(const char *name); extern struct listserver_funcdef *get_funcs(void); -extern int parse_function(const char *buffer, char *result, char *error); +extern int parse_function(const char *buffer, char *result, int ressize, char *error, int errsize); #endif Index: src/inc/list.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/list.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 list.h --- src/inc/list.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/list.h 20 Aug 2003 05:58:11 -0000 @@ -11,7 +11,7 @@ extern char *list_directory(const char *listname); extern int listdir_file(char *buffer, const char *list, const char *filename); -extern int walk_lists(char *buf); -extern int next_lists(char *buf); +extern int walk_lists(char *buf, int bufsize); +extern int next_lists(char *buf, int bufsize); #endif /* _LIST_H */ Index: src/inc/lpm-api.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/lpm-api.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lpm-api.h --- src/inc/lpm-api.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/lpm-api.h 20 Aug 2003 05:58:11 -0000 @@ -3,9 +3,10 @@ #ifndef LPM_API_H #define LPM_API_H +#include "config.h" #include #include -#ifndef WIN32 +#if defined(HAVE_SYS_TIME_H) && defined(TIME_WITH_SYS_TIME) #include #endif @@ -35,10 +36,10 @@ void (*register_cookie)(char type, const char *expirevar, CookieFn create, CookieFn destroy); int (*match_cookie)(const char *cookie, const char *match); - int (*request_cookie)(const char *filename, char *cookie, + int (*request_cookie)(const char *filename, char *cookie, int cookielen, char type, const char *cookiedata); int (*verify_cookie)(const char *filename, const char *cookie, - char type, char *cookiedata); + char type, char *cookiedata, int datalen); int (*del_cookie)(const char *filename, const char *cookie); void (*expire_all_cookies)(void); @@ -51,7 +52,7 @@ int (*match_reg)(const char *pattern, const char *match); void (*log_printf)(int level, char *format, ...); void (*result_printf)(char *format, ...); - void (*quote_command)(); + void (*quote_command)( void ); void (*filesys_error)(const char *filename); void (*internal_error)(const char *message); void (*spit_status)(const char *statustext, ...); @@ -82,7 +83,7 @@ int (*unlink_file)(const char *); int (*putc_file)(char outchar, FILE *stream); int (*replace_file)(const char *src, const char *dest); - int (*walk_dir)(const char *path, char *buffer, LDIR *dir); + int (*walk_dir)(const char *path, char *buffer, int bufsize, LDIR *dir); int (*next_dir)(LDIR dir, char *buffer); int (*close_dir)(LDIR dir); int (*mkdirs)(const char *path); @@ -125,7 +126,7 @@ struct listserver_module * (*get_modules)(void); /* From Mystring.h */ - int (*buffer_printf)(char *buffer, int length, char *format, ...); + int (*buffer_printf)(char *buffer, int length, const char *format, ...); char * (*lowerstr)(const char *); char * (*upperstr)(const char *); char * (*strcasestr)(const char *, const char *); @@ -217,10 +218,10 @@ void (*wipe_vars)(int level); const char * (*get_var)(const char *varname); void * (*get_data)(const char *varname); - const int (*get_bool)(const char *varname); - const int (*get_number)(const char *varname); + int (*get_bool)(const char *varname); + int (*get_number)(const char *varname); const char * (*get_string)(const char *varname); - const int (*get_seconds)(const char *varname); + int (*get_seconds)(const char *varname); const char *(*get_cur_varval)(struct var_data *var); struct var_data * (*start_varlist)(void); struct var_data * (*next_varlist)(void); @@ -287,8 +288,8 @@ /* list_directory for 0.126a */ char *(*list_directory)(const char *listname); int (*listdir_file)(char *buffer, const char *list, const char *filename); - int (*walk_lists)(char *buf); - int (*next_lists)(char *buf); + int (*walk_lists)(char *buf, int bufsize); + int (*next_lists)(char *buf, int bufsize); /* LCGI addition for 0.127a */ struct listserver_cgi_tempvar *(*find_cgi_tempvar)(const char *name); Index: src/inc/lpm-def.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/lpm-def.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lpm-def.h --- src/inc/lpm-def.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/lpm-def.h 20 Aug 2003 05:58:11 -0000 @@ -338,7 +338,7 @@ #define CGI_UNPARSE_EATHASH 4 /* From Funcparse.h */ -typedef int(*FuncFn)(char **argv, char *result, char *error); +typedef int(*FuncFn)(char **argv, char *result, int ressize, char *error, int errsize); struct listserver_funcdef { @@ -349,6 +349,6 @@ struct listserver_funcdef *next; }; -#define FUNC_HANDLER(a) int a(char **argv, char *result, char *error) +#define FUNC_HANDLER(a) int a(char **argv, char *result, int ressize, char *error, int errsize ) #endif Index: src/inc/lpm-mods.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/lpm-mods.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lpm-mods.h --- src/inc/lpm-mods.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/lpm-mods.h 20 Aug 2003 05:58:11 -0000 @@ -1,7 +1,7 @@ #ifndef _LPM_MODS_H #define _LPM_MODS_H +#include "config.h" -#ifdef DYNMOD struct listserver_modref { #ifndef WIN32 void * handle; @@ -14,7 +14,6 @@ extern void init_modrefs(); extern void nuke_modrefs(); -#endif /* DYNMOD */ extern int load_all_modules(void); extern int init_all_modules(void); Index: src/inc/lpm.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/lpm.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 lpm.h --- src/inc/lpm.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/lpm.h 20 Aug 2003 05:58:11 -0000 @@ -2,9 +2,10 @@ #define LSM_H #include "config.h" +#include "common.h" #include "version.h" -#ifdef DYNMOD +#ifdef HAVE_DLOPEN # include "lpm-def.h" #else # include "alias.h" Index: src/inc/moderate.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/moderate.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 moderate.h --- src/inc/moderate.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/moderate.h 20 Aug 2003 05:58:11 -0000 @@ -7,4 +7,4 @@ extern void do_moderate(const char *infilename); extern COOKIE_HANDLER(expire_modpost); -#endif // _MODERATE_H +#endif /* _MODERATE_H */ Index: src/inc/mysignal.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/mysignal.h,v retrieving revision 1.2 diff -u -r1.2 mysignal.h --- src/inc/mysignal.h 9 Nov 2001 07:46:41 -0000 1.2 +++ src/inc/mysignal.h 20 Aug 2003 05:58:11 -0000 @@ -3,4 +3,4 @@ extern void init_signals(void); -#endif // __MYSIGNAL_H +#endif /* __MYSIGNAL_H */ Index: src/inc/mystring.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/mystring.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 mystring.h --- src/inc/mystring.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/mystring.h 20 Aug 2003 05:58:11 -0000 @@ -3,7 +3,7 @@ #include -extern int buffer_printf(char *buffer, int length, char *format, ...); +extern int buffer_printf(char *buffer, int length, const char *format, ...); extern char *lowerstr(const char *); extern char *upperstr(const char *); extern char *strcasestr(const char *, const char *); Index: src/inc/snprintf.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/snprintf.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 snprintf.h --- src/inc/snprintf.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/snprintf.h 20 Aug 2003 05:58:11 -0000 @@ -1,4 +1,4 @@ -#ifdef NEED_SNPRINTF +#if !defined( HAVE_VSNPRINTF ) && !defined( HAVE__VSNPRINTF ) int my_snprintf (char *str, size_t count, const char *fmt, ...); int my_vsnprintf (char *str, size_t count, const char *fmt, va_list arg); #endif Index: src/inc/variables.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/variables.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 variables.h --- src/inc/variables.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/variables.h 20 Aug 2003 05:58:11 -0000 @@ -64,10 +64,10 @@ /* variable querying routines */ extern const char *get_var(const char *varname); -extern const int get_bool(const char *varname); -extern const int get_number(const char *varname); +extern int get_bool(const char *varname); +extern int get_number(const char *varname); extern const char *get_string(const char *varname); -extern const int get_seconds(const char *varname); +extern int get_seconds(const char *varname); extern const void *get_data(const char *varname); extern const char *get_var_unexpanded(const char *varname); Index: src/inc/version.h =================================================================== RCS file: /usr/cvsroot/ecartis/src/inc/version.h,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 version.h --- src/inc/version.h 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/inc/version.h 20 Aug 2003 05:58:11 -0000 @@ -1,8 +1,10 @@ #ifndef _VERSION_H #define _VERSION_H -#define LISTAR_VERSION "1.0.0" -#define ECARTIS_VERSION "1.0.0" +#include "config.h" + +#define LISTAR_VERSION PACKAGE_VERSION +#define ECARTIS_VERSION PACKAGE_VERSION #define VER_PRODUCTVERSION_STR LISTAR_VERSION #endif /* _VERSION_H */ Index: src/inc/xmalloc.h =================================================================== RCS file: src/inc/xmalloc.h diff -N src/inc/xmalloc.h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/inc/xmalloc.h 20 Aug 2003 05:58:11 -0000 @@ -0,0 +1,14 @@ +#ifndef XMALLOC_H +#define XMALLOC_H + +#include "config.h" +/* FIXME */ +#ifndef HAVE_SIZE_T +#define size_t long +#endif + +extern void* xmalloc( size_t size ); +extern void* xrealloc( void* o, size_t size ); +extern char* xstrdup( const char* s ); + +#endif Index: src/modules/Makefile.am =================================================================== RCS file: src/modules/Makefile.am diff -N src/modules/Makefile.am --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/modules/Makefile.am 20 Aug 2003 05:58:11 -0000 @@ -0,0 +1,41 @@ +## Process this file with automake to produce Makefile.in + +DIST_SUBDIRS = acctmgr admin administrivia antispam base bouncer digest \ +filearchive listarchive lsg2 pantomime password peruser send stat \ +toolbox + +SUBDIRS = @ENABLED_MODULES@ + +AUTOMAKE_OPTIONS = foreign + +EXTRA_DIST = module.mk.in Makefile.win + +Makefile.win: winmakefiles + +winmakefiles: + echo '#Autogenerated file, do not edit' > Makefile.win; \ + echo "all: alllpms">>Makefile.win; \ + echo>>Makefile.win; \ + for p in *; do \ + if [ "$$p" != CVS -a -d "$$p" ]; then \ + grep -v include "$$p/Makefile" | sed -e 's/\.o/.obj/g' > "$$p/Makefile.win"; \ + echo>>"$$p/Makefile.win"; \ + echo 'CFLAGS = -I..\..\inc -DWIN32 /TC'>>"$$p/Makefile.win"; \ + echo 'LIBS = ws2_32.lib'>>"$$p/Makefile.win"; \ + echo "$$p.lpm: $$p">>Makefile.win; \ + echo " cd $$p">>Makefile.win; \ + echo " nmake /f Makefile.win">>Makefile.win; \ + echo " cd ..">>Makefile.win; \ + echo "">>Makefile.win; \ + echo "$$p.lpm:"' $$(OBJS)'>>"$$p/Makefile.win"; \ + echo ' $$(CC) $$(EXTRA_LFLAGS) $$(LFLAGS) $$(OBJS) $$(EXTRA_LIBS) $$(LIBS) /LD /link /out:'"$$p".lpm>>"$$p/Makefile.win";\ + echo ' copy '"$$p".lpm '..'>>"$$p/Makefile.win";\ + echo "">>"$$p/Makefile.win";\ + echo ".c.obj:">>"$$p/Makefile.win";\ + echo ' $$(CC) $$(WFLAGS) $$(CFLAGS) $$(EXTRA_CDEFS) $$(EXTRA_CFLAGS) /GD -c $$*.c'>>"$$p/Makefile.win";\ + echo ''>>Makefile.win;\ + lpms="$$lpms $$p.lpm";\ + fi; \ + done;\ + echo "alllpms: $$lpms">>Makefile.win;\ + echo ' copy *.lpm ..'>>Makefile.win Index: src/modules/module.mk.in =================================================================== RCS file: src/modules/module.mk.in diff -N src/modules/module.mk.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/modules/module.mk.in 20 Aug 2003 05:58:11 -0000 @@ -0,0 +1,44 @@ +CC=@CC@ +CPPFLAGS=@CPPFLAGS@ +CFLAGS=@CFLAGS@ +LDFLAGS=@LDFLAGS@ +LIBS=@LIBS@ +DEFS=@DEFS@ + +AR=@AR@ +RANLIB=@RANLIB@ + +COMMON_CPPFLAGS = -I../../inc + +@IF_DYNMODS@EXTRA_CFLAGS = @DYNMODS_CFLAGS@ +@IF_DYNMODS@EXTRA_LDFLAGS = @DYNMODS_LDFLAGS@ +@IF_DYNMODS@EXTRA_TARGET = $(MODULE).lpm +@IF_DYNMODS@ +@IF_DYNMODS@$(MODULE).lpm: +@IF_DYNMODS@ $(CC) $(EXTRA_LDFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) +@IF_DYNMODS@ mv $(MODULE).lpm ../.. + +MODULE_LIB = lib$(MODULE).a + +all: $(MODULE_LIB) $(EXTRA_TARGET) + +# FIXME: Do this better. + +distdir: + cp $(DISTFILES) Makefile.win $(distdir) + +Makefile.win: + (cd ..; $(MAKE) Makefile.win) + +$(MODULE_LIB): $(OBJS) + $(AR) rc $(MODULE_LIB) $(OBJS) + $(RANLIB) $(MODULE_LIB) || true + mv $(MODULE_LIB) ../.. +clean: + rm -f $(OBJS) $(MODULE_LIB) $(EXTRA_TARGET) ../../$(MODULE_LIB) ../../$(MODULE).lpm ../../modulesdone + +distclean: clean +pristine: clean + +.c.o: + $(CC) $(DEFS) $(COMMON_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $(EXTRA_CFLAGS) -c $*.c Index: src/modules/acctmgr/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/acctmgr/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/acctmgr/Makefile 5 Aug 2001 21:15:40 -0000 1.1.1.1 +++ src/modules/acctmgr/Makefile 20 Aug 2003 05:58:11 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=acctmgr - # Object files that comprise the module -OBJS=set.o sub.o unsub.o init.o vacation.o tempban.o - -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif +OBJS=init.o set.o sub.o tempban.o unsub.o vacation.o +DISTFILES=Makefile init.c set.c sub.c tempban.c unsub.c vacation.c acctmgr-mod.h -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/acctmgr/set.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/acctmgr/set.c,v retrieving revision 1.2 diff -u -r1.2 set.c --- src/modules/acctmgr/set.c 11 Aug 2002 23:14:01 -0000 1.2 +++ src/modules/acctmgr/set.c 20 Aug 2003 05:58:11 -0000 @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "acctmgr-mod.h" Index: src/modules/acctmgr/sub.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/acctmgr/sub.c,v retrieving revision 1.3 diff -u -r1.3 sub.c --- src/modules/acctmgr/sub.c 5 Oct 2002 18:54:29 -0000 1.3 +++ src/modules/acctmgr/sub.c 20 Aug 2003 05:58:12 -0000 @@ -1,5 +1,5 @@ #include "config.h" - +#include "common.h" #include #include #include @@ -230,7 +230,7 @@ } /* Generate cookie for appsub */ - if (!LMAPI->request_cookie(cookiefile,&cookie[0], 'S', addybuf)) { + if (!LMAPI->request_cookie(cookiefile, cookie, BIG_BUF, 'S', addybuf)) { LMAPI->spit_status("Unable to generate subscription cookie!"); LMAPI->filesys_error(cookiefile); return HOOK_RESULT_FAIL; @@ -370,7 +370,7 @@ } /* Request a cookie for appsub */ - if (!LMAPI->request_cookie(cookiefile,&cookie[0], 'S', addybuf)) { + if (!LMAPI->request_cookie(cookiefile, cookie, BIG_BUF, 'S', addybuf)) { LMAPI->spit_status("Unable to generate subscription cookie!"); LMAPI->filesys_error(cookiefile); return HOOK_RESULT_FAIL; @@ -945,7 +945,7 @@ free(listdir); /* Verify the cookie exists */ - if (LMAPI->verify_cookie(filename,params->words[2],'S', &buffer[0])) { + if (LMAPI->verify_cookie(filename,params->words[2],'S', buffer, BIG_BUF )) { /* Match the cookie data */ if(LMAPI->match_cookie(params->words[2],LMAPI->get_string("list"))) { char *tptr; Index: src/modules/acctmgr/tempban.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/acctmgr/tempban.c,v retrieving revision 1.2 diff -u -r1.2 tempban.c --- src/modules/acctmgr/tempban.c 11 Aug 2002 23:14:01 -0000 1.2 +++ src/modules/acctmgr/tempban.c 20 Aug 2003 05:58:12 -0000 @@ -66,15 +66,8 @@ seconds = LMAPI->get_seconds("tempban-default-duration"); time(&now); now+=seconds; -#ifdef OBSDMOD + LMAPI->buffer_printf(databuf, sizeof(databuf) - 1, "%lX;%s", (long)now, fromaddy); -#else -#if DEC_UNIX || _AIX - LMAPI->buffer_printf(databuf, sizeof(databuf) - 1, "%X;%s", now, fromaddy); -#else - LMAPI->buffer_printf(databuf, sizeof(databuf) - 1, "%lX;%s", now, fromaddy); -#endif /* DEC_UNIX */ -#endif /* OBSDMOD */ LMAPI->get_date(datebuf, sizeof(datebuf), now); if(oldcookie) { @@ -110,7 +103,7 @@ } else { LMAPI->set_var("cookie-for", fromaddy, VAR_TEMP); - if(!LMAPI->request_cookie(cookiefile, &cookie[0], 'T', databuf)) { + if(!LMAPI->request_cookie(cookiefile, cookie, sizeof(cookie), 'T', databuf)) { LMAPI->spit_status("Unable to set temporary ban."); LMAPI->filesys_error(cookiefile); return CMD_RESULT_CONTINUE; @@ -225,6 +218,7 @@ struct list_user u; char userfile[BIG_BUF]; time_t expire, now; + long expiretmp; char *listdir; time(&now); @@ -235,15 +229,8 @@ if(!user) return COOKIE_HANDLE_FAIL; *user++ = '\0'; -#ifdef OBSDMOD - sscanf(cookiedata, "%iX", &expire); -#else -#if DEC_UNIX || _AIX - sscanf(cookiedata, "%X", &expire); -#else - sscanf(cookiedata, "%lX", &expire); -#endif -#endif + sscanf(cookiedata, "%lX", &expiretmp); + expire = expiretmp; listdir = LMAPI->list_directory(LMAPI->get_string("list")); LMAPI->buffer_printf(userfile, sizeof(userfile) - 1, "%s/users", listdir); Index: src/modules/acctmgr/unsub.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/acctmgr/unsub.c,v retrieving revision 1.3 diff -u -r1.3 unsub.c --- src/modules/acctmgr/unsub.c 5 Oct 2002 18:54:29 -0000 1.3 +++ src/modules/acctmgr/unsub.c 20 Aug 2003 05:58:12 -0000 @@ -1,4 +1,5 @@ #include "config.h" +#include "common.h" #include #include @@ -74,7 +75,7 @@ LMAPI->set_var("cookie-for", LMAPI->get_string("list"), VAR_TEMP); /* Request our cookie */ - if (!LMAPI->request_cookie(cookiefile,&cookie[0],'U',fromaddy)) { + if (!LMAPI->request_cookie(cookiefile,cookie, BIG_BUF,'U',fromaddy)) { LMAPI->spit_status("Unable to generate unsubscribe cookie!"); LMAPI->filesys_error(cookiefile); return HOOK_RESULT_FAIL; @@ -185,7 +186,7 @@ LMAPI->set_var("cookie-for", LMAPI->get_string("list"), VAR_TEMP); /* Request our cookie */ - if (!LMAPI->request_cookie(cookiefile,&cookie[0],'U',fromaddy)) { + if (!LMAPI->request_cookie(cookiefile,cookie,BIG_BUF,'U',fromaddy)) { LMAPI->spit_status("Unable to generate unsubscribe cookie!"); LMAPI->filesys_error(cookiefile); return HOOK_RESULT_FAIL; @@ -546,7 +547,7 @@ LMAPI->buffer_printf(filename, sizeof(filename) - 1, "%s/cookies", listdir); /* Verify cookie exists */ - if (LMAPI->verify_cookie(filename,params->words[2],'U', &buffer[0])) { + if (LMAPI->verify_cookie(filename,params->words[2],'U', buffer, BIG_BUF)) { /* Verify cookie data matches */ if(LMAPI->match_cookie(params->words[2],LMAPI->get_string("list"))) { struct list_user user; Index: src/modules/acctmgr/vacation.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/acctmgr/vacation.c,v retrieving revision 1.2 diff -u -r1.2 vacation.c --- src/modules/acctmgr/vacation.c 11 Aug 2002 23:14:01 -0000 1.2 +++ src/modules/acctmgr/vacation.c 20 Aug 2003 05:58:12 -0000 @@ -78,15 +78,8 @@ seconds = LMAPI->get_seconds("vacation-default-duration"); time(&now); now+=seconds; -#ifdef OBSDMOD + LMAPI->buffer_printf(databuf, sizeof(databuf) - 1, "%lX;%s", (long)now, fromaddy); -#else -#if DEC_UNIX || _AIX - LMAPI->buffer_printf(databuf, sizeof(databuf) - 1, "%X;%s", now, fromaddy); -#else - LMAPI->buffer_printf(databuf, sizeof(databuf) - 1, "%lX;%s", now, fromaddy); -#endif /* DEC_UNIX */ -#endif /* OBSDMOD */ LMAPI->get_date(datebuf, sizeof(datebuf), now); if(oldcookie) { @@ -102,7 +95,7 @@ LMAPI->buffer_printf(databuf, sizeof(databuf) - 1, "Vacation updated to end on %s", datebuf); } else { LMAPI->set_var("cookie-for", fromaddy, VAR_TEMP); - if(!LMAPI->request_cookie(cookiefile, &cookie[0], 'V', databuf)) { + if(!LMAPI->request_cookie(cookiefile, cookie, sizeof( cookie ), 'V', databuf)) { LMAPI->spit_status("Unable to set timed vacation."); LMAPI->filesys_error(cookiefile); return CMD_RESULT_CONTINUE; @@ -160,6 +153,7 @@ struct list_user u; char userfile[BIG_BUF]; time_t expire, now; + long expiretmp; time(&now); @@ -169,15 +163,8 @@ if(!user) return COOKIE_HANDLE_FAIL; *user++ = '\0'; -#ifdef OBSDMOD - sscanf(cookiedata, "%iX", &expire); -#else -#if DEC_UNIX || _AIX - sscanf(cookiedata, "%X", &expire); -#else - sscanf(cookiedata, "%lX", &expire); -#endif -#endif + sscanf(cookiedata, "%lX", &expiretmp); + expire = expiretmp; LMAPI->listdir_file(userfile,LMAPI->get_string("list"),"users"); if(LMAPI->user_find(userfile, user, &u)) { Index: src/modules/admin/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/admin/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/admin/Makefile 5 Aug 2001 21:15:42 -0000 1.1.1.1 +++ src/modules/admin/Makefile 20 Aug 2003 05:58:12 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=admin - # Object files that comprise the module OBJS=admin.o init.o +DISTFILES=Makefile admin.c init.c admin-mod.h -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/admin/admin.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/admin/admin.c,v retrieving revision 1.2 diff -u -r1.2 admin.c --- src/modules/admin/admin.c 11 Aug 2002 23:14:30 -0000 1.2 +++ src/modules/admin/admin.c 20 Aug 2003 05:58:12 -0000 @@ -1,6 +1,7 @@ #include #include #include +#include #include #include "admin-mod.h" @@ -55,7 +56,7 @@ LMAPI->listdir_file(tbuf,LMAPI->get_string("list"),"cookies"); - if (!LMAPI->request_cookie(tbuf,&cookie[0], 'A', buffer)) { + if (!LMAPI->request_cookie(tbuf,cookie, BIG_BUF, 'A', buffer)) { LMAPI->spit_status("Unable to obtain cookie."); return CMD_RESULT_CONTINUE; } @@ -144,7 +145,7 @@ LMAPI->listdir_file(tbuf,LMAPI->get_string("list"),"cookies"); - if (!LMAPI->request_cookie(tbuf,&cookie[0], 'A', buffer)) { + if (!LMAPI->request_cookie(tbuf,cookie, BIG_BUF, 'A', buffer)) { LMAPI->spit_status("Unable to obtain cookie."); return CMD_RESULT_CONTINUE; } @@ -220,7 +221,7 @@ LMAPI->listdir_file(tbuf,listname,"cookies"); /* Do we have a cookie? */ - if (!LMAPI->verify_cookie(tbuf,cookie,'A', &cookiedata[0])) { + if (!LMAPI->verify_cookie(tbuf,cookie,'A', cookiedata, BIG_BUF )) { LMAPI->spit_status("Unable to find cookie or cookie is of wrong type."); return CMD_RESULT_END; } @@ -656,7 +657,7 @@ /* Bake a cookie */ LMAPI->listdir_file(tbuf,listptr,"cookies"); - if (!LMAPI->request_cookie(tbuf,&cookie[0],'F', params->words[0])) { + if (!LMAPI->request_cookie(tbuf, cookie, BIG_BUF, 'F', params->words[0])) { LMAPI->spit_status("Unable to obtain cookie."); LMAPI->close_file(infile); return CMD_RESULT_CONTINUE; @@ -764,7 +765,7 @@ /* Find the cookie. */ LMAPI->listdir_file(tbuf,listptr,"cookies"); - if (!LMAPI->verify_cookie(tbuf,mytemp,'F',&cookiedata[0])) { + if (!LMAPI->verify_cookie(tbuf,mytemp,'F', cookiedata, BIG_BUF )) { LMAPI->spit_status("Unable to find cookie or cookie is of wrong type."); return CMD_RESULT_END; } Index: src/modules/administrivia/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/administrivia/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/administrivia/Makefile 5 Aug 2001 21:15:43 -0000 1.1.1.1 +++ src/modules/administrivia/Makefile 20 Aug 2003 05:58:12 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=administrivia - # Object files that comprise the module OBJS=administrivia.o +DISTFILES=Makefile administrivia.c -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/antispam/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/antispam/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/antispam/Makefile 5 Aug 2001 21:15:43 -0000 1.1.1.1 +++ src/modules/antispam/Makefile 20 Aug 2003 05:58:12 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=antispam - # Object files that comprise the module OBJS=antispam.o +DISTFILES=Makefile antispam.c -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/base/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/base/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/base/Makefile 5 Aug 2001 21:15:43 -0000 1.1.1.1 +++ src/modules/base/Makefile 20 Aug 2003 05:58:12 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=base - # Object files that comprise the module OBJS=base.o +DISTFILES=Makefile base.c -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/base/base.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/base/base.c,v retrieving revision 1.3 diff -u -r1.3 base.c --- src/modules/base/base.c 11 Aug 2002 22:25:10 -0000 1.3 +++ src/modules/base/base.c 20 Aug 2003 05:58:13 -0000 @@ -4,47 +4,48 @@ #include #include "lpm.h" +#include "mystring.h" struct LPMAPI *LMAPI; FUNC_HANDLER(func_varset) { - sprintf(result, "%d", !(!(LMAPI->get_var(argv[0])))); + buffer_printf(result, ressize -1, "%d", !(!(LMAPI->get_var(argv[0])))); return 1; } FUNC_HANDLER(func_sub) { int b = atoi(argv[0]) - atoi(argv[1]); - sprintf(result, "%d", b); + buffer_printf(result, ressize - 1, "%d", b); return 1; } FUNC_HANDLER(func_add) { int b = atoi(argv[0]) + atoi(argv[1]); - sprintf(result, "%d", b); + buffer_printf(result, ressize - 1, "%d", b); return 1; } FUNC_HANDLER(func_and) { int b = (atoi(argv[0]) && atoi(argv[1])); - sprintf(result, "%d", b); + buffer_printf(result, ressize - 1, "%d", b); return 1; } FUNC_HANDLER(func_or) { int b = (atoi(argv[0]) || atoi(argv[1])); - sprintf(result, "%d", b); + buffer_printf(result, ressize - 1, "%d", b); return 1; } FUNC_HANDLER(func_not) { int b = (!atoi(argv[0])); - sprintf(result, "%d", b); + buffer_printf(result, ressize - 1, "%d", b); return 1; } @@ -64,9 +65,9 @@ if(alldigit1 && alldigit2) { int a = atoi(argv[0]); int b = atoi(argv[1]); - strncpy(result, ((a >= b) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((a >= b) ? "1" : "0"), ressize - 1); } else - strncpy(result, ((strcasecmp(argv[0], argv[1]) >= 0) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((strcasecmp(argv[0], argv[1]) >= 0) ? "1" : "0"), ressize - 1); return 1; } @@ -86,9 +87,9 @@ if(alldigit1 && alldigit2) { int a = atoi(argv[0]); int b = atoi(argv[1]); - strncpy(result, ((a <= b) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((a <= b) ? "1" : "0"), ressize - 1); } else - strncpy(result, ((strcasecmp(argv[0], argv[1]) <= 0) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((strcasecmp(argv[0], argv[1]) <= 0) ? "1" : "0"), ressize - 1); return 1; } @@ -108,9 +109,9 @@ if(alldigit1 && alldigit2) { int a = atoi(argv[0]); int b = atoi(argv[1]); - strncpy(result, ((a > b) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((a > b) ? "1" : "0"), ressize - 1); } else - strncpy(result, ((strcasecmp(argv[0], argv[1]) > 0) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((strcasecmp(argv[0], argv[1]) > 0) ? "1" : "0"), ressize - 1); return 1; } @@ -130,9 +131,9 @@ if(alldigit1 && alldigit2) { int a = atoi(argv[0]); int b = atoi(argv[1]); - strncpy(result, ((a < b) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((a < b) ? "1" : "0"), ressize - 1); } else - strncpy(result, ((strcasecmp(argv[0], argv[1]) < 0) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((strcasecmp(argv[0], argv[1]) < 0) ? "1" : "0"), ressize - 1); return 1; } @@ -152,14 +153,14 @@ if(alldigit1 && alldigit2) { int a = atoi(argv[0]); int b = atoi(argv[1]); - strncpy(result, ((a == b) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((a == b) ? "1" : "0"), ressize - 1); } else - strncpy(result, ((strcasecmp(argv[0], argv[1]) == 0) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, ((strcasecmp(argv[0], argv[1]) == 0) ? "1" : "0"), ressize - 1); return 1; } FUNC_HANDLER(func_eqladdr) { - strncpy(result, (LMAPI->address_match(argv[0], argv[1]) ? "1" : "0"), BIG_BUF - 1); + strncpy(result, (LMAPI->address_match(argv[0], argv[1]) ? "1" : "0"), ressize - 1); return 1; } Index: src/modules/bouncer/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/bouncer/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/bouncer/Makefile 5 Aug 2001 21:15:44 -0000 1.1.1.1 +++ src/modules/bouncer/Makefile 20 Aug 2003 05:58:13 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=bouncer - # Object files that comprise the module OBJS=bouncer.o custom.o +DISTFILES=Makefile bouncer.c custom.c bouncer.h results.h -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/bouncer/bouncer.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/bouncer/bouncer.c,v retrieving revision 1.3 diff -u -r1.3 bouncer.c --- src/modules/bouncer/bouncer.c 11 Aug 2002 22:25:10 -0000 1.3 +++ src/modules/bouncer/bouncer.c 20 Aug 2003 05:58:13 -0000 @@ -1,5 +1,7 @@ #include +#include #include +#include #include #include #include @@ -855,14 +857,14 @@ char buf[BIG_BUF], dname[BIG_BUF]; int status; - if(!(status = LMAPI->walk_lists(&dname[0]))) + if(!(status = LMAPI->walk_lists(dname, sizeof(dname)))) return MODE_ERR; LMAPI->log_printf(5,"Processing error watches for all lists...\n"); while(status) { if(dname[0] == '.') { - status = LMAPI->next_lists(&dname[0]); + status = LMAPI->next_lists(dname, sizeof(dname)); continue; } else { if(LMAPI->list_valid(dname)) { @@ -875,7 +877,7 @@ } } } - status = LMAPI->next_lists(&dname[0]); + status = LMAPI->next_lists(dname,sizeof(dname)); } return MODE_OK; Index: src/modules/bouncer/custom.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/bouncer/custom.c,v retrieving revision 1.3 diff -u -r1.3 custom.c --- src/modules/bouncer/custom.c 11 Aug 2002 22:25:11 -0000 1.3 +++ src/modules/bouncer/custom.c 20 Aug 2003 05:58:13 -0000 @@ -419,13 +419,13 @@ strncpy(errorstr, pbase, ssize); errorstr[ssize] = '\0'; - if (!isdigit(errorstr[0])) { + if (!isdigit( (int) errorstr[0])) { handle_error(550, useraddy, errorstr, outfilename); LMAPI->write_file(outfile, "User: %s:\n (%d) %s\n\n", useraddy, 550, errorstr); } else { errcode = atoi(errorstr); - for (errstr = errorstr; *errstr && isdigit(*errstr); errstr++); + for (errstr = errorstr; *errstr && isdigit( (int) *errstr); errstr++); if (*errstr) ++errstr; handle_error(errcode, useraddy, errstr, outfilename); LMAPI->write_file(outfile, "User: %s:\n (%d) %s\n\n", useraddy, errcode, errstr); Index: src/modules/digest/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/digest/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/digest/Makefile 5 Aug 2001 21:15:44 -0000 1.1.1.1 +++ src/modules/digest/Makefile 20 Aug 2003 05:58:13 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=digest - # Object files that comprise the module OBJS=digest.o +DISTFILES=Makefile digest.c -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/digest/digest.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/digest/digest.c,v retrieving revision 1.4 diff -u -r1.4 digest.c --- src/modules/digest/digest.c 7 Feb 2003 22:25:47 -0000 1.4 +++ src/modules/digest/digest.c 20 Aug 2003 05:58:14 -0000 @@ -5,23 +5,67 @@ --sparks */ +#include "config.h" -#include + +#ifdef HAVE_STRING_H +#include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDIO_H #include -#include +#endif + +#ifdef HAVE_STDLIB_H #include -#include +#endif + +#ifdef HAVE_STDARG_H +#include +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif + +#ifdef HAVE_TIME_H +#include +#endif + +#if defined(TIME_WITH_SYS_TIME) && defined(HAVE_SYS_TIME_H) +#include +#endif + +#ifdef HAVE_POLL_H +#include +#endif + +#ifdef HAVE_CTYPE_H #include +#endif + +#ifdef HAVE_SYS_STAT_H #include +#endif -#ifndef WIN32 -#include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_UNISTD_H #include -#else -#include +#endif + +#ifdef HAVE_WINSOCK2_H +#include #endif #include "lpm.h" +#include "xmalloc.h" struct LPMAPI *LMAPI; @@ -33,7 +77,7 @@ time_t now; struct tm *tm_now; - tbuf = (char *)malloc(len); + tbuf = (char *)xmalloc(len); time(&now); tm_now = localtime(&now); @@ -1025,7 +1069,7 @@ char tbuf[SMALL_BUF]; int status; - if(!(status = LMAPI->walk_lists(&dname[0]))) + if(!(status = LMAPI->walk_lists(dname,sizeof(dname)))) return MODE_ERR; LMAPI->log_printf(5,"Processing digests for all lists...\n"); @@ -1036,11 +1080,11 @@ int issue; if(!LMAPI->set_context_list(dname)) { - status = LMAPI->next_lists(&dname[0]); + status = LMAPI->next_lists(dname,sizeof(dname)); continue; } if (LMAPI->get_bool("no-digest")) { - status = LMAPI->next_lists(&dname[0]); + status = LMAPI->next_lists(dname,sizeof(dname)); continue; } @@ -1099,7 +1143,7 @@ if (dosend) digest_send(dname); } } - status = LMAPI->next_lists(&dname[0]); + status = LMAPI->next_lists(dname,sizeof(dname)); } return MODE_OK; } Index: src/modules/filearchive/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/filearchive/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/filearchive/Makefile 5 Aug 2001 21:15:46 -0000 1.1.1.1 +++ src/modules/filearchive/Makefile 20 Aug 2003 05:58:14 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=filearchive - # Object files that comprise the module OBJS=filearchive.o +DISTFILES=Makefile filearchive.c filearchive-mod.h -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/filearchive/filearchive.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/filearchive/filearchive.c,v retrieving revision 1.2 diff -u -r1.2 filearchive.c --- src/modules/filearchive/filearchive.c 11 Aug 2002 23:16:12 -0000 1.2 +++ src/modules/filearchive/filearchive.c 20 Aug 2003 05:58:14 -0000 @@ -3,6 +3,7 @@ #include #include #include +#include #include "lpm.h" @@ -78,7 +79,7 @@ LDIR mydir; LMAPI->buffer_printf(buf, sizeof(buf) - 1, "%s/%s", base_path, path); - status = LMAPI->walk_dir(buf, &dname[0], &mydir); + status = LMAPI->walk_dir(buf, dname, sizeof(dname), &mydir); if(!status) { if(first) { LMAPI->spit_status("List '%s' has no file archive available for retrieval.", Index: src/modules/listarchive/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/listarchive/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/listarchive/Makefile 5 Aug 2001 21:15:46 -0000 1.1.1.1 +++ src/modules/listarchive/Makefile 20 Aug 2003 05:58:14 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=listarchive - # Object files that comprise the module OBJS=archive.o +DISTFILES=Makefile archive.c -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/lsg2/Makefile =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/lsg2/Makefile,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 Makefile --- src/modules/lsg2/Makefile 5 Aug 2001 21:15:50 -0000 1.1.1.1 +++ src/modules/lsg2/Makefile 20 Aug 2003 05:58:14 -0000 @@ -1,76 +1,7 @@ -# Set up the compiler -CFLAGS=-I../../inc -I. -LFLAGS= - # The name of the module we are compiling here MODULE=lsg2 - # Object files that comprise the module OBJS=lsg2-main.o lsg2-func.o lsg2-mode.o lsg2-admin.o init.o +DISTFILES=Makefile init.c lsg2-admin.c lsg2-func.c lsg2-main.c lsg2-mode.c lsg2.h -#---------------------------------------------------------------- -# You shouldn't need to change anything below here. -#---------------------------------------------------------------- - -ifdef BSDMOD -ifdef OBSDMOD -EX_REQ_LF = -rdynamic -fpic -Wl,-Bshareable -Wl,-x -endif -EXTRA_LFLAGS = -shared ${EX_REQ_LF} -else -ifndef BSDIMOD -EXTRA_LFLAGS = -shared -Wl,-soname,${MODULE_LIB} -else -EXTRA_LFLAGS = -r -endif -endif - -ifdef DYNMOD -MODULE_LIB = ${MODULE}.lpm -ifndef BSDIMOD -ifdef BSDMOD -ifdef OBSDMOD -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -DOBSDMOD -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -DBSDMOD -endif -else -EXTRA_CFLAGS = -fPIC -DDYNMOD -endif -else -EXTRA_CFLAGS = -r -DDYNMOD -DBSDIMOD -endif -else -MODULE_LIB = lib${MODULE}.a -EXTRA_CFLAGS = -EXTRA_LFLAGS = -endif - -ifdef SUNOS_5 -CFLAGS=-I../../inc -I. -DSUNOS_5 -endif - -all: ${MODULE_LIB} - -${MODULE_LIB}: ${OBJS} -ifdef DYNMOD - ${CC} ${EXTRA_LFLAGS} ${LFLAGS} -o ${MODULE_LIB} ${OBJS} - cp ${MODULE_LIB} ../../build -else - ar rc ${MODULE_LIB} ${OBJS} - ranlib ${MODULE_LIB} || true - cp ${MODULE_LIB} ../.. -endif - -clean: - rm -f ${OBJS} ${MODULE_LIB} - -pristine: clean -ifdef DYNMOD - rm -f ../../build/${MODULE_LIB} -else - rm -f ../../${MODULE_LIB} -endif - -.c.o: - ${CC} ${EXTRA_CFLAGS} ${WFLAGS} ${CFLAGS} ${GNU_STRFTIME} ${STRRCHR} ${STRCHR} -c $*.c +include ../module.mk Index: src/modules/lsg2/lsg2-admin.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/lsg2/lsg2-admin.c,v retrieving revision 1.6 diff -u -r1.6 lsg2-admin.c --- src/modules/lsg2/lsg2-admin.c 5 Apr 2003 04:44:24 -0000 1.6 +++ src/modules/lsg2/lsg2-admin.c 20 Aug 2003 05:58:14 -0000 @@ -1,7 +1,23 @@ +#include "config.h" #include "lsg2.h" + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_CTYPE_H #include +#endif + +#include "xmalloc.h" extern int flag_cmp(const void *, const void *); @@ -515,7 +531,7 @@ } - filearr = (struct list_file **)malloc(sizeof(struct list_file *) * counter); + filearr = (struct list_file **)xmalloc(sizeof(struct list_file *) * counter); tfile = LMAPI->get_files(); for (i = 0; i < counter; i++) { @@ -649,7 +665,7 @@ lsg2_internal_error("No users provided."); } - inputbuffer = strdup(cvar->value); + inputbuffer = xstrdup(cvar->value); LMAPI->set_var("adminmode","true",VAR_GLOBAL); LMAPI->set_var("fromaddress",from,VAR_GLOBAL); @@ -1025,7 +1041,7 @@ tflag = tflag->next; } - flagarr = (struct listserver_flag **)malloc(sizeof(struct listserver_flag *) * counter); + flagarr = (struct listserver_flag **)xmalloc(sizeof(struct listserver_flag *) * counter); tflag = LMAPI->get_flags(); @@ -1146,7 +1162,7 @@ tflag = tflag->next; } - flagarr = (struct listserver_flag **)malloc(sizeof(struct listserver_flag *) * counter); + flagarr = (struct listserver_flag **)xmalloc(sizeof(struct listserver_flag *) * counter); tflag = LMAPI->get_flags(); @@ -1229,7 +1245,7 @@ rv = strcasecmp(domain1, domain2); /* compare the domain */ -// if (rv == 0) /* if same domain, compare user */ +/* if (rv == 0) /\* if same domain, compare user *\/ */ rv = strcasecmp(u1, u2); return rv; @@ -1264,14 +1280,14 @@ printf(">\n"); if (LMAPI->get_bool("lsg2-sort-userlist")) { - users = (const char **)malloc(n_users * sizeof(char *)); + users = xmalloc(n_users * sizeof(char *)); while(LMAPI->user_read(infile,&user)) { if (n == n_users) { n_users *= 2; users = realloc((void*)users, n_users*sizeof(char *)); } - users[n++] = strdup(user.address); + users[n++] = xstrdup(user.address); } /* kjh: sort users by e-mail address */ Index: src/modules/lsg2/lsg2-func.c =================================================================== RCS file: /usr/cvsroot/ecartis/src/modules/lsg2/lsg2-func.c,v retrieving revision 1.5 diff -u -r1.5 lsg2-func.c --- src/modules/lsg2/lsg2-func.c 8 Oct 2002 13:30:22 -0000 1.5 +++ src/modules/lsg2/lsg2-func.c 20 Aug 2003 05:58:14 -0000 @@ -1,7 +1,19 @@ +#include "config.h" + +#ifdef HAVE_STDLIB_H #include +#endif + +#ifdef HAVE_STRING_H #include +#endif + +#ifdef HAVE_STRINGS_H +#include +#endif #include "lsg2.h" +#include "xmalloc.h" int flag_cmp(const void *e1, const void *e2) { @@ -126,7 +138,7 @@ printf("\n"); @@ -157,20 +169,20 @@ int count = listsize; if (count == 0) { - status = LMAPI->walk_lists(&dname[0]); + status = LMAPI->walk_lists(dname,sizeof(dname)); if (!status) { printf("