From 950b5e7c91bc0146fc239dc90f3eb3d949f1f06a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 5 Jun 2022 12:49:16 -0400 Subject: [PATCH] Moved 'setup' to the utils directory and converted the build --- citadel/Makefile | 15 +- citadel/acinclude.m4 | 50 ---- citadel/bootstrap | 26 --- citadel/configure | 23 +- citadel/configure.ac | 15 ++ citadel/install-sh | 250 -------------------- citadel/internetmail.h | 2 - citadel/m4/ucread.m4 | 33 --- citadel/scripts/dolcov.sh | 24 -- citadel/scripts/mk_module_init.sh | 215 ----------------- citadel/scripts/valgrind_suspressions.txt | 273 ---------------------- citadel/{ => utils}/auth.c | 0 citadel/{ => utils}/auth.h | 0 citadel/{ => utils}/axdefs.h | 0 citadel/{ => utils}/chkpw.c | 0 citadel/{ => utils}/chkpwd.c | 0 citadel/{ => utils}/citadel.pam | 0 citadel/{ => utils}/citmail.c | 0 citadel/{ => utils}/ctdlmigrate.c | 0 citadel/{ => utils}/database_cleanup.sh | 0 citadel/{ => utils}/guesstimezone.sh | 2 +- citadel/{ => utils}/sendcommand.c | 0 citadel/{ => utils}/setup.c | 182 ++++++--------- 23 files changed, 113 insertions(+), 997 deletions(-) delete mode 100644 citadel/acinclude.m4 delete mode 100644 citadel/install-sh delete mode 100644 citadel/internetmail.h delete mode 100644 citadel/m4/ucread.m4 delete mode 100755 citadel/scripts/dolcov.sh delete mode 100755 citadel/scripts/mk_module_init.sh delete mode 100644 citadel/scripts/valgrind_suspressions.txt rename citadel/{ => utils}/auth.c (100%) rename citadel/{ => utils}/auth.h (100%) rename citadel/{ => utils}/axdefs.h (100%) rename citadel/{ => utils}/chkpw.c (100%) rename citadel/{ => utils}/chkpwd.c (100%) rename citadel/{ => utils}/citadel.pam (100%) rename citadel/{ => utils}/citmail.c (100%) rename citadel/{ => utils}/ctdlmigrate.c (100%) rename citadel/{ => utils}/database_cleanup.sh (100%) rename citadel/{ => utils}/guesstimezone.sh (99%) rename citadel/{ => utils}/sendcommand.c (100%) rename citadel/{ => utils}/setup.c (84%) diff --git a/citadel/Makefile b/citadel/Makefile index f1439fad9..bf4b39b6e 100644 --- a/citadel/Makefile +++ b/citadel/Makefile @@ -17,11 +17,24 @@ # config.mk is generated by ./configure include config.mk -citserver: server/*.c server/modules/*/*.c config.mk +all: citserver setup + +citserver: server/*.c server/modules/*/*.c config.mk server/*.h cc ${CFLAGS} \ server/*.c server/modules/*/*.c \ ${LDFLAGS} -lresolv -lcitadel -lpthread -lz -lical -lldap -lcrypt -lexpat -lcurl -ldb \ -o citserver +setup: utils/setup.c server/citadel_dirs.c utils/*.h server/*.h + cc ${CFLAGS} utils/setup.c -lcitadel -o setup + config.mk: configure ./configure + +clean: + rm -vf citserver + find . -name *.o | xargs rm -vf + rm -vf config.mk + +# In conf-IG-ure, "distclean" is the same as "clean" +distclean: clean diff --git a/citadel/acinclude.m4 b/citadel/acinclude.m4 deleted file mode 100644 index 0941acf0b..000000000 --- a/citadel/acinclude.m4 +++ /dev/null @@ -1,50 +0,0 @@ -# CIT_STRUCT_TM -# ------------------ -# Figure out how to get the current GMT offset. If `struct tm' has a -# `tm_gmtoff' member, define `HAVE_STRUCT_TM_TM_GMTOFF'. Otherwise, if the -# external variable `timezone' is found, define `HAVE_TIMEZONE'. -AC_DEFUN([CIT_STRUCT_TM], -[AC_REQUIRE([AC_STRUCT_TM])dnl -AC_CHECK_MEMBERS([struct tm.tm_gmtoff],,,[#include -#include <$ac_cv_struct_tm> -]) -if test "$ac_cv_member_struct_tm_tm_gmtoff" != yes; then - AC_CACHE_CHECK(for timezone, ac_cv_var_timezone, -[AC_TRY_LINK( -[#include ], -[printf("%ld", (long)timezone);], ac_cv_var_timezone=yes, ac_cv_var_timezone=no)]) - if test $ac_cv_var_timezone = yes; then - AC_DEFINE(HAVE_TIMEZONE, 1, - [Define if you don't have `tm_gmtoff' but do have the external - variable `timezone'.]) - fi -fi -])# CIT_STRUCT_TM - -AC_DEFUN([AC_CHECK_DB],[ -for lib in $1 -do - AS_VAR_PUSHDEF([ac_tr_db], [ac_cv_db_lib_${lib}])dnl - bogo_saved_LIBS="$LIBS" - LIBS="$LIBS -l$lib" - AC_CACHE_CHECK([for db_create in -l${lib}], ac_tr_db, - [AC_TRY_LINK([#include ], [int foo=db_create((void *)0, (void *) 0, -0 )], - [AS_VAR_SET(ac_tr_db, yes)], - [AS_VAR_SET(ac_tr_db, no)]) - ]) - AS_IF([test AS_VAR_GET(ac_tr_db) = yes], - [$2 - LIBS="$bogo_saved_LIBS" - SERVER_LIBS="$SERVER_LIBS -l$lib" - db=yes], - [LIBS="$bogo_saved_LIBS" - db=no]) - AS_VAR_POPDEF([ac_tr_db])dnl -test "$db" = "yes" && break -done -if test "$db" = "no"; then -$3 -fi -])# AC_CHECK_DB - diff --git a/citadel/bootstrap b/citadel/bootstrap index 354aed110..8f3373470 100755 --- a/citadel/bootstrap +++ b/citadel/bootstrap @@ -2,33 +2,7 @@ # # run me after checking Citadel out of the source code repository. -echo ... running aclocal ... -aclocal -I m4 - -echo ... running autoconf ... -autoconf - -# If your autoconf version changes, the autom4te.cache stuff will mess you up. -# Get rid of it. -echo ... removing autoheader cache files ... -rm -rf autom4te*.cache - -echo ... running autoheader ... -autoheader - echo ... running mk_svn_revision.sh ... ./scripts/mk_svn_revision.sh -echo ... running mk_module_init.sh ... -./scripts/mk_module_init.sh - grep '#define REV_LEVEL' citadel.h | sed 's/[^0-9]*//g' >package-version.txt - -echo -echo This script has been tested with autoconf 2.53 and -echo automake 1.5. Other versions may work, but we recommend -echo the latest echo compatible versions of these. -echo -echo Also note that autoconf and automake should be configured -echo with the same prefix. -echo diff --git a/citadel/configure b/citadel/configure index 4f2304d72..bd354231f 100755 --- a/citadel/configure +++ b/citadel/configure @@ -12,7 +12,6 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -echo echo echo Running the configure script to create config.mk echo @@ -28,9 +27,6 @@ do --prefix) PREFIX=$v ;; - --bindir) - BINDIR=$v - ;; --ctdldir) CTDLDIR=$v ;; @@ -44,9 +40,7 @@ do echo $0 : unknown option $k echo echo Valid options are: - echo ' --prefix=PREFIX Install files in PREFIX [/usr/local]' - echo ' --bindir=DIR Install executables in DIR [PREFIX/bin]' - echo ' --ctdldir=DIR Look for Citadel server in DIR [/usr/local/citadel]' + echo ' --ctdldir=DIR Install Citadel server to DIR [/usr/local/citadel]' echo ' --with-ssl Force build with OpenSSL support [normally autodetected]' echo ' --without-ssl Force build without OpenSSL support [normally autodetected]' exit 1 @@ -57,9 +51,13 @@ done # Set any missing values (FIXME remove the ultra-fatal -W options when finished converting from autotools) -[ "$PREFIX" = "" ] && PREFIX=/usr/local/citadel -[ "$BINDIR" = "" ] && BINDIR=${PREFIX} -[ "$CTDLDIR" = "" ] && CTDLDIR=${PREFIX} +# Accept PREFIX as a substitute for CTDLDIR, but only if CTDLDIR is not already set +[ "$CTDLDIR" = "" ] && [ "$PREFIX" != "" ] && CTDLDIR=$PREFIX + +# Configure the directory into which Citadel Server will be installed. +[ "$CTDLDIR" = "" ] && CTDLDIR=/usr/local/citadel + +# Permit override of CFLAGS and LDFLAGS using environment variables [ "$CFLAGS" = "" ] && CFLAGS='-ggdb -Werror -Wfatal-errors -Wno-discarded-qualifiers' [ "$LDFLAGS" = "" ] && LDFLAGS='' @@ -92,11 +90,10 @@ CFLAGS=${CFLAGS}' -DBUILD_ID=\"unknown\"' # Output the config.mk ( + echo # config.mk is generated by configure + echo "CTDLDIR := ${CTDLDIR}" echo "CFLAGS := ${CFLAGS}" echo "LDFLAGS := ${LDFLAGS}" - echo "PREFIX := ${PREFIX}" - echo "BINDIR := ${BINDIR}" - echo "CTDLDIR := ${CTDLDIR}" ) >config.mk cat config.mk diff --git a/citadel/configure.ac b/citadel/configure.ac index e2b50749e..a6ec3f514 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -1,3 +1,18 @@ + + + +FAIL FAIL FAIL + +THIS IS THE OLD CONFIGURE SCRIPT + +KEEPING IT HERE FOR REFERENCE AS WE BUILD THE NEW ONE + +DONT RUN THIS + + + + + dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.52) diff --git a/citadel/install-sh b/citadel/install-sh deleted file mode 100644 index ebc66913e..000000000 --- a/citadel/install-sh +++ /dev/null @@ -1,250 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/citadel/internetmail.h b/citadel/internetmail.h deleted file mode 100644 index 00c565297..000000000 --- a/citadel/internetmail.h +++ /dev/null @@ -1,2 +0,0 @@ -void LoadInternetConfig(void); -int IsHostLocal(char *WhichHost); diff --git a/citadel/m4/ucread.m4 b/citadel/m4/ucread.m4 deleted file mode 100644 index 09ac70fcd..000000000 --- a/citadel/m4/ucread.m4 +++ /dev/null @@ -1,33 +0,0 @@ -# Check if "struct ucred" is available. If not, try harder with -# _GNU_SOURCE. -# -# heavily inspired by: http://git.musicpd.org/cgit/master/mpd.git/tree/m4/ucred.m4 -# Author: Max Kellermann - -AC_DEFUN([STRUCT_UCRED],[ - AC_MSG_CHECKING([for struct ucred]) - AC_CACHE_VAL(mpd_cv_have_struct_ucred, [ - AC_TRY_COMPILE([#include ], - [struct ucred cred;], - mpd_cv_have_struct_ucred=yes, - mpd_cv_have_struct_ucred=no) - if test x$mpd_cv_have_struct_ucred = xno; then - # glibc 2.8 forces _GNU_SOURCE on us - AC_TRY_COMPILE( - [#define _GNU_SOURCE - #include ], - [struct ucred cred;], - mpd_cv_have_struct_ucred=yes, - mpd_cv_have_struct_ucred=no) - if test x$mpd_cv_have_struct_ucred = xyes; then - # :( - MPD_CFLAGS="$MPD_CFLAGS -D_GNU_SOURCE" - fi - fi - ]) - - AC_MSG_RESULT($mpd_cv_have_struct_ucred) - if test x$mpd_cv_have_struct_ucred = xyes; then - AC_DEFINE(HAVE_STRUCT_UCRED, 1, [Define if struct ucred is present from sys/socket.h]) - fi -]) \ No newline at end of file diff --git a/citadel/scripts/dolcov.sh b/citadel/scripts/dolcov.sh deleted file mode 100755 index bb5f439db..000000000 --- a/citadel/scripts/dolcov.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -CITDIR=`pwd` -OUTDIR=${CITDIR}/../../coverage/citadel -ln -s parsedate.c y.tab.c - -# if we call citserver with ./citserver, we don't need these: -#cd ${CITDIR}/utillib/; ln -s . utillib; cd .. -#cd ${CITDIR}/modules -#for i in *; do cd $CITDIR/modules/$i; ln -s . modules; ln -s . $i; ln -s ../../user_ops.h .; done - -cd ${CITDIR} - -mkdir -p ${OUTDIR} -lcov --base-directory ${CITDIR} --directory . --capture --output-file ${OUTDIR}/citadel.info $@ -genhtml --output-directory ${OUTDIR} ${OUTDIR}/citadel.info - - - -#exit -#rm y.tab.c - -find -type l -exec rm {} \; -rm -f .#user_ops.h.gcov \ No newline at end of file diff --git a/citadel/scripts/mk_module_init.sh b/citadel/scripts/mk_module_init.sh deleted file mode 100755 index cabae3ccb..000000000 --- a/citadel/scripts/mk_module_init.sh +++ /dev/null @@ -1,215 +0,0 @@ -#!/bin/sh -# -# Script to generate $C_FILE -# - -ECHO=/usr/bin/printf -SED=/usr/bin/sed - -#MINUS_e=X`$ECHO -n -e` -#if [ $MINUS_e != "X" ] ; then -# MINUS_e="" -#else -# MINUS_e="-e" -#fi - -#MINUS_E=X`$ECHO -n -E` -#if [ $MINUS_E != "X" ] ; then -# MINUS_E="" -#else -# MINUS_E="-E" -#fi - - -CUR_DIR=`pwd` -C_FILE="$CUR_DIR/modules_init.c" -H_FILE="$CUR_DIR/modules_init.h" -MOD_FILE="$CUR_DIR/Make_modules" -SRC_FILE="$CUR_DIR/Make_sources" -U_FILE="$CUR_DIR/modules_upgrade.c" - -/usr/bin/printf "Scanning extension modules for entry points.\n" - -STATIC_FIRST_MODULES="control modules euidindex msgbase database" -DYNAMIC_MODULES=`grep CTDL_MODULE_INIT modules/*/*.c |$SED 's;.*(\(.*\));\1;'` -if test -d user_modules; then - USER_MODULES=`grep CTDL_MODULE_INIT user_modules/*/*.c |$SED 's;.*(\(.*\));\1;'` -else - USER_MODULES= -fi -STATIC_LAST_MODULES="netconfig" - -############################################################################### -# start the c file # -############################################################################### - -cat <$C_FILE -/* - * $C_FILE - * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE - */ - - - -#include "sysdep.h" -#include -#include -#include -#include -#include -#include -#include -#include "citadel.h" -#include "modules_init.h" -#include "sysdep_decls.h" -#include "serv_extensions.h" - - -void LogPrintMessages(long err); -extern long DetailErrorFlags; - -void initialise_modules (int threading) -{ - long filter; - const char *pMod; - - syslog(LOG_DEBUG, "modules: initializing, CtdlThreads %s", (threading ? "enabled" : "not yet enabled")); - -EOF - - -for i in ${STATIC_FIRST_MODULES} ${DYNAMIC_MODULES} ${USER_MODULES} ${STATIC_LAST_MODULES}; do -cat <> $C_FILE - pMod = CTDL_INIT_CALL($i); - syslog(LOG_DEBUG, "modules: loaded %s", pMod); -EOF - -done -cat <> $C_FILE - - for (filter = 1; filter != 0; filter = filter << 1) - if ((filter & DetailErrorFlags) != 0) - LogPrintMessages(filter); -} - -EOF - - - - - -############################################################################### -# start the header file # -############################################################################### -cat < $H_FILE -/* - * $H_FILE - * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE - */ - - -#ifndef MODULES_INIT_H -#define MODULES_INIT_H -#include "ctdl_module.h" -extern size_t nSizErrmsg; -void initialise_modules (int threading); -void upgrade_modules(void); - -EOF - -for i in ${STATIC_FIRST_MODULES} ${DYNAMIC_MODULES} ${USER_MODULES} ${STATIC_LAST_MODULES}; do -# Add this entry point to the .h file -cat <> $H_FILE - CTDL_MODULE_INIT($i); -EOF -done - -grep CTDL_MODULE_UPGRADE *.c modules/*/*.c |$SED 's;.*(\(.*\));\CTDL_MODULE_UPGRADE(\1)\;\n;' >> $H_FILE - -cat <> $H_FILE - - -#endif /* MODULES_INIT_H */ - -EOF - - -############################################################################### -# u start the Makefile included file for $SERV_MODULES # -############################################################################### -cat <$MOD_FILE -# -# Make_modules -# This file is to be included by Makefile to dynamically add modules to the build process -# THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE -# - -SERV_MODULES = \\ -EOF - -echo modules/*/*.c | $SED -e "s;\.c ;.o \\\\\n;g" -e "s;\.c;.o;" >> $MOD_FILE -echo >> $MOD_FILE - - -############################################################################### -# start of the files which inturn removes any existing file # -############################################################################### - - -# start the Makefile included file for $SOURCES -cat <$SRC_FILE -# -# Make_sources -# This file is to be included by Makefile to dynamically add modules to the build process -# THIS FILE WAS AUTO GENERATED BY mk_modules_init.sh DO NOT EDIT THIS FILE -# - -SOURCES = \\ -EOF - -echo modules/*/*.c | $SED "s;\.c ;.c \\\\\n;g" >> $SRC_FILE -echo >> $SRC_FILE - - - -############################################################################### -# start the upgrade file # -############################################################################### -cat <$U_FILE -/* - * $U_FILE - * Auto generated by mk_modules_init.sh DO NOT EDIT THIS FILE - */ - - - -#include "sysdep.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include "citadel.h" -#include "modules_init.h" -#include "sysdep_decls.h" -#include "serv_extensions.h" - - - -void upgrade_modules (void) -{ - const char *pMod; - - syslog(LOG_INFO, "modules: upgrading."); - -EOF - -# Add this entry point to the .c file - -grep CTDL_MODULE_UPGRADE *.c modules/*/*.c |$SED 's;.*(\(.*\));\tpMod = CTDL_UPGRADE_CALL(\1)\;\n\tsyslog(LOG_INFO, "modules: %s\\n", pMod)\;\n;' >> $U_FILE - -#close the upgrade file -/usr/bin/printf "}\n" >> $U_FILE diff --git a/citadel/scripts/valgrind_suspressions.txt b/citadel/scripts/valgrind_suspressions.txt deleted file mode 100644 index ca6afee9f..000000000 --- a/citadel/scripts/valgrind_suspressions.txt +++ /dev/null @@ -1,273 +0,0 @@ -{ - blargtest ion_name_here - Memcheck:Cond - obj:/lib/libc-2.11.2.so - fun:ERR_load_ERR_strings - fun:ERR_load_crypto_strings - fun:SSL_load_error_strings - fun:init_ssl - fun:init_sysdep - fun:main -} -{ - - Memcheck:Value8 - obj:/lib/libc-2.11.2.so - fun:ERR_load_ERR_strings - fun:ERR_load_crypto_strings - fun:SSL_load_error_strings - fun:init_ssl - fun:init_sysdep - fun:main -} -{ - - Memcheck:Cond - fun:__GI_strlen - obj:/usr/lib/libcrypto.so.0.9.8 - fun:BIO_gets - fun:PEM_read_bio - fun:PEM_bytes_read_bio - fun:PEM_ASN1_read_bio - fun:SSL_CTX_use_certificate_chain_file - fun:init_ssl - fun:init_sysdep - fun:main -} -{ - - Memcheck:Cond - fun:PEM_read_bio - fun:PEM_bytes_read_bio - fun:PEM_ASN1_read_bio - fun:SSL_CTX_use_certificate_chain_file - fun:init_ssl - fun:init_sysdep - fun:main -} - - - - - - - - - -{ - some openssl initializationshit - Memcheck:Cond - ... - fun:SSL_load_error_strings - fun:init_ssl - fun:init_sysdep - fun:main -} -{ - some openssl shit - Memcheck:Value8 - ... - fun:SSL_load_error_strings - fun:init_ssl - fun:init_sysdep - fun:main -} -# obj:/lib/libc-* - -{ - more openssl library shit - Memcheck:Leak - ... - fun:SSL_library_init - fun:init_ssl - fun:init_sysdep - fun:main -} - -{ - more openssl library shit - Memcheck:Cond - ... - fun:SSL_CTX_use_certificate_chain_file - fun:init_ssl - fun:init_sysdep - fun:main -} -{ - more openssl library shit - Memcheck:Cond - ... - fun:SSL_CTX_use_PrivateKey_file - fun:init_ssl - fun:init_sysdep - fun:main -} -{ - more openssl library shit - Memcheck:Value8 - ... - fun:SSL_CTX_use_PrivateKey_file - fun:init_ssl - fun:init_sysdep - fun:main -} -{ - - Memcheck:Value8 - ... - fun:SSL_CTX_use_certificate_chain_file - fun:init_ssl - fun:init_sysdep - fun:main -} - - - -{ - - Memcheck:Cond - ... - fun:_dl_start - obj:/lib/ld-2.11.2.so - obj:* - obj:* - obj:* -} - -{ - - Memcheck:Cond - ... - fun:dl_main - fun:_dl_sysdep_start - fun:_dl_start - obj:/lib/ld-2.11.2.so - obj:* - obj:* -} - -{ - - Memcheck:Addr8 - ... - fun:__env_open - fun:open_databases - fun:master_startup - fun:main -} -{ - - Memcheck:Cond - ... - fun:__env_open - fun:open_databases - fun:master_startup - fun:main -} -{ - - Memcheck:Value8 - ... - fun:__env_open - fun:open_databases - fun:master_startup - fun:main -} - -{ - - Memcheck:Value8 - ... - fun:__env_open - fun:open_databases - fun:master_startup -} -{ - - Memcheck:Cond - ... - fun:__db_open_pp - fun:open_databases - fun:master_startup - fun:main -} -{ - - Memcheck:Cond - ... - fun:__env_open - fun:open_databases - fun:master_startup -} -{ - - Memcheck:Value8 - ... - fun:__db_open_pp - fun:open_databases - fun:master_startup - fun:main -} -{ - - Memcheck:Value8 - ... - fun:__db_open_pp - fun:open_databases - fun:master_startup - fun:main -} - -{ - - Memcheck:Cond - ... - fun:__db_open_pp - fun:open_databases -} -{ - - Memcheck:Value8 - ... - fun:__db_open_pp - fun:open_databases - fun:master_startup -} -{ - - Memcheck:Value8 - ... - fun:__db_open_pp - fun:open_databases -} - - - -{ - - Memcheck:Value8 - fun:CtdlRegisterServiceHook - ... -} - -{ - - Memcheck:Cond - fun:__GI_strlen - fun:CtdlRegisterServiceHook - ... -} - - - - - -# close -{ - - Memcheck:Cond - ... - fun:close_databases - fun:master_cleanup - fun:main -} diff --git a/citadel/auth.c b/citadel/utils/auth.c similarity index 100% rename from citadel/auth.c rename to citadel/utils/auth.c diff --git a/citadel/auth.h b/citadel/utils/auth.h similarity index 100% rename from citadel/auth.h rename to citadel/utils/auth.h diff --git a/citadel/axdefs.h b/citadel/utils/axdefs.h similarity index 100% rename from citadel/axdefs.h rename to citadel/utils/axdefs.h diff --git a/citadel/chkpw.c b/citadel/utils/chkpw.c similarity index 100% rename from citadel/chkpw.c rename to citadel/utils/chkpw.c diff --git a/citadel/chkpwd.c b/citadel/utils/chkpwd.c similarity index 100% rename from citadel/chkpwd.c rename to citadel/utils/chkpwd.c diff --git a/citadel/citadel.pam b/citadel/utils/citadel.pam similarity index 100% rename from citadel/citadel.pam rename to citadel/utils/citadel.pam diff --git a/citadel/citmail.c b/citadel/utils/citmail.c similarity index 100% rename from citadel/citmail.c rename to citadel/utils/citmail.c diff --git a/citadel/ctdlmigrate.c b/citadel/utils/ctdlmigrate.c similarity index 100% rename from citadel/ctdlmigrate.c rename to citadel/utils/ctdlmigrate.c diff --git a/citadel/database_cleanup.sh b/citadel/utils/database_cleanup.sh similarity index 100% rename from citadel/database_cleanup.sh rename to citadel/utils/database_cleanup.sh diff --git a/citadel/guesstimezone.sh b/citadel/utils/guesstimezone.sh similarity index 99% rename from citadel/guesstimezone.sh rename to citadel/utils/guesstimezone.sh index 0c86ffce2..9ae392403 100644 --- a/citadel/guesstimezone.sh +++ b/citadel/utils/guesstimezone.sh @@ -3,7 +3,7 @@ # guesstimezone.sh - an ugly hack of a script to try to guess the time # zone currently in use on the host system, and output its name. -# Copyright (c) by Art Cancro +# Copyright (c) 1987-2022 by Art Cancro and citadel.org # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the Free diff --git a/citadel/sendcommand.c b/citadel/utils/sendcommand.c similarity index 100% rename from citadel/sendcommand.c rename to citadel/utils/sendcommand.c diff --git a/citadel/setup.c b/citadel/utils/setup.c similarity index 84% rename from citadel/setup.c rename to citadel/utils/setup.c index 9083fb8d4..dbcd2a301 100644 --- a/citadel/setup.c +++ b/citadel/utils/setup.c @@ -1,16 +1,14 @@ -/* - * Citadel setup utility - * - * Copyright (c) 1987-2021 by the citadel.org team - * - * This program is open source software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ +// Citadel setup utility +// +// Copyright (c) 1987-2022 by the citadel.org team +// +// This program is open source software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License version 3. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. #define SHOW_ME_VAPPEND_PRINTF #include @@ -32,10 +30,10 @@ #include #include #include -#include "citadel.h" +#include "../server/citadel.h" #include "axdefs.h" -#include "sysdep.h" -#include "citadel_dirs.h" +#include "../server/sysdep.h" +#include "../server/citadel_dirs.h" #ifdef ENABLE_NLS #ifdef HAVE_XLOCALE_H @@ -97,8 +95,7 @@ const char *setup_text[eMaxQuestions]; char *program_title; -void SetTitles(void) -{ +void SetTitles(void) { int have_run_dir; #ifndef HAVE_RUN_DIR have_run_dir = 1; @@ -230,7 +227,7 @@ void SetTitles(void) void title(const char *text) { - printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n<%s>\n", text); + printf("\n\033[1m\033[32m<\033[33m%s\033[32m>\033[0m\n", text); } @@ -260,8 +257,7 @@ int yesno(const char *question, int default_value) { void important_message(const char *title, const char *msgtext) { char buf[SIZ]; - printf("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); - printf(" %s \n\n%s\n\n", title, msgtext); + printf("\n%s\n%s\n\n", title, msgtext); printf("%s", _("Press return to continue...")); if (fgets(buf, sizeof buf, stdin)) { ; @@ -289,24 +285,25 @@ void display_error(char *error_message_format, ...) { void progress(char *text, long int curr, long int cmax) { - static long dots_printed = 0L; long a = 0; + long i = 0; if (curr == 0) { printf("%s\n", text); - printf("...................................................."); - printf("..........................\r"); - dots_printed = 0; - } else if (curr == cmax) { + printf("\033[1m\033[33m[\033[32m............................................................................\033[33m]\033[0m\r"); + } + else if (curr == cmax) { printf("\r%79s\n", ""); - } else { + } + else { + printf("\033[1m\033[33m[\033[32m"); a = (curr * 100) / cmax; - a = a * 78; + a = a * 76; a = a / 100; - while (dots_printed < a) { + for (i=0; i/dev/null 2>&1"); if (rv != 0) { rv = system("service xinetd restart >/dev/null 2>&1"); @@ -518,8 +499,7 @@ void check_xinetd_entry(void) } -void strprompt(const char *prompt_title, const char *prompt_text, char *Target, char *DefValue) -{ +void strprompt(const char *prompt_title, const char *prompt_text, char *Target, char *DefValue) { char buf[SIZ] = ""; char setupmsg[SIZ]; @@ -554,9 +534,8 @@ void set_str_val(int msgpos, char *Target, char *DefValue) } -/* like set_str_val() but for numeric values */ -void set_int_val(int msgpos, int *target, char *default_value) -{ +// like set_str_val() but for numeric values +void set_int_val(int msgpos, int *target, char *default_value) { char buf[32]; sprintf(buf, "%d", *target); do { @@ -566,8 +545,7 @@ void set_int_val(int msgpos, int *target, char *default_value) } -void edit_value(int curr) -{ +void edit_value(int curr) { struct passwd *pw = NULL; char ctdluidname[256]; char buf[SIZ]; @@ -670,10 +648,8 @@ void edit_value(int curr) } -/* - * Messages that are no longer in use. - * We keep them here so we don't lose the translations if we need them later. - */ +// Messages that are no longer in use. +// We keep them here so we don't lose the translations if we need them later. #if 0 important_message(_("Setup finished"), _("Setup of the Citadel server is complete.\n" @@ -688,8 +664,7 @@ _("Setup is finished. You may now start the server.")); #endif -int main(int argc, char *argv[]) -{ +int main(int argc, char *argv[]) { int a, i; int curr; char buf[1024]; @@ -699,13 +674,13 @@ int main(int argc, char *argv[]) gid_t gid; char *activity = NULL; - /* Keep a mild groove on */ + // Keep a mild groove on program_title = _("Citadel setup program"); - /* set an invalid setup type */ + // set an invalid setup type setup_type = (-1); - /* parse command line args */ + // parse command line args for (a = 0; a < argc; ++a) { if (!strncmp(argv[a], "-u", 2)) { strcpy(aaa, argv[a]); @@ -724,11 +699,9 @@ int main(int argc, char *argv[]) SetTitles(); - /* - * Connect to the running Citadel server. - */ + // Connect to the running Citadel server. char *connectingmsg = _("Connecting to Citadel server"); - for (i=0; ((i<30) && (serv_sock < 0)) ; ++i) { /* wait for server to start up */ + for (i=0; ((i<30) && (serv_sock < 0)) ; ++i) { // wait for server to start up progress(connectingmsg, i, 30); serv_sock = uds_connectsock(file_citadel_admin_socket); sleep(1); @@ -744,18 +717,14 @@ int main(int argc, char *argv[]) exit(1); } - /* - * read the server greeting - */ + // read the server greeting serv_gets(buf); if (buf[0] != '2') { display_error("%s\n", buf); exit(2); } - /* - * Are we connected to the correct Citadel server? - */ + // Are we connected to the correct Citadel server? serv_puts("INFO"); serv_gets(buf); if (buf[0] != '1') { @@ -777,7 +746,7 @@ int main(int argc, char *argv[]) printf("\n\n\n *** %s ***\n\n", program_title); - /* Go through a series of dialogs prompting for config info */ + // Go through a series of dialogs prompting for config info for (curr = 1; curr < eMaxQuestions; ++curr) { edit_value(curr); @@ -785,12 +754,11 @@ int main(int argc, char *argv[]) && (getconf_int("c_auth_mode") != AUTHMODE_LDAP) && (getconf_int("c_auth_mode") != AUTHMODE_LDAP_AD) ) { - curr += 5; /* skip LDAP questions if we're not authenticating against LDAP */ + curr += 5; // skip LDAP questions if we're not authenticating against LDAP } if (curr == eSysAdminName) { - if (getconf_int("c_auth_mode") == AUTHMODE_NATIVE) { - /* for native auth mode, fetch the admin's existing pw */ + if (getconf_int("c_auth_mode") == AUTHMODE_NATIVE) { // for native auth mode, fetch the admin's existing pw snprintf(buf, sizeof buf, "AGUP %s", admin_name); serv_puts(buf); serv_gets(buf); @@ -799,28 +767,28 @@ int main(int argc, char *argv[]) } } else { - ++curr; /* skip the password question for non-native auth modes */ + ++curr; // skip the password question for non-native auth modes } } } if ((pw = getpwuid( getconf_int("c_ctdluid") )) == NULL) { gid = getgid(); - } else { + } + else { gid = pw->pw_gid; } - if (create_run_directories(getconf_int("c_ctdluid"), gid) != 0) { - display_error("%s\n", _("failed to create directories")); - } + // setup now must be run after Citadel Server is already running, so we don't need this anymore. + //if (create_run_directories(getconf_int("c_ctdluid"), gid) != 0) { + //display_error("%s\n", _("failed to create directories")); + //} activity = _("Reconfiguring Citadel server"); progress(activity, 0, 5); - sleep(1); /* Let the message appear briefly */ + sleep(1); // Let the message appear briefly - /* - * Create the administrator account. It's ok if the command fails if this user already exists. - */ + // Create the administrator account. It's ok if the command fails if this user already exists. if (getconf_int("c_auth_mode") == AUTHMODE_NATIVE) { progress(activity, 1, 5); snprintf(buf, sizeof buf, "CREU %s|%s", admin_name, admin_pass); @@ -830,9 +798,7 @@ int main(int argc, char *argv[]) } progress(activity, 3, 5); - /* - * Assign the desired password and access level to the administrator account. - */ + // Assign the desired password and access level to the administrator account. if (getconf_int("c_auth_mode") == AUTHMODE_NATIVE) { snprintf(buf, sizeof buf, "AGUP %s", admin_name); serv_puts(buf); @@ -851,11 +817,9 @@ int main(int argc, char *argv[]) } progress(activity, 5, 5); - check_xinetd_entry(); /* Check /etc/xinetd.d/telnet */ + check_xinetd_entry(); // Check /etc/xinetd.d/telnet - /* - * Restart citserver - */ + // Restart citserver activity = _("Restarting Citadel server to apply changes"); progress(activity, 0, 51); @@ -875,12 +839,12 @@ int main(int argc, char *argv[]) close(serv_sock); serv_sock = (-1); - for (i=3; i<=6; ++i) { /* wait for server to shut down */ + for (i=3; i<=6; ++i) { // wait for server to shut down progress(activity, i, 51); sleep(1); } - for (i=7; ((i<=48) && (serv_sock < 0)) ; ++i) { /* wait for server to start up */ + for (i=7; ((i<=48) && (serv_sock < 0)) ; ++i) { // wait for server to start up progress(activity, i, 51); serv_sock = uds_connectsock(file_citadel_admin_socket); sleep(1); -- 2.30.2