From 0b21b934f336f6bebb9251c7a1456892d5833841 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 26 Jul 2005 02:49:30 +0000 Subject: [PATCH] * Applied a patch sent in by Wilfried Goesgens which allows the various program and data directories to be set to any location on the host system. This will allow packagers to do FSSTND-type configurations. --- citadel/ChangeLog | 6 +- citadel/acconfig.h | 19 +++++ citadel/aidepost.c | 7 +- citadel/citadel.c | 8 +- citadel/citadel_ipc.c | 19 ++++- citadel/citmail.c | 8 +- citadel/citserver.c | 44 ++++++++-- citadel/commands.c | 8 +- citadel/config.c | 16 +++- citadel/config.guess | 152 ++++++++++++++++++++++++--------- citadel/config.sub | 160 ++++++++++++++++++++++++++--------- citadel/configure.ac | 63 +++++++++++++- citadel/control.c | 16 +++- citadel/database_sleepycat.c | 5 +- citadel/docs/citadel.html | 6 ++ citadel/file_ops.c | 134 +++++++++++++++++++++++------ citadel/msgbase.c | 25 +++++- citadel/room_ops.c | 48 +++++++++-- citadel/sendcommand.c | 8 +- citadel/serv_crypto.c | 4 +- citadel/serv_network.c | 72 +++++++++++++--- citadel/serv_smtp.c | 26 ++++-- citadel/server_main.c | 7 +- citadel/setup.c | 40 +++++++-- citadel/user_ops.c | 16 +++- 25 files changed, 747 insertions(+), 170 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index f1791ce39..9e4640424 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ +Revision 653.9 2005/07/26 02:49:25 ajc +* Applied a patch sent in by Wilfried Goesgens which allows the various + program and data directories to be set to any location on the host + system. This will allow packagers to do FSSTND-type configurations. + Revision 653.8 2005/07/25 17:37:36 ajc * citadel_ipc.c: when performing a MSG4 command, don't return the charset as part of the content-type string. @@ -6950,4 +6955,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/acconfig.h b/citadel/acconfig.h index c73bc1946..2bb230c4a 100644 --- a/citadel/acconfig.h +++ b/citadel/acconfig.h @@ -42,3 +42,22 @@ /* define this if you have the resolv.h header file. */ #undef HAVE_RESOLV_H + +/* define, if the user suplied a data-directory to use. */ +#undef HAVE_DATA_DIR +#undef DATA_DIR + +/* define, if the user suplied a spool-directory to use. */ +#undef HAVE_SPOOL_DIR +#undef SPOOL_DIR + +/* define, where the config should go in unix style */ +#undef HAVE_ETC_DIR +#undef ETC_DIR + +/* define, where the config should go in unix style */ +#undef HAVE_RUN_DIR +#undef RUN_DIR + + +#undef EGD_POOL diff --git a/citadel/aidepost.c b/citadel/aidepost.c index 3591ff896..1bc26dcd4 100644 --- a/citadel/aidepost.c +++ b/citadel/aidepost.c @@ -98,7 +98,12 @@ int main(int argc, char **argv) } snprintf(tempspool, sizeof tempspool, - "./network/spoolin/ap.%04lx", +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif + "/network/spoolin/ap.%04lx", (long)getpid()); unlink(tempspool); diff --git a/citadel/citadel.c b/citadel/citadel.c index 021872e54..2105364a2 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -1122,7 +1122,13 @@ int main(int argc, char **argv) * guaranteed to have the uid/gid we want. */ if (!getuid() || !getgid()) { - if (stat(CTDLDIR "/citadel.config", &st) < 0) { + if (stat( +#ifndef HAVE_ETC_DIR + CTDLDIR +#else + ETC_DIR +#endif + "/citadel.config", &st) < 0) { perror("couldn't stat citadel.config"); logoff(NULL, 3); } diff --git a/citadel/citadel_ipc.c b/citadel/citadel_ipc.c index a9114889e..e519e8707 100644 --- a/citadel/citadel_ipc.c +++ b/citadel/citadel_ipc.c @@ -1931,8 +1931,8 @@ int CtdlIPCStartEncryption(CtdlIPC *ipc, char *cret) SSL_set_session_id_context(temp_ssl, "Citadel SID", 14); #endif - if (!access("/var/run/egd-pool", F_OK)) - RAND_egd("/var/run/egd-pool"); + if (!access(EGD_POOL, F_OK)) + RAND_egd(EGD_POOL); if (!RAND_status()) { error_printf("PRNG not properly seeded\n"); @@ -2941,11 +2941,22 @@ CtdlIPC* CtdlIPC_new(int argc, char **argv, char *hostbuf, char *portbuf) if (!strcmp(cithost, UDS)) { if (!strcasecmp(citport, DEFAULT_PORT)) { snprintf(sockpath, sizeof sockpath, "%s%s", - CTDLDIR, "/citadel.socket"); +#ifndef HAVE_RUN_DIR + CTDLDIR +#else + RUN_DIR +#endif + , "/citadel.socket"); } else { snprintf(sockpath, sizeof sockpath, "%s%s", - citport, "/citadel.socket"); + citport, +#ifndef HAVE_RUN_DIR + CTDLDIR +#else + RUN_DIR +#endif + "/citadel.socket"); } ipc->sock = uds_connectsock(&(ipc->isLocal), sockpath); if (ipc->sock == -1) { diff --git a/citadel/citmail.c b/citadel/citmail.c index 50704818d..69af5958f 100644 --- a/citadel/citmail.c +++ b/citadel/citmail.c @@ -203,7 +203,13 @@ int main(int argc, char **argv) { } strip_trailing_nonprint(fromline); - serv_sock = uds_connectsock("lmtp.socket"); + serv_sock = uds_connectsock( +#ifndef HAVE_RUN_DIR + "." +#else + RUN_DIR +#endif + "/lmtp.socket"); serv_gets(buf); if (buf[0]!='2') cleanup(1); diff --git a/citadel/citserver.c b/citadel/citserver.c index b076e274b..2a19df2a8 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -288,7 +288,11 @@ int is_public_client(void) static time_t pc_timestamp = 0; static char public_clients[SIZ]; +#ifndef HAVE_ETC #define PUBLIC_CLIENTS "./public_clients" +#else +#define PUBLIC_CLIENTS ETC_DIR"/public_clients" +#endif /* * Check the time stamp on the public_clients file. If it's been @@ -312,7 +316,13 @@ int is_public_client(void) strcat(public_clients, addrbuf); } - fp = fopen("public_clients", "r"); + fp = fopen( +#ifndef HAVE_ETC + "." +#else + ETC_DIR +#endif + "/public_clients", "r"); if (fp != NULL) while (fgets(buf, sizeof buf, fp)!=NULL) { for (i=0; ics_clientdev, CC->cs_clienttyp); mesg_locate(targ, sizeof targ, buf2, 2, (const char **)dirs); if (strlen(targ) == 0) { @@ -482,14 +500,28 @@ void cmd_emsg(char *mname) if (buf[a] == '/') buf[a] = '.'; } - dirs[0] = strdup("messages"); - dirs[1] = strdup("help"); + dirs[0] = strdup( +#ifdef HAVE_DATA_DIR + DATA_DIR"/" +#endif + "messages"); + dirs[1] = strdup( +#ifdef HAVE_DATA_DIR + DATA_DIR"/" +#endif + "help"); mesg_locate(targ, sizeof targ, buf, 2, (const char**)dirs); free(dirs[0]); free(dirs[1]); if (strlen(targ)==0) { - snprintf(targ, sizeof targ, "./help/%s", buf); + snprintf(targ, sizeof targ, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/help/%s", buf); } mfp = fopen(targ,"w"); diff --git a/citadel/commands.c b/citadel/commands.c index 8e0a44c31..4fd1d3950 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -768,7 +768,13 @@ void load_command_set(void) ccfile = fopen(buf, "r"); } if (ccfile == NULL) { - snprintf(buf, sizeof buf, "%s/citadel.rc", CTDLDIR); + snprintf(buf, sizeof buf, +#ifndef HAVE_ETC_DIR + CTDLDIR +#else + ETC_DIR +#endif + "/citadel.rc"); ccfile = fopen(buf, "r"); } if (ccfile == NULL) { diff --git a/citadel/config.c b/citadel/config.c index 8562f3472..996118816 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -45,7 +45,13 @@ void get_config(void) { strerror(errno)); exit(1); } - cfp = fopen("citadel.config", "rb"); + cfp = fopen( +#ifndef HAVE_ETC_DIR + "." +#else + ETC_DIR +#endif + "/citadel.config", "rb"); if (cfp == NULL) { fprintf(stderr, "This program could not be started.\n" "Unable to open %s/citadel.config\n" @@ -116,7 +122,13 @@ void put_config(void) { FILE *cfp; - if ((cfp = fopen("citadel.config", "rb+")) == NULL) + if ((cfp = fopen( +#ifndef HAVE_ETC_DIR + "." +#else + ETC_DIR +#endif + "/citadel.config", "rb+")) == NULL) perror("citadel.config"); else { fwrite((char *) &config, sizeof(struct config), 1, cfp); diff --git a/citadel/config.guess b/citadel/config.guess index 4fc21ecc3..45bee1398 100755 --- a/citadel/config.guess +++ b/citadel/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2003-01-30' +timestamp='2005-04-22' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -53,7 +53,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -106,6 +106,7 @@ trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; @@ -196,15 +197,21 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; + amd64:OpenBSD:*:*) + echo x86_64-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} + cats:OpenBSD:*:*) + echo arm-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; + luna88k:OpenBSD:*:*) + echo m88k-unknown-openbsd${UNAME_RELEASE} + exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -220,28 +227,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in mvmeppc:OpenBSD:*:*) echo powerpc-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} + echo mips64-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sun3:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} exit 0 ;; - *:MicroBSD:*:*) - echo ${UNAME_MACHINE}-unknown-microbsd${UNAME_RELEASE} + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit 0 ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit 0 ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit 0 ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -279,11 +291,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? @@ -306,6 +319,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit 0 ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; @@ -323,7 +342,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit 0 ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in sparc) echo sparc-icl-nx7 && exit 0 ;; esac ;; @@ -395,6 +417,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; @@ -730,7 +755,7 @@ EOF echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` @@ -738,6 +763,11 @@ EOF FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; @@ -748,18 +778,7 @@ EOF echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -770,8 +789,8 @@ EOF i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; - x86:Interix*:3*) - echo i586-pc-interix3 + x86:Interix*:[34]*) + echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' exit 0 ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks @@ -785,6 +804,9 @@ EOF i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; + amd64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; @@ -792,17 +814,34 @@ EOF echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) + # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit 0 ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit 0 ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -878,6 +917,9 @@ EOF s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; @@ -935,6 +977,9 @@ EOF LIBC=gnuaout #endif #endif + #ifdef __dietlibc__ + LIBC=dietlibc + #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 @@ -965,6 +1010,9 @@ EOF i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos exit 0 ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; @@ -1034,9 +1082,9 @@ EOF M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit 0 ;; - M68*:*:R3V[567]*:*) + M68*:*:R3V[5678]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0) + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` @@ -1092,6 +1140,10 @@ EOF # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos @@ -1134,9 +1186,10 @@ EOF echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) - case `uname -p` in + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit 0 ;; @@ -1151,7 +1204,10 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; - NSR-[DGKLNPTVW]:NONSTOP_KERNEL:*:*) + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit 0 ;; + NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) @@ -1192,6 +1248,22 @@ EOF *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit 0 ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit 0 ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms && exit 0 ;; + I*) echo ia64-dec-vms && exit 0 ;; + V*) echo vax-dec-vms && exit 0 ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1351,7 +1423,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/citadel/config.sub b/citadel/config.sub index 5f94062aa..87a1ee49e 100755 --- a/citadel/config.sub +++ b/citadel/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2003-02-03' +timestamp='2005-04-22' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -70,7 +70,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -118,7 +118,8 @@ esac # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu* | freebsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) + nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \ + kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -144,7 +145,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -228,14 +229,16 @@ case $basic_machine in | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ - | clipper \ + | bfin \ + | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ - | ip2k \ - | m32r | m68000 | m68k | m88k | mcore \ + | ip2k | iq2000 \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -247,6 +250,7 @@ case $basic_machine in | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ @@ -259,12 +263,13 @@ case $basic_machine in | pyramid \ | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ - | tahoe | thumb | tic80 | tron \ + | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; @@ -295,19 +300,19 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ - | bs2000-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* \ - | m32r-* \ + | ip2k-* | iq2000-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -319,11 +324,13 @@ case $basic_machine in | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ @@ -331,15 +338,16 @@ case $basic_machine in | romp-* | rs6000-* \ | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; @@ -359,6 +367,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -373,6 +384,12 @@ case $basic_machine in basic_machine=a29k-none os=-bsd ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; amdahl) basic_machine=580-amdahl os=-sysv @@ -432,12 +449,27 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -460,6 +492,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -638,10 +674,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -722,10 +754,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -737,6 +765,10 @@ case $basic_machine in basic_machine=or32-unknown os=-coff ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose @@ -768,18 +800,24 @@ case $basic_machine in pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; - pentiumii | pentium2) + pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; + pentium4) + basic_machine=i786-pc + ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - pentiumii-* | pentium2-*) + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; pn) basic_machine=pn-gould ;; @@ -838,6 +876,10 @@ case $basic_machine in sb1el) basic_machine=mipsisa64sb1el-unknown ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; sequent) basic_machine=i386-sequent ;; @@ -845,6 +887,9 @@ case $basic_machine in basic_machine=sh-hitachi os=-hms ;; + sh64) + basic_machine=sh64-unknown + ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks @@ -919,10 +964,6 @@ case $basic_machine in basic_machine=t90-cray os=-unicos ;; - tic4x | c4x*) - basic_machine=tic4x-unknown - os=-coff - ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff @@ -948,6 +989,10 @@ case $basic_machine in tower | tower-32) basic_machine=m68k-ncr ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; udi29k) basic_machine=a29k-amd os=-udi @@ -991,6 +1036,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1021,6 +1070,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1043,7 +1095,7 @@ case $basic_machine in sh64) basic_machine=sh64-unknown ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1116,19 +1168,20 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ + | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -microbsd*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1152,6 +1205,9 @@ case $os in -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; @@ -1164,6 +1220,9 @@ case $os in -opened*) os=-openedition ;; + -os400*) + os=-os400 + ;; -wince*) os=-wince ;; @@ -1185,6 +1244,9 @@ case $os in -atheos*) os=-atheos ;; + -syllable*) + os=-syllable + ;; -386bsd) os=-bsd ;; @@ -1207,6 +1269,9 @@ case $os in -sinix*) os=-sysv4 ;; + -tpf*) + os=-tpf + ;; -triton*) os=-sysv3 ;; @@ -1243,6 +1308,9 @@ case $os in -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1274,6 +1342,9 @@ case $basic_machine in arm*-semi) os=-aout ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1320,6 +1391,9 @@ case $basic_machine in *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1452,9 +1526,15 @@ case $basic_machine in -mvs* | -opened*) vendor=ibm ;; + -os400*) + vendor=ibm + ;; -ptx*) vendor=sequent ;; + -tpf*) + vendor=ibm + ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; diff --git a/citadel/configure.ac b/citadel/configure.ac index 3efdfc1af..90b0b5e9e 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -11,6 +11,63 @@ else AC_DEFINE_UNQUOTED(CTDLDIR, "$prefix") fi +dnl Checks for the Datadir +AC_ARG_WITH(datadir, + [ --with-datadir directory to store the databases under], + [ if test "x$withval" != "xno" ; then + AC_DEFINE(HAVE_DATA_DIR) + AC_DEFINE_UNQUOTED(DATA_DIR, "$withval") + fi + ] +) + +dnl Checks for the spooldir +AC_ARG_WITH(spooldir, + [ --with-spooldir directory to keep queues under], + [ if test "x$withval" != "xno" ; then + AC_DEFINE(HAVE_SPOOL_DIR) + AC_DEFINE_UNQUOTED(SPOOL_DIR,"$withval") + fi + ] +) + + + +dnl Checks for the Configdir +AC_ARG_WITH(sysconfdir, + [ --with-sysconfdir directory to store the configs under], + [ if test "x$withval" != "xno" ; then + AC_DEFINE(HAVE_ETC_DIR) + AC_DEFINE_UNQUOTED(ETC_DIR, "$withval") + fi + ] +) + + +dnl Checks for the run-dir for the sockets +AC_ARG_WITH(rundir, + [ --with-rundir directory to store the configs under], + [ if test "x$withval" != "xno" ; then + AC_DEFINE(HAVE_RUN_DIR) + AC_DEFINE_UNQUOTED(RUN_DIR, "$withval") + fi + ] +) + + +dnl Checks for the Pseudo Random Generator sockets TODO: this keeps being default. +AC_DEFINE_UNQUOTED(EGD_POOL, "/var/run/egd-pool") +AC_ARG_WITH(egdpool, + [ --with-egdpool the socket from Pseudo Random Generator, defaults to /var/run/egd-pool], + [ if test "x$withval" != "xno" ; then + AC_DEFINE_UNQUOTED(EGD_POOL, "$withval") + fi + ] +) + + + + AC_ARG_ENABLE(autologin, [ --disable-autologin disable autologin (default is enabled if possible)]) AC_ARG_ENABLE(chkpwd, [ --disable-chkpwd don't build 'chkpwd']) @@ -23,7 +80,7 @@ AC_ARG_WITH(pam, [ --with-pam use PAM if present (see PAM.txt befo AC_ARG_WITH(kthread, [ --with-kthread use kernel threads (on FreeBSD) (not recommended yet)]) AC_ARG_WITH(db, [ --with-db@<:@=DIR@:>@ use Sleepycat DB 3.x @<:@DIR=/usr/local/BerkeleyDB.3.@<:@123@:>@@:>@]) AC_ARG_WITH(ssl, - [ --with-ssl=PATH Specify path to OpenSSL installation ], + [ --with-ssl=PATH Specify path to OpenSSL installation ], [ if test "x$withval" != "xno" ; then tryssldir=$withval @@ -35,7 +92,7 @@ AC_ARG_WITH(ncurses, [ --without-ncurses don't use ncurses]) AC_ARG_WITH(with_zlib, [ --with-zlib use zlib compression if present]) AC_ARG_WITH(with_ldap, [ --with-ldap use OpenLDAP client library]) AC_ARG_WITH(with_libical, [ --with-libical use libical calendaring library]) -AC_ARG_WITH(with_newt, [ --with-newt use newt window library]) +AC_ARG_WITH(with_newt, [ --with-newt use newt window library]) if test "x$with_db" != xno -a "x$with_db" != xyes -a "$with_db"; then db_dir="$with_db" @@ -118,6 +175,7 @@ case "$host" in esac dnl DEFS="$DEFS $PTHREAD_DEFS" + dnl Checks for programs. AC_PROG_CC @@ -378,7 +436,6 @@ if test "x$with_db" != xno; then fi - dnl Checks for the zlib compression library. if test "x$with_zlib" != xno ; then AC_CHECK_HEADERS(zlib.h, diff --git a/citadel/control.c b/citadel/control.c index 0b882e855..bad2a68d3 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -64,13 +64,25 @@ void get_control(void) */ memset(&CitControl, 0, sizeof(struct CitControl)); if (control_fp == NULL) { - control_fp = fopen("citadel.control", "rb+"); + control_fp = fopen( +#ifndef HAVE_RUN_DIR + "." +#else + RUN_DIR +#endif + "/citadel.control", "rb+"); if (control_fp != NULL) { fchown(fileno(control_fp), config.c_ctdluid, -1); } } if (control_fp == NULL) { - control_fp = fopen("citadel.control", "wb+"); + control_fp = fopen( +#ifndef HAVE_RUN_DIR + "." +#else + RUN_DIR +#endif + "/citadel.control", "wb+"); if (control_fp != NULL) { fchown(fileno(control_fp), config.c_ctdluid, -1); memset(&CitControl, 0, sizeof(struct CitControl)); diff --git a/citadel/database_sleepycat.c b/citadel/database_sleepycat.c index 39912dae2..eb1e37f11 100644 --- a/citadel/database_sleepycat.c +++ b/citadel/database_sleepycat.c @@ -338,9 +338,12 @@ void open_databases(void) struct dirent *d; char filename[PATH_MAX]; - +#ifndef HAVE_DATA_DIR getcwd(dbdirname, sizeof dbdirname); strcat(dbdirname, "/data"); +#else + strcat(dbdirname, DATA_DIR"/data"); +#endif lprintf(CTDL_DEBUG, "cdb_*: open_databases() starting\n"); lprintf(CTDL_DEBUG, "Compiled db: %s\n", DB_VERSION_STRING); diff --git a/citadel/docs/citadel.html b/citadel/docs/citadel.html index 0f4691859..616bf26ea 100644 --- a/citadel/docs/citadel.html +++ b/citadel/docs/citadel.html @@ -58,6 +58,12 @@ developer
IMAP and build patches
+ + Wilfried Goesgens
+ + build system patches
+
+ Michael Hampton
diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 7595fd853..e4f69426f 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -136,8 +136,14 @@ void cmd_delf(char *filename) filename[a] = '_'; } } - snprintf(pathname, sizeof pathname, "./files/%s/%s", - CC->room.QRdirname, filename); + snprintf(pathname, sizeof pathname, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/files/%s/%s", + CC->room.QRdirname, filename); a = unlink(pathname); if (a == 0) { cprintf("%d File '%s' deleted.\n", CIT_OK, pathname); @@ -270,8 +276,13 @@ void cmd_netf(char *cmdbuf) return; } snprintf(outfile, sizeof outfile, - "%s/network/spoolin/nsf.%04lx.%04x", - CTDLDIR, (long)getpid(), ++seq); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif + "/network/spoolin/nsf.%04lx.%04x", + (long)getpid(), ++seq); ofp = fopen(outfile, "a"); if (ofp == NULL) { cprintf("%d internal error\n", ERROR + INTERNAL_ERROR); @@ -300,8 +311,15 @@ void cmd_netf(char *cmdbuf) fclose(ofp); snprintf(buf, sizeof buf, - "cd ./files/%s; uuencode %s <%s 2>/dev/null >>%s", - CC->room.QRdirname, filename, filename, outfile); + "cd " +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + /* FIXME: detect uuencode while installation? or inline */ + "/files/%s; uuencode %s <%s 2>/dev/null >>%s", + CC->room.QRdirname, filename, filename, outfile); system(buf); ofp = fopen(outfile, "a"); @@ -374,7 +392,12 @@ void cmd_open(char *cmdbuf) } snprintf(pathname, sizeof pathname, - "./files/%s/%s", CC->room.QRdirname, filename); +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/files/%s/%s", CC->room.QRdirname, filename); CC->download_fp = fopen(pathname, "r"); if (CC->download_fp == NULL) { @@ -419,12 +442,23 @@ void cmd_oimg(char *cmdbuf) ERROR + NO_SUCH_USER); return; } - snprintf(pathname, sizeof pathname, "./userpics/%ld.gif", - usbuf.usernum); + snprintf(pathname, sizeof pathname, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/userpics/%ld.gif", + usbuf.usernum); } else if (!strcasecmp(filename, "_floorpic_")) { which_floor = extract_int(cmdbuf, 1); snprintf(pathname, sizeof pathname, - "./images/floor.%d.gif", which_floor); +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/images/floor.%d.gif", which_floor); } else if (!strcasecmp(filename, "_roompic_")) { assoc_file_name(pathname, sizeof pathname, &CC->room, "images"); } else { @@ -434,8 +468,14 @@ void cmd_oimg(char *cmdbuf) filename[a] = '_'; } } - snprintf(pathname, sizeof pathname, "./images/%s.gif", - filename); + snprintf(pathname, sizeof pathname, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/images/%s.gif", + filename); } CC->download_fp = fopen(pathname, "rb"); @@ -483,10 +523,21 @@ void cmd_uopn(char *cmdbuf) CC->upl_file[a] = '_'; } } - snprintf(CC->upl_path, sizeof CC->upl_path, "./files/%s/%s", - CC->room.QRdirname, CC->upl_file); + snprintf(CC->upl_path, sizeof CC->upl_path, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/files/%s/%s", + CC->room.QRdirname, CC->upl_file); snprintf(CC->upl_filedir, sizeof CC->upl_filedir, - "./files/%s/filedir", CC->room.QRdirname); +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/files/%s/filedir", CC->room.QRdirname); CC->upload_fp = fopen(CC->upl_path, "r"); if (CC->upload_fp != NULL) { @@ -541,20 +592,36 @@ void cmd_uimg(char *cmdbuf) } if (CC->user.axlevel >= 6) { - snprintf(CC->upl_path, sizeof CC->upl_path, "./images/%s", - basenm); + snprintf(CC->upl_path, sizeof CC->upl_path, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/images/%s", + basenm); } if (!strcasecmp(basenm, "_userpic_")) { snprintf(CC->upl_path, sizeof CC->upl_path, - "./userpics/%ld.gif", CC->user.usernum); +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/userpics/%ld.gif", CC->user.usernum); } if ((!strcasecmp(basenm, "_floorpic_")) && (CC->user.axlevel >= 6)) { which_floor = extract_int(cmdbuf, 2); snprintf(CC->upl_path, sizeof CC->upl_path, - "./images/floor.%d.gif", which_floor); +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/images/floor.%d.gif", which_floor); } if ((!strcasecmp(basenm, "_roompic_")) && (is_room_aide())) { @@ -601,8 +668,14 @@ void cmd_clos(void) if (CC->dl_is_net == 1) { CC->dl_is_net = 0; - snprintf(buf, sizeof buf, "%s/network/spoolout/%s", CTDLDIR, - CC->net_node); + snprintf(buf, sizeof buf, +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif + "/network/spoolout/%s", + CC->net_node); unlink(buf); } @@ -759,8 +832,14 @@ void cmd_ndop(char *cmdbuf) return; } - snprintf(pathname, sizeof pathname, "%s/network/spoolout/%s", - CTDLDIR, CC->net_node); + snprintf(pathname, sizeof pathname, +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif + "/network/spoolout/%s", + CC->net_node); /* first open the file in append mode in order to create a * zero-length file if it doesn't already exist @@ -807,8 +886,13 @@ void cmd_nuop(char *cmdbuf) } snprintf(CC->upl_path, sizeof CC->upl_path, - "%s/network/spoolin/%s.%04lx.%04x", - CTDLDIR, CC->net_node, (long)getpid(), ++seq); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif + "/network/spoolin/%s.%04lx.%04x", + CC->net_node, (long)getpid(), ++seq); CC->upload_fp = fopen(CC->upl_path, "r"); if (CC->upload_fp != NULL) { diff --git a/citadel/msgbase.c b/citadel/msgbase.c index d55ddd1c3..51a61cdc3 100644 --- a/citadel/msgbase.c +++ b/citadel/msgbase.c @@ -142,7 +142,13 @@ int alias(char *name) striplt(name); remove_any_whitespace_to_the_left_or_right_of_at_symbol(name); - fp = fopen("network/mail.aliases", "r"); + fp = fopen( +#ifndef HAVE_ETG_DIR + "network/" +#else + ETC_DIR +#endif + "mail.aliases", "r"); if (fp == NULL) { fp = fopen("/dev/null", "r"); } @@ -237,7 +243,13 @@ void get_mm(void) { FILE *fp; - fp = fopen("citadel.control", "r"); + fp = fopen( +#ifndef HAVE_RUN_DIR + "." +#else + RUN_DIR +#endif + "/citadel.control", "r"); if (fp == NULL) { lprintf(CTDL_CRIT, "Cannot open citadel.control: %s\n", strerror(errno)); @@ -2244,8 +2256,13 @@ long CtdlSubmitMsg(struct CtdlMessage *msg, /* message to save */ serialize_message(&smr, msg); if (smr.len > 0) { snprintf(submit_filename, sizeof submit_filename, - "./network/spoolin/netmail.%04lx.%04x.%04x", - (long) getpid(), CC->cs_pid, ++seqnum); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif + "/network/spoolin/netmail.%04lx.%04x.%04x", + (long) getpid(), CC->cs_pid, ++seqnum); network_fp = fopen(submit_filename, "wb+"); if (network_fp != NULL) { fwrite(smr.ser, smr.len, 1, network_fp); diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 4cc226dc3..81b43db06 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -1076,14 +1076,32 @@ void cmd_rdir(void) cprintf("%d not here.\n", ERROR + HIGHER_ACCESS_REQUIRED); return; } - cprintf("%d %s|%s/files/%s\n", - LISTING_FOLLOWS, config.c_fqdn, CTDLDIR, CC->room.QRdirname); + cprintf("%d %s|" +#ifndef HAVE_DATA_DIR + CTDLDIR +#else + DATA_DIR +#endif + "/files/%s\n", + LISTING_FOLLOWS, config.c_fqdn, CC->room.QRdirname); - snprintf(buf, sizeof buf, "ls %s/files/%s >%s 2> /dev/null", - CTDLDIR, CC->room.QRdirname, tempfilename); - system(buf); + snprintf(buf, sizeof buf, "ls " +#ifndef HAVE_DATA_DIR + CTDLDIR +#else + DATA_DIR +#endif + "/files/%s >%s 2> /dev/null", + CC->room.QRdirname, tempfilename); + system(buf); - snprintf(buf, sizeof buf, "%s/files/%s/filedir", CTDLDIR, CC->room.QRdirname); + snprintf(buf, sizeof buf, +#ifndef HAVE_DATA_DIR + CTDLDIR +#else + DATA_DIR +#endif + "/files/%s/filedir", CC->room.QRdirname); fd = fopen(buf, "r"); if (fd == NULL) fd = fopen("/dev/null", "r"); @@ -1092,8 +1110,14 @@ void cmd_rdir(void) while (fgets(flnm, sizeof flnm, ls) != NULL) { flnm[strlen(flnm) - 1] = 0; if (strcasecmp(flnm, "filedir")) { - snprintf(buf, sizeof buf, "%s/files/%s/%s", - CTDLDIR, CC->room.QRdirname, flnm); + snprintf(buf, sizeof buf, +#ifndef HAVE_DATA_DIR + CTDLDIR +#else + DATA_DIR +#endif + "/files/%s/%s", + CC->room.QRdirname, flnm); stat(buf, &statbuf); safestrncpy(comment, "", sizeof comment); fseek(fd, 0L, 0); @@ -1399,7 +1423,13 @@ void cmd_setr(char *args) /* Create a room directory if necessary */ if (CC->room.QRflags & QR_DIRECTORY) { - snprintf(buf, sizeof buf, "./files/%s", CC->room.QRdirname); + snprintf(buf, sizeof buf, +#ifndef HAVE_DATA_DIR + CTDLDIR +#else + DATA_DIR +#endif + "/files/%s", CC->room.QRdirname); mkdir(buf, 0755); } snprintf(buf, sizeof buf, "%s> edited by %s\n", CC->room.QRname, CC->curr_user); diff --git a/citadel/sendcommand.c b/citadel/sendcommand.c index da37dd71c..e5cab9aa8 100644 --- a/citadel/sendcommand.c +++ b/citadel/sendcommand.c @@ -111,7 +111,13 @@ void np_attach_to_server(void) int r; strcpy(hostbuf, UDS); /* Only run on a unix domain socket */ - strcpy(portbuf, "."); /* IPGM will refuse to run on the network */ + strcpy(portbuf, +#ifndef HAVE_RUN_DIR + "." /* IPGM will refuse to run on the network */ +#else + "" +#endif + ); fprintf(stderr, "Attaching to server...\n"); ipc = CtdlIPC_new(1, args, hostbuf, portbuf); if (!ipc) { diff --git a/citadel/serv_crypto.c b/citadel/serv_crypto.c index bac21b2b0..c56258f34 100644 --- a/citadel/serv_crypto.c +++ b/citadel/serv_crypto.c @@ -61,8 +61,8 @@ void init_ssl(void) X509_NAME *name = NULL; FILE *fp; - if (!access("/var/run/egd-pool", F_OK)) - RAND_egd("/var/run/egd-pool"); + if (!access(EGD_POOL, F_OK)) + RAND_egd(EGD_POOL); if (!RAND_status()) { lprintf(CTDL_CRIT, diff --git a/citadel/serv_network.c b/citadel/serv_network.c index 867fabb22..f7594b520 100644 --- a/citadel/serv_network.c +++ b/citadel/serv_network.c @@ -723,8 +723,13 @@ void network_spool_msg(long msgnum, void *userdata) { /* write it to the spool file */ snprintf(filename, sizeof filename, - "./network/spoolout/%s", - mptr->remote_nodename); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolout/%s", + mptr->remote_nodename); fp = fopen(filename, "ab"); if (fp != NULL) { fwrite(sermsg.ser, @@ -1371,7 +1376,12 @@ void network_process_buffer(char *buffer, long size) { strcpy(nexthop, msg->cm_fields['D']); } snprintf(filename, sizeof filename, - "./network/spoolout/%s", nexthop); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolout/%s", nexthop); fp = fopen(filename, "ab"); if (fp != NULL) { fwrite(sermsg.ser, @@ -1537,13 +1547,24 @@ void network_do_spoolin(void) { struct dirent *d; char filename[256]; - dp = opendir("./network/spoolin"); + dp = opendir( +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolin"); if (dp == NULL) return; while (d = readdir(dp), d != NULL) { if ((strcmp(d->d_name, ".")) && (strcmp(d->d_name, ".."))) { snprintf(filename, sizeof filename, - "./network/spoolin/%s", d->d_name); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolin/%s", d->d_name); network_process_file(filename); } } @@ -1563,14 +1584,25 @@ void network_purge_spoolout(void) { char nexthop[256]; int i; - dp = opendir("./network/spoolout"); + dp = opendir( +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolout"); if (dp == NULL) return; while (d = readdir(dp), d != NULL) { if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) continue; snprintf(filename, sizeof filename, - "./network/spoolout/%s", d->d_name); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolout/%s", d->d_name); strcpy(nexthop, ""); i = is_valid_node(nexthop, NULL, d->d_name); @@ -1655,8 +1687,15 @@ void receive_spool(int sock, char *remote_nodename) { lprintf(CTDL_NOTICE, "Received %ld octets from <%s>", download_len, remote_nodename); lprintf(CTDL_DEBUG, "%s", buf); - snprintf(buf, sizeof buf, "mv %s ./network/spoolin/%s.%ld", - tempfilename, remote_nodename, (long) getpid()); + /* TODO: make move inline. forking is verry expensive. */ + snprintf(buf, sizeof buf, "mv %s " +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolin/%s.%ld", + tempfilename, remote_nodename, (long) getpid()); system(buf); } @@ -1681,7 +1720,13 @@ void transmit_spool(int sock, char *remote_nodename) return; } - snprintf(sfname, sizeof sfname, "./network/spoolout/%s", remote_nodename); + snprintf(sfname, sizeof sfname, +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif HAVE_SPOOL_DIR + "/network/spoolout/%s", remote_nodename); fd = open(sfname, O_RDONLY); if (fd < 0) { if (errno != ENOENT) { @@ -1807,7 +1852,12 @@ void network_poll_other_citadel_nodes(int full_poll) { poll = full_poll; if (poll == 0) { snprintf(spoolfile, sizeof spoolfile, - "./network/spoolout/%s", node); +#ifndef HAVE_SPOOL_DIR + CTDLDIR +#else + SPOOL_DIR +#endif + "/network/spoolout/%s", node); if (access(spoolfile, R_OK) == 0) { poll = 1; } diff --git a/citadel/serv_smtp.c b/citadel/serv_smtp.c index a1ff19cdd..0f0c7dbfe 100644 --- a/citadel/serv_smtp.c +++ b/citadel/serv_smtp.c @@ -1706,16 +1706,26 @@ char *serv_smtp_init(void) NULL); CtdlRegisterServiceHook(0, /* local LMTP */ - "lmtp.socket", - lmtp_greeting, - smtp_command_loop, - NULL); +#ifndef HAVE_RUN_DIR + "." +#else + RUN_DIR +#endif + "/lmtp.socket", + lmtp_greeting, + smtp_command_loop, + NULL); CtdlRegisterServiceHook(0, /* local LMTP */ - "lmtp-unfiltered.socket", - lmtp_unfiltered_greeting, - smtp_command_loop, - NULL); +#ifndef HAVE_RUN_DIR + "." +#else + RUN_DIR +#endif + "/lmtp-unfiltered.socket", + lmtp_unfiltered_greeting, + smtp_command_loop, + NULL); smtp_init_spoolout(); CtdlRegisterSessionHook(smtp_do_queue, EVT_TIMER); diff --git a/citadel/server_main.c b/citadel/server_main.c index 6497d3787..c29caa7aa 100644 --- a/citadel/server_main.c +++ b/citadel/server_main.c @@ -183,7 +183,12 @@ int main(int argc, char **argv) * Bind the server to a Unix-domain socket. */ CtdlRegisterServiceHook(0, - "citadel.socket", +#ifndef HAVE_RUN_DIR + "." +#else + RUN_DIR +#endif + "/citadel.socket", citproto_begin_session, do_command_loop, do_async_loop); diff --git a/citadel/setup.c b/citadel/setup.c index 1ff28e10f..cfd3acc07 100644 --- a/citadel/setup.c +++ b/citadel/setup.c @@ -848,7 +848,13 @@ void write_config_to_disk(void) FILE *fp; int fd; - if ((fd = creat("citadel.config", S_IRUSR | S_IWUSR)) == -1) { + if ((fd = creat( +#ifndef HAVE_ETC_DIR + "." +#else + ETC_DIR +#endif + "/citadel.config", S_IRUSR | S_IWUSR)) == -1) { display_error("setup: cannot open citadel.config"); cleanup(1); } @@ -992,7 +998,13 @@ int main(int argc, char *argv[]) * completely new copy. */ - if ((a = open("citadel.config", O_WRONLY | O_CREAT | O_APPEND, + if ((a = open( +#ifndef HAVE_ETC_DIR + "." +#else + ETC_DIR +#endif + "/citadel.config", O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR)) == -1) { display_error("setup: cannot append citadel.config"); cleanup(errno); @@ -1007,7 +1019,13 @@ int main(int argc, char *argv[]) fclose(fp); /* now we re-open it, and read the old or blank configuration */ - fp = fopen("citadel.config", "rb"); + fp = fopen( +#ifndef HAVE_ETC_DIR + "." +#else + ETC_DIR +#endif + "/citadel.config", "rb"); if (fp == NULL) { display_error("setup: cannot open citadel.config"); cleanup(errno); @@ -1193,7 +1211,13 @@ NEW_INST: chown(".", config.c_ctdluid, gid); sleep(1); progress("Setting file permissions", 1, 4); - chown("citadel.config", config.c_ctdluid, gid); + chown( +#ifndef HAVE_ETC_DIR + "." +#else + ETC_DIR +#endif + "/citadel.config", config.c_ctdluid, gid); sleep(1); progress("Setting file permissions", 2, 4); snprintf(aaa, sizeof aaa, @@ -1202,7 +1226,13 @@ NEW_INST: system(aaa); sleep(1); progress("Setting file permissions", 3, 4); - chmod("citadel.config", S_IRUSR | S_IWUSR); + chmod( +#ifndef HAVE_ETC_DIR + "." +#else + ETC_DIR +#endif + "/citadel.config", S_IRUSR | S_IWUSR); sleep(1); progress("Setting file permissions", 4, 4); diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 9f9588238..c71e98f84 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -756,11 +756,23 @@ int purge_user(char pname[]) cdb_delete(CDB_USERS, usernamekey, strlen(usernamekey)); /* remove the user's bio file */ - snprintf(filename, sizeof filename, "./bio/%ld", usbuf.usernum); + snprintf(filename, sizeof filename, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/bio/%ld", usbuf.usernum); unlink(filename); /* remove the user's picture */ - snprintf(filename, sizeof filename, "./userpics/%ld.gif", usbuf.usernum); + snprintf(filename, sizeof filename, +#ifndef HAVE_DATA_DIR + "." /* FIXME: should here be CTDLDIR ? */ +#else + DATA_DIR +#endif + "/userpics/%ld.gif", usbuf.usernum); unlink(filename); return (0); -- 2.30.2