# config.mk is generated by ./configure
include config.mk
-all: citserver setup ctdlmigrate sendcommand citmail
+all := citserver setup ctdlmigrate sendcommand citmail chkpw chkpwd
+all: $(all)
citserver: server/*.c server/modules/*/*.c config.mk server/*.h
cc ${CFLAGS} \
citmail: utils/citmail.c server/citadel_dirs.c utils/*.h server/*.h
cc ${CFLAGS} utils/citmail.c -lcitadel -o citmail
+chkpw: utils/chkpw.c utils/*.h server/*.h
+ cc ${CFLAGS} utils/chkpw.c -o chkpw
+
+chkpwd: utils/chkpwd.c utils/auth.c utils/*.h server/*.h
+ cc ${CFLAGS} utils/chkpwd.c utils/auth.c -lcrypt -o chkpwd
+
config.mk: configure
./configure
clean:
- rm -vf citserver
+ rm -vf $(all)
find . -name *.o | xargs rm -vf
- rm -vf config.mk
-# In conf-IG-ure, "distclean" is the same as "clean"
distclean: clean
+ rm -vf config.mk
--ctdldir)
CTDLDIR=$v
;;
- --with-ssl)
- SSL=yes
- ;;
- --without-ssl)
- SSL=no
- ;;
*)
echo $0 : unknown option $k
echo
echo Valid options are:
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
;;
esac
[ "$CFLAGS" = "" ] && CFLAGS='-ggdb -Werror -Wfatal-errors -Wno-discarded-qualifiers'
[ "$LDFLAGS" = "" ] && LDFLAGS=''
+########################################################################
# Test for OpenSSL
-[ "$SSL" != "yes" ] && [ "$SSL" != "no" ] && {
- echo Testing for OpenSSL...
- tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
- tempcc=${tempfile}.c
- cat >$tempcc <<!
+########################################################################
+echo Testing for OpenSSL...
+tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
+tempcc=${tempfile}.c
+cat >$tempcc <<!
#include <openssl/ssl.h>
int main(int argc, char **argv) {
SSL_load_error_strings();
exit(0);
}
!
- SSL='no';
- cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && SSL='yes'
- rm -f $tempfile 2>/dev/null
- rm -f $tempcc 2>/dev/null
-}
-echo SSL: $SSL
-[ "$SSL" = "yes" ] && {
+cc $tempcc -lssl -lcrypto -o $tempfile && $tempfile && {
CFLAGS=${CFLAGS}' -DHAVE_OPENSSL'
LDFLAGS=${LDFLAGS}' -lssl -lcrypto -lz'
+} || {
+ echo Citadel Server requires OpenSSL which is not present.
+ exit 2
+}
+
+
+########################################################################
+# Test for iconv
+########################################################################
+echo Testing for iconv...
+tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/configure.$$
+tempcc=${tempfile}.c
+cat >$tempcc <<!
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <iconv.h>
+int main(int argc, char **argv) {
+ size_t wow = iconv(NULL, NULL, NULL, NULL, NULL);
+ return(0);
+}
+!
+
+cc $tempcc -o $tempfile && {
+ ICONV='yes'
+ echo iconv.h is present and requires no additional libraries
+} || {
+ echo Trying again with -liconv...
+ cc $tempcc -liconv -o $tempfile && {
+ ICONV='yes'
+ LDFLAGS=${LDFLAGS}' -liconv'
+ } || {
+ echo Citadel Server requires iconv character set conversion.
+ exit 1
+ }
}
# FIXME do a real build id here
syslog(LOG_ERR, "citserver: failed to access and create directories");
exit(1);
}
+
+ syslog(LOG_DEBUG, "citserver: ctdl_message_dir is %s", ctdl_message_dir);
+ syslog(LOG_DEBUG, "citserver: ctdl_file_dir is %s", ctdl_file_dir);
+ syslog(LOG_DEBUG, "citserver: ctdl_key_dir is %s", ctdl_key_dir);
+ syslog(LOG_DEBUG, "citserver: ctdl_run_dir is %s", ctdl_run_dir);
+
syslog(LOG_INFO, "Opening databases");
open_databases();
// system-level password checking for host auth mode
-// by Nathan Bryant, March 1999
-// updated by Trey van Riper, June 2005
//
-// Copyright (c) 1999-2016 by the citadel.org team
+// Copyright (c) 1999-2022 by Nathan Bryant, Trey Van Riper, and the citadel.org team
//
// This program is open source software. Use, duplication, or disclosure
// is subject to the terms of the GNU General Public License, version 3.
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
+#include <crypt.h>
#include "auth.h"
-#include "sysdep.h"
+#include "../server/sysdep.h"
#ifdef HAVE_GETSPNAM
#include <shadow.h>
-//
// Copyright (c) 1987-2022 by the citadel.org team
//
// This program is open source software. Use, duplication, or disclosure
#include <string.h>
#include <limits.h>
#include <dirent.h>
+#include "../server/citadel.h"
+#include "../server/sysdep.h"
+#include "../server/citadel_dirs.h"
-
-#include "citadel.h"
-#include "sysdep.h"
-#include "citadel_dirs.h"
-/* These pipes are used to talk to the chkpwd daemon, which is forked during startup */
+// These pipes are used to talk to the chkpwd daemon, which is forked during startup
int chkpwd_write_pipe[2];
int chkpwd_read_pipe[2];
-/*
- * Validate a password on the host unix system by talking to the chkpwd daemon
- */
-static int validpw(uid_t uid, const char *pass)
-{
+// Validate a password on the host unix system by talking to the chkpwd daemon
+static int validpw(uid_t uid, const char *pass) {
char buf[256];
int rv;
return 0;
}
-/*
- * Start up the chkpwd daemon so validpw() has something to talk to
- */
+
+// Start up the chkpwd daemon so validpw() has something to talk to
void start_chkpwd_daemon(void) {
pid_t chkpwd_pid;
struct stat filestats;
printf("Starting chkpwd daemon for host authentication mode\n");
- if ((stat(file_chkpwd, &filestats)==-1) ||
- (filestats.st_size==0)){
+ if ((stat(file_chkpwd, &filestats)==-1) || (filestats.st_size==0)){
printf("didn't find chkpwd daemon in %s: %s\n", file_chkpwd, strerror(errno));
abort();
}
}
-
int main(int argc, char **argv) {
char buf[256];
struct passwd *p;
-//
// a setuid helper program for machines which use shadow passwords
-// by Nathan Bryant, March 1999
//
-// Copyright (c) 1987-2012 by the citadel.org team
+// Copyright (c) 1987-2022 by Nathan Bryant and the citadel.org team
//
// This program is open source software. Use, duplication, or disclosure
// is subject to the terms of the GNU General Public License, version 3.
#include <syslog.h>
#include <unistd.h>
#include <sys/types.h>
-
#include <libcitadel.h>
-
#include "auth.h"
-#include "config.h"
-#include "citadel_dirs.h"
-#include "citadel.h"
+#include "../server/config.h"
+#include "../server/citadel_dirs.h"
+#include "../server/citadel.h"
-int main(void)
-{
+
+int main(void) {
uid_t uid;
char buf[SIZ];
while (1) {
buf[0] = '\0';
- read(0, &uid, sizeof(uid_t)); /* uid */
- read(0, buf, 256); /* password */
+ read(0, &uid, sizeof(uid_t)); // uid
+ read(0, buf, 256); // password
- if (buf[0] == '\0')
+ if (buf[0] == '\0') {
return (0);
+ }
if (validate_password(uid, buf)) {
write(1, "PASS", 4);
}