-# Makefile for Citadel
+########################################################################
+#
+# Makefile for Citadel Server
#
# NOTE: normally you should not have to modify the Makefile. All
# system-dependent configuration is in the "configure" script, which
# uses "Makefile.in" to generate a "Makefile". In the rare instance
-# that you have to modify something here, please take note:
-# 1. Edit Makefile.in, -not- Makefile.
-# 2. Send e-mail to ajc@uncensored.citadel.org and let me know what you
-# did, so any necessary changes can be put into the next release.
+# that you have to modify something here, please edit Makefile.in,
+# *not* Makefile.
#
########################################################################
.SILENT:
-SOURCES=utils/citmail.c \
- utils/setup.c utils/chkpw.c \
- utils/sendcommand.c \
- utils/ctdlmigrate.c utils/chkpwd.c \
+SOURCES=utils/citmail.c utils/setup.c utils/chkpw.c \
+ utils/sendcommand.c utils/ctdlmigrate.c utils/chkpwd.c \
utillib/citadel_dirs.c \
citserver.c clientsocket.c config.c control.c $(DATABASE) \
domain.c serv_extensions.c genstamp.c \
support.c sysdep.c user_ops.c journaling.c threads.c \
context.c netconfig.c md5.c
-
include Make_sources
# for VPATH builds (invoked by configure)
$(YACC) $(YFLAGS) $<
mv -f y.tab.c $@
-#
-#
-
parsedate.o: parsedate.c
Make_sources: modules_init.c
install-data:
$(srcdir)/mkinstalldirs $(DESTDIR)$(prefix)/messages
- @for i in public_clients \
- `find $(srcdir)/messages $(srcdir)/network -type f | grep -v .svn`; do \
- echo $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
- done
-@if test -d $(DESTDIR)/etc/pam.d; then \
echo $(INSTALL_DATA) $(srcdir)/citadel.pam $(DESTDIR)/etc/pam.d/citadel; \
$(INSTALL_DATA) $(srcdir)/citadel.pam $(DESTDIR)/etc/pam.d/citadel; \
install-data-new:
$(srcdir)/mkinstalldirs $(DESTDIR)$(ETC_DIR)/
- $(INSTALL_DATA) $(srcdir)/public_clients $(DESTDIR)$(ETC_DIR)/public_clients
- $(INSTALL_DATA) $(srcdir)/network/mail.aliases $(DESTDIR)$(ETC_DIR)/mail.aliases
$(srcdir)/mkinstalldirs $(DESTDIR)$(STATICDATA_DIR)/messages
@for i in \
fi
rm -vf $(SERVER_TARGETS) $(UTIL_TARGETS) $(UTILBIN_TARGETS) $(NOINST_TARGETS)
-
cleaner: clean
rm -vrf $(SERVER_TARGETS) $(UTIL_TARGETS) $(UTILBIN_TARGETS) $(NOINST_TARGETS) database_cleanup.sh *.la
rm -vrf modules_upgrade.c modules_init.c modules_init.h Make_modules Make_sources
export LDFLAGS='-L/opt/csw/lib -L /usr/local/lib'
export CFLAGS='-I/opt/csw/include -I/usr/local/include -DDISABLE_CURSES'
./configure \
- --with-db=/opt/csw/bdb44 \
+ --with-db=/opt/csw/bdb5 \
--with-ical=/usr/local/ \
--with-prefix=/opt/csw/ \
--with-datadir=/opt/csw/var/lib/citadel \
/*
* Main source module for the Citadel server
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2019 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.
struct CleanupFunctionHook *fcn;
static int already_cleaning_up = 0;
- if (already_cleaning_up)
- while (1)
+ if (already_cleaning_up) {
+ while (1) {
usleep(1000000);
+ }
+ }
already_cleaning_up = 1;
/* Run any cleanup routines registered by loadable modules */
(*fcn->h_function_pointer) ();
}
- /* Close the AdjRefCount queue file */
- AdjRefCount(-1, 0);
-
/* Do system-dependent stuff */
sysdep_master_cleanup();
}
-
/*
* returns an asterisk if there are any instant messages waiting,
* space otherwise.
}
-/*
- * Check originating host against the public_clients file. This determines
- * whether the client is allowed to change the hostname for this session
- * (for example, to show the location of the user rather than the location
- * of the client).
- */
-int CtdlIsPublicClient(void)
-{
- char buf[1024];
- char addrbuf[1024];
- FILE *fp;
- int i;
- char *public_clientspos;
- char *public_clientsend;
- char *paddr = NULL;
- struct stat statbuf;
- static time_t pc_timestamp = 0;
- static char public_clients[SIZ];
- static char public_clients_file[SIZ];
-
-#define LOCALHOSTSTR "127.0.0.1"
-
- snprintf(public_clients_file, sizeof public_clients_file, "%s/public_clients", ctdl_etc_dir);
-
- /*
- * Check the time stamp on the public_clients file. If it's been
- * updated since the last time we were here (or if this is the first
- * time we've been through the loop), read its contents and learn
- * the IP addresses of the listed hosts.
- */
- if (stat(public_clients_file, &statbuf) != 0) {
- /* No public_clients file exists, so bail out */
- syslog(LOG_WARNING, "Warning: '%s' does not exist", public_clients_file);
- return (0);
- }
-
- if (statbuf.st_mtime > pc_timestamp) {
- begin_critical_section(S_PUBLIC_CLIENTS);
- syslog(LOG_INFO, "Loading %s", public_clients_file);
-
- public_clientspos = &public_clients[0];
- public_clientsend = public_clientspos + SIZ;
- safestrncpy(public_clientspos, LOCALHOSTSTR, sizeof public_clients);
- public_clientspos += sizeof(LOCALHOSTSTR) - 1;
-
- if (hostname_to_dotted_quad(addrbuf, CtdlGetConfigStr("c_fqdn")) == 0) {
- *(public_clientspos++) = '|';
- paddr = &addrbuf[0];
- while (!IsEmptyStr(paddr) && (public_clientspos < public_clientsend))
- *(public_clientspos++) = *(paddr++);
- }
-
- fp = fopen(public_clients_file, "r");
- if (fp != NULL)
- while ((fgets(buf, sizeof buf, fp) != NULL) && (public_clientspos < public_clientsend)) {
- char *ptr;
- ptr = buf;
- while (!IsEmptyStr(ptr)) {
- if (*ptr == '#') {
- *ptr = 0;
- break;
- } else
- ptr++;
- }
- ptr--;
- while (ptr > buf && isspace(*ptr)) {
- *(ptr--) = 0;
- }
- if (hostname_to_dotted_quad(addrbuf, buf) == 0) {
- *(public_clientspos++) = '|';
- paddr = addrbuf;
- while (!IsEmptyStr(paddr) && (public_clientspos < public_clientsend)) {
- *(public_clientspos++) = *(paddr++);
- }
- }
- }
- if (fp != NULL)
- fclose(fp);
- pc_timestamp = time(NULL);
- end_critical_section(S_PUBLIC_CLIENTS);
- }
-
- syslog(LOG_DEBUG, "Checking whether %s is a local or public client", CC->cs_addr);
- for (i = 0; i < num_parms(public_clients); ++i) {
- extract_token(addrbuf, public_clients, i, '|', sizeof addrbuf);
- if (!strcasecmp(CC->cs_addr, addrbuf)) {
- syslog(LOG_DEBUG, "... yes its local.");
- return (1);
- }
- }
-
- /* No hits. This is not a public client. */
- syslog(LOG_DEBUG, "... no it isn't.");
- return (0);
-}
-
-
-
-
-
void citproto_begin_session()
{
if (CC->nologin == 1) {
/*
- * Copyright (c) 1987-2018 by the citadel.org team
+ * Copyright (c) 1987-2019 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.
extern int panic_fd;
char CtdlCheckExpress(void);
-int CtdlIsPublicClient(void);
extern time_t server_startup_time;
extern int openid_level_supported;
with_db=yes
else
test -f /usr/local/lib/libdb.a -o -f /usr/local/lib/libdb.so \
- -o -f /usr/local/lib/libdb4.a -o -f /usr/local/lib/libdb4.so \
&& db_dir=/usr/local
-
- test -d /usr/local/BerkeleyDB.4.1 && db_dir=/usr/local/BerkeleyDB.4.1
- test -d /usr/local/BerkeleyDB.4.2 && db_dir=/usr/local/BerkeleyDB.4.2
- test -d /usr/local/BerkeleyDB.4.3 && db_dir=/usr/local/BerkeleyDB.4.3
- test -d /usr/local/BerkeleyDB.4.4 && db_dir=/usr/local/BerkeleyDB.4.4
- test -d /usr/local/BerkeleyDB.4.5 && db_dir=/usr/local/BerkeleyDB.4.5
fi
AC_CANONICAL_HOST
dblib=""
- if test -d "$db_dir/include/db4"; then
- CPPFLAGS="$CPPFLAGS -I$db_dir/include/db4"
- dblib="db4"
- elif test "$db_dir"; then
+ if test "$db_dir"; then
CPPFLAGS="$CPPFLAGS -I$db_dir/include"
- elif test -d /usr/include/db4; then
- CPPFLAGS="$CPPFLAGS -I/usr/include/db4"
- dblib="db4"
fi
- AC_CHECK_DB([db db-4.1 db-4 db4],
+ AC_CHECK_DB([db],
[
DATABASE=database.c
],
dnl TODO: for the DB header checks, we should check whether the headers
dnl define db_env_create, somehow
dnl
-AC_CHECK_HEADERS(dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/stat.h sys/time.h sys/prctl.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h db4/db.h pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h syscall.h sys/syscall.h)
+AC_CHECK_HEADERS(dl.h fcntl.h limits.h malloc.h termios.h sys/ioctl.h sys/select.h sys/stat.h sys/time.h sys/prctl.h syslog.h unistd.h utmp.h utmpx.h paths.h db.h pthread.h netinet/in.h arpa/nameser.h arpa/nameser_compat.h syscall.h sys/syscall.h)
AC_CHECK_HEADER(resolv.h,AC_DEFINE(HAVE_RESOLV_H, [], [define this if you have the resolv.h header file.]),,
[#ifdef HAVE_SYS_TYPES_H
CON_SYS /* This is a system context and mustn't be purged */
} CCState;
-//#ifndef __ASYNCIO__
-//#define __ASYNCIO__
-//typedef struct AsyncIO AsyncIO; /* forward declaration for event_client.h */
-//#endif
-
-
#ifndef __CIT_CONTEXT__
#define __CIT_CONTEXT__
typedef struct CitContext CitContext;
#endif
/*
- * Here's the big one... the Citadel context structure.
- *
* This structure keeps track of all information relating to a running
* session on the server. We keep one of these for each session.
- *
*/
struct CitContext {
CitContext *prev; /* Link to previous session in list */
CCState state; /* thread state (see CON_ values below) */
int kill_me; /* Set to nonzero to flag for termination */
- IOBuffer SendBuf, /* Our write Buffer */
- RecvBuf, /* Our block buffered read buffer */
- SBuf; /* Our block buffered read buffer for clients */
+ IOBuffer SendBuf, /* Our write Buffer */
+ RecvBuf, /* Our block buffered read buffer */
+ SBuf; /* Our block buffered read buffer for clients */
- StrBuf *MigrateBuf; /* Our block buffered read buffer */
- StrBuf *sMigrateBuf; /* Our block buffered read buffer */
+ StrBuf *MigrateBuf; /* Our block buffered read buffer */
+ StrBuf *sMigrateBuf; /* Our block buffered read buffer */
int client_socket;
int is_local_socket; /* set to 1 if client is on unix domain sock */
#endif
char curr_user[USERNAME_SIZE]; /* name of current user */
- int logged_in; /* logged in */
- int internal_pgm; /* authenticated as internal program */
+ int logged_in; /* logged in? */
+ int internal_pgm; /* authenticated as internal program? */
int nologin; /* not allowed to log in */
int curr_view; /* The view type for the current user/room */
int cached_num_msgs;
char vcard_updated_by_ldap; /* !0 iff ldap changed the vcard, treat as aide update */
-
- //AsyncIO *IO; /* if this session has AsyncIO going on... */
};
#define CC MyContext()
* Bind a thread to a context. (It's inline merely to speed things up.)
*/
static INLINE void become_session(CitContext *which_con) {
-/*
- pid_t tid = syscall(SYS_gettid);
-*/
pthread_setspecific(MyConKey, (void *)which_con );
-/*
- syslog(LOG_DEBUG, "[%d]: Now doing %s\n",
- (int) tid,
- ((which_con != NULL) && (which_con->ServiceName != NULL)) ?
- which_con->ServiceName:"");
-*/
}
-
-
-
#endif /* CONTEXT_H */
/*
* This is a data store backend for the Citadel server which uses Berkeley DB.
*
- * Copyright (c) 1987-2018 by the citadel.org team
+ * Copyright (c) 1987-2019 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.
#ifdef HAVE_DB_H
#include <db.h>
-#elif defined(HAVE_DB4_DB_H)
-#include <db5/db.h>
-#else
-#error Neither <db.h> nor <db5/db.h> was found by configure. Install db5-devel.
+#error <db.h> was not found by configure. Install the Berkeley DB development package.
#endif
#if DB_VERSION_MAJOR < 5
etc/citadel/mail.aliases
-etc/citadel/public_clients
usr/share/citadel-server/help
etc/citadel/messages
usr/lib/citadel-server/ctdlmigrate
Package: citadel-server
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, adduser, citadel-common, openssl, locales, patch
-Recommends: db4.4-util | db4.3-util, shared-mime-info
+Recommends: db5-util, shared-mime-info
Suggests: postfix | exim4 | citadel-mta | mail-transport-agent, localepurge
Conflicts: pop3-server, imap-server
Provides: pop3-server, imap-server
extern char file_arcq[PATH_MAX];
extern char file_citadel_socket[PATH_MAX];
extern char file_citadel_admin_socket[PATH_MAX];
-extern char file_mail_aliases[PATH_MAX];
extern char file_pid_file[PATH_MAX];
extern char file_pid_paniclog[PATH_MAX];
extern char file_crpt_file_key[PATH_MAX];
*/
int alias(char *name)
{ /* process alias and routing info for mail */
- FILE *fp;
int a;
- char aaa[SIZ], bbb[SIZ];
+ char aaa[SIZ];
int at = 0;
char node[64];
remove_any_whitespace_to_the_left_or_right_of_at_symbol(name);
stripallbut(name, '<', '>');
- fp = fopen(file_mail_aliases, "r"); // when are we going to get rid of this?
- if (fp == NULL) {
- fp = fopen("/dev/null", "r");
- }
- if (fp == NULL) {
- return (MES_ERROR);
- }
- strcpy(aaa, "");
- strcpy(bbb, "");
- while (fgets(aaa, sizeof aaa, fp) != NULL) {
- while (isspace(name[0]))
- strcpy(name, &name[1]);
- aaa[strlen(aaa) - 1] = 0;
- strcpy(bbb, "");
- for (a = 0; aaa[a] != '\0'; ++a) {
- if (aaa[a] == ',') {
- strcpy(bbb, &aaa[a + 1]);
- aaa[a] = 0;
- break;
- }
- }
- if (!strcasecmp(name, aaa))
- strcpy(name, bbb);
- }
- fclose(fp);
-
/* Hit the email address directory */
if (CtdlDirectoryLookup(aaa, name, sizeof aaa) == 0) {
strcpy(name, aaa);
/*
* Server functions which perform operations on user objects.
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2019 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.
*/
void cmd_iden(char *argbuf)
{
- CitContext *CCC = MyContext();
int dev_code;
int cli_code;
int rev_level;
from_host[sizeof from_host - 1] = 0;
if (num_parms(argbuf)>=5) extract_token(from_host, argbuf, 4, '|', sizeof from_host);
- CCC->cs_clientdev = dev_code;
- CCC->cs_clienttyp = cli_code;
- CCC->cs_clientver = rev_level;
- safestrncpy(CCC->cs_clientname, desc, sizeof CCC->cs_clientname);
- CCC->cs_clientname[31] = 0;
-
- /* For local sockets and public clients, trust the hostname supplied by the client */
- if ( (CCC->is_local_socket) || (CtdlIsPublicClient()) ) {
- safestrncpy(CCC->cs_host, from_host, sizeof CCC->cs_host);
- CCC->cs_host[sizeof CCC->cs_host - 1] = 0;
- CCC->cs_addr[0] = 0;
+ CC->cs_clientdev = dev_code;
+ CC->cs_clienttyp = cli_code;
+ CC->cs_clientver = rev_level;
+ safestrncpy(CC->cs_clientname, desc, sizeof CC->cs_clientname);
+ CC->cs_clientname[31] = 0;
+
+ /* For local sockets, allow the client to supply the user's origin address */
+ if (CC->is_local_socket) {
+ safestrncpy(CC->cs_host, from_host, sizeof CC->cs_host);
+ CC->cs_host[sizeof CC->cs_host - 1] = 0;
+ CC->cs_addr[0] = 0;
}
syslog(LOG_NOTICE, "session: client %d/%d/%01d.%02d (%s) from %s",
(rev_level / 100),
(rev_level % 100),
desc,
- CCC->cs_host
+ CC->cs_host
);
cprintf("%d Ok\n",CIT_OK);
}
+++ /dev/null
-# public_clients
-#
-# This file contains a list of hosts at which well-known public
-# copies of client software exist. If the originating host
-# for a client is one of these, then the server will use the
-# location of the user that it is told by the client.
-
-localhost
-127.0.0.1
S_HOUSEKEEPING,
S_DIRECTORY,
S_NETCONFIGS,
- S_PUBLIC_CLIENTS,
S_FLOORCACHE,
S_ATBF,
S_JOURNAL_QUEUE,
#ifdef HAVE_DB_H
#include <db.h>
-#elif defined(HAVE_DB4_DB_H)
-#include <db4/db.h>
-#else
-#error Neither <db.h> nor <db4/db.h> was found by configure. Install db4-devel.
+#error <db.h> was not found by configure. Install the Berkeley DB development package.
#endif
-
-#if DB_VERSION_MAJOR < 4 || DB_VERSION_MINOR < 1
-#error Citadel requires Berkeley DB v4.1 or newer. Please upgrade.
+#if DB_VERSION_MAJOR < 5
+#error Citadel requires Berkeley DB v5 or newer. Please upgrade.
#endif
#include "server.h"
#ifdef HAVE_DB_H
#include <db.h>
-#elif defined(HAVE_DB4_DB_H)
-#include <db4/db.h>
-#else
-#error Neither <db.h> nor <db4/db.h> was found by configure. Install db4-devel.
+#error <db.h> was not found by configure. Install the Berkeley DB development package.
#endif
#include "server.h"