AUTOCONF=@AUTOCONF@
chkpwd_LIBS=@chkpwd_LIBS@
CC=@CC@
-CFLAGS=@CFLAGS@ -I ./include/
-CPPFLAGS=@CPPFLAGS@ -I. -I ./include/
+CFLAGS=@CFLAGS@ -I.
+CPPFLAGS=@CPPFLAGS@ -I.
DATABASE=@DATABASE@
DEFS=@DEFS@ -DDIFF=\"@DIFF@\" -DPATCH=\"@PATCH@\"
LDFLAGS=@LDFLAGS@
--- /dev/null
+#ifndef __CITADEL_DIRS_H
+#define __CITADEL_DIRS_H
+
+#include <limits.h>
+
+/* all our directories */
+extern char *ctdl_home_directory;
+extern char *ctdl_db_dir;
+extern char *ctdl_file_dir;
+extern char *ctdl_shared_dir;
+extern char *ctdl_image_dir;
+extern char *ctdl_info_dir;
+extern char *ctdl_key_dir;
+extern char *ctdl_message_dir;
+extern char *ctdl_usrpic_dir;
+extern char *ctdl_autoetc_dir;
+extern char *ctdl_run_dir;
+extern char *ctdl_netdigest_dir;
+extern char *ctdl_netcfg_dir;
+extern char *ctdl_bbsbase_dir;
+extern char *ctdl_sbin_dir;
+extern char *ctdl_bin_dir;
+extern char *ctdl_utilbin_dir;
+
+/* some of the frequently used files */
+extern char *file_citadel_config;
+extern char *file_lmtp_socket;
+extern char *file_lmtp_unfiltered_socket;
+extern char *file_arcq;
+extern char *file_citadel_socket;
+extern char *file_citadel_admin_socket;
+extern char *file_pid_file;
+extern char *file_pid_paniclog;
+extern char *file_crpt_file_key;
+extern char *file_crpt_file_csr;
+extern char *file_crpt_file_cer;
+extern char *file_chkpwd;
+extern char *file_guesstimezone;
+
+/* externs */
+extern int create_run_directories(long UID, long GUID);
+extern size_t assoc_file_name(char *buf, size_t n, struct ctdlroom *qrbuf, const char *prefix);
+extern FILE *create_digest_file(struct ctdlroom *room, int forceCreate);
+extern void remove_digest_file(struct ctdlroom *room);
+
+#endif /* __CITADEL_DIRS_H */
}
if (create_run_directories(CTDLUID, gid) != 0) {
- syslog(LOG_EMERG, "citserver: failed to access and create directories");
+ syslog(LOG_ERR, "citserver: failed to access and create directories");
exit(1);
}
syslog(LOG_INFO, "Opening databases");
--- /dev/null
+
+#ifndef CTDL_MODULE_H
+#define CTDL_MODULE_H
+
+#include "sysdep.h"
+
+#ifdef HAVE_GC
+#define GC_THREADS
+#define GC_REDIRECT_TO_LOCAL
+#include <gc/gc_local_alloc.h>
+#else
+#define GC_MALLOC malloc
+#define GC_MALLOC_ATOMIC malloc
+#define GC_FREE free
+#define GC_REALLOC realloc
+#endif
+
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <ctype.h>
+#include <signal.h>
+#include <pwd.h>
+#include <errno.h>
+#include <syslog.h>
+#include <sys/types.h>
+#include <time.h>
+#include <sys/wait.h>
+#include <string.h>
+#ifdef HAVE_STRINGS_H
+#include <strings.h>
+#endif
+#include <limits.h>
+
+#include <libcitadel.h>
+
+#include "server.h"
+#include "sysdep_decls.h"
+#include "msgbase.h"
+#include "threads.h"
+#include "citadel_dirs.h"
+#include "context.h"
+
+/*
+ * define macros for module init stuff
+ */
+
+#define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (int threading)
+
+#define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init (threading)
+
+#define CTDL_MODULE_UPGRADE(module_name) char *ctdl_module_##module_name##_upgrade (void)
+
+#define CTDL_UPGRADE_CALL(module_name) ctdl_module_##module_name##_upgrade ()
+
+#define CtdlAideMessage(TEXT, SUBJECT) \
+ quickie_message( \
+ "Citadel", \
+ NULL, \
+ NULL, \
+ AIDEROOM, \
+ TEXT, \
+ FMT_CITADEL, \
+ SUBJECT)
+
+/*
+ * Hook functions available to modules.
+ */
+/* Priorities for */
+#define PRIO_QUEUE 500
+#define PRIO_AGGR 1000
+#define PRIO_SEND 1500
+#define PRIO_CLEANUP 2000
+/* Priorities for EVT_HOUSE */
+#define PRIO_HOUSE 3000
+/* Priorities for EVT_LOGIN */
+#define PRIO_CREATE 10000
+/* Priorities for EVT_LOGOUT */
+#define PRIO_LOGOUT 15000
+/* Priorities for EVT_LOGIN */
+#define PRIO_LOGIN 20000
+/* Priorities for EVT_START */
+#define PRIO_START 25000
+/* Priorities for EVT_STOP */
+#define PRIO_STOP 30000
+/* Priorities for EVT_ASYNC */
+#define PRIO_ASYNC 35000
+/* Priorities for EVT_SHUTDOWN */
+#define PRIO_SHUTDOWN 40000
+/* Priorities for EVT_UNSTEALTH */
+#define PRIO_UNSTEALTH 45000
+/* Priorities for EVT_STEALTH */
+#define PRIO_STEALTH 50000
+
+
+void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType, int Priority);
+void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
+void CtdlShutdownServiceHooks(void);
+
+void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
+void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
+
+void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
+void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
+
+void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes*),
+ int EventType);
+void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *),
+ int EventType);
+
+void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
+void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
+
+void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
+void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
+
+void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
+void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
+
+void CtdlRegisterEVCleanupHook(void (*fcn_ptr)(void));
+void CtdlUnregisterEVCleanupHook(void (*fcn_ptr)(void));
+
+void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
+
+void CtdlRegisterServiceHook(int tcp_port,
+ char *sockpath,
+ void (*h_greeting_function) (void),
+ void (*h_command_function) (void),
+ void (*h_async_function) (void),
+ const char *ServiceName
+);
+void CtdlUnregisterServiceHook(int tcp_port,
+ char *sockpath,
+ void (*h_greeting_function) (void),
+ void (*h_command_function) (void),
+ void (*h_async_function) (void)
+);
+
+void CtdlRegisterFixedOutputHook(char *content_type,
+ void (*output_function) (char *supplied_data, int len)
+);
+void CtdlUnRegisterFixedOutputHook(char *content_type);
+
+void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg));
+
+void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name);
+
+/*
+ * if you say a) (which may take a while)
+ * don't forget to say b)
+ */
+void CtdlDisableHouseKeeping(void);
+void CtdlEnableHouseKeeping(void);
+
+/*
+ * Directory services hooks for LDAP etc
+ */
+
+#define DIRECTORY_USER_DEL 1 // Delete a user entry
+#define DIRECTORY_CREATE_HOST 2 // Create a host entry if not already there.
+#define DIRECTORY_CREATE_OBJECT 3 // Create a new object for directory entry
+#define DIRECTORY_ATTRIB_ADD 4 // Add an attribute to the directory entry object
+#define DIRECTORY_SAVE_OBJECT 5 // Save the object to the directory service
+#define DIRECTORY_FREE_OBJECT 6 // Free the object and its attributes
+
+int CtdlRegisterDirectoryServiceFunc(int (*func)(char *cn, char *ou, void **object), int cmd, char *module);
+int CtdlDoDirectoryServiceFunc(char *cn, char *ou, void **object, char *module, int cmd);
+
+/* TODODRW: This needs to be changed into a hook type interface
+ * for now we have this horrible hack
+ */
+void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response);
+
+/* return the current context list as an array and do it in a safe manner
+ * The returned data is a copy so only reading is useful
+ * The number of contexts is returned in count.
+ * Beware, this does not copy any of the data pointed to by the context.
+ * This means that you can not rely on things like the redirect buffer being valid.
+ * You must free the returned pointer when done.
+ */
+struct CitContext *CtdlGetContextArray (int *count);
+void CtdlFillSystemContext(struct CitContext *context, char *name);
+int CtdlTrySingleUser(void);
+void CtdlEndSingleUser(void);
+int CtdlWantSingleUser(void);
+int CtdlIsSingleUser(void);
+
+
+int CtdlIsUserLoggedIn (char *user_name);
+int CtdlIsUserLoggedInByNum (long usernum);
+void CtdlBumpNewMailCounter(long which_user);
+
+
+/*
+ * CtdlGetCurrentMessageNumber() - Obtain the current highest message number in the system
+ * This provides a quick way to initialise a variable that might be used to indicate
+ * messages that should not be processed. For example, a new inbox script will use this
+ * to record determine that messages older than this should not be processed.
+ * This function is defined in control.c
+ */
+long CtdlGetCurrentMessageNumber(void);
+
+
+
+/*
+ * Expose various room operation functions from room_ops.c to the modules API
+ */
+typedef struct CfgLineType CfgLineType;
+typedef struct RoomNetCfgLine RoomNetCfgLine;
+typedef struct OneRoomNetCfg OneRoomNetCfg;
+
+unsigned CtdlCreateRoom(char *new_room_name,
+ int new_room_type,
+ char *new_room_pass,
+ int new_room_floor,
+ int really_create,
+ int avoid_access,
+ int new_room_view);
+int CtdlGetRoom(struct ctdlroom *qrbuf, const char *room_name);
+int CtdlGetRoomLock(struct ctdlroom *qrbuf, const char *room_name);
+int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr);
+void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, int *result, int *view);
+void CtdlPutRoomLock(struct ctdlroom *qrbuf);
+typedef void (*ForEachRoomCallBack)(struct ctdlroom *EachRoom, void *out_data);
+void CtdlForEachRoom(ForEachRoomCallBack CB, void *in_data);
+typedef void (*ForEachRoomNetCfgCallBack)(struct ctdlroom *EachRoom, void *out_data, OneRoomNetCfg *OneRNCFG);
+char *LoadRoomNetConfigFile(long roomnum);
+void CtdlForEachNetCfgRoom(ForEachRoomNetCfgCallBack CB, void *in_data);
+void SaveChangedConfigs(void);
+void CtdlDeleteRoom(struct ctdlroom *qrbuf);
+int CtdlRenameRoom(char *old_name, char *new_name, int new_floor);
+void CtdlUserGoto (char *where, int display_result, int transiently, int *msgs, int *new, long *oldest, long *newest);
+struct floor *CtdlGetCachedFloor(int floor_num);
+void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf);
+void CtdlGetFloor (struct floor *flbuf, int floor_num);
+void CtdlPutFloor (struct floor *flbuf, int floor_num);
+void CtdlPutFloorLock(struct floor *flbuf, int floor_num);
+int CtdlGetFloorByName(const char *floor_name);
+int CtdlGetFloorByNameLock(const char *floor_name);
+int CtdlGetAvailableFloor(void);
+int CtdlIsNonEditable(struct ctdlroom *qrbuf);
+void CtdlPutRoom(struct ctdlroom *);
+
+/*
+ * Possible return values for CtdlRenameRoom()
+ */
+enum {
+ crr_ok, /* success */
+ crr_room_not_found, /* room not found */
+ crr_already_exists, /* new name already exists */
+ crr_noneditable, /* cannot edit this room */
+ crr_invalid_floor, /* target floor does not exist */
+ crr_access_denied /* not allowed to edit this room */
+};
+
+
+
+/*
+ * API declarations from citserver.h
+ */
+int CtdlAccessCheck(int);
+/* 'required access level' values which may be passed to CtdlAccessCheck()
+ */
+enum {
+ ac_none,
+ ac_logged_in_or_guest,
+ ac_logged_in,
+ ac_room_aide,
+ ac_aide,
+ ac_internal,
+};
+
+
+
+/*
+ * API declarations from serv_extensions.h
+ */
+void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name);
+
+#define NODENAME CtdlGetConfigStr("c_nodename")
+#define FQDN CtdlGetConfigStr("c_fqdn")
+#define CTDLUID ctdluid
+#define CREATAIDE CtdlGetConfigInt("c_creataide")
+#define REGISCALL CtdlGetConfigInt("c_regiscall")
+#define TWITDETECT CtdlGetConfigInt("c_twitdetect")
+#define TWITROOM CtdlGetConfigStr("c_twitroom")
+#define RESTRICT_INTERNET CtdlGetConfigInt("c_restrict")
+
+typedef void (*CfgLineParser)(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *rncfg);
+typedef void (*CfgLineSerializer)(const CfgLineType *ThisOne, StrBuf *OuptputBuffer, OneRoomNetCfg *rncfg, RoomNetCfgLine *data);
+typedef void (*CfgLineDeAllocator)(const CfgLineType *ThisOne, RoomNetCfgLine **data);
+
+struct CfgLineType {
+ RoomNetCfg C;
+ CfgLineParser Parser;
+ CfgLineSerializer Serializer;
+ CfgLineDeAllocator DeAllocator;
+ ConstStr Str;
+ int IsSingleLine;
+ int nSegments;
+};
+
+struct RoomNetCfgLine {
+ RoomNetCfgLine *next;
+ int nValues;
+ StrBuf **Value;
+};
+
+struct OneRoomNetCfg {
+ long lastsent;
+ // long changed;
+ StrBuf *Sender;
+ StrBuf *RoomInfo;
+ RoomNetCfgLine *NetConfigs[maxRoomNetCfg];
+ StrBuf *misc;
+};
+
+
+#define CtdlREGISTERRoomCfgType(a, p, uniq, nSegs, s, d) RegisterRoomCfgType(#a, sizeof(#a) - 1, a, p, uniq, nSegs, s, d);
+void RegisterRoomCfgType(const char* Name, long len, RoomNetCfg eCfg, CfgLineParser p, int uniq, int nSegments, CfgLineSerializer s, CfgLineDeAllocator d);
+void ParseGeneric(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *sc);
+void SerializeGeneric(const CfgLineType *ThisOne, StrBuf *OutputBuffer, OneRoomNetCfg *sc, RoomNetCfgLine *data);
+void DeleteGenericCfgLine(const CfgLineType *ThisOne, RoomNetCfgLine **data);
+RoomNetCfgLine *DuplicateOneGenericCfgLine(const RoomNetCfgLine *data);
+void AddRoomCfgLine(OneRoomNetCfg *OneRNCfg, struct ctdlroom *qrbuf, RoomNetCfg LineType, RoomNetCfgLine *Line);
+
+OneRoomNetCfg *CtdlGetNetCfgForRoom(long QRNumber);
+void SaveRoomNetConfigFile(OneRoomNetCfg *, long);
+void FreeRoomNetworkStruct(OneRoomNetCfg **);
+
+typedef struct _nodeconf {
+ int DeleteMe;
+ StrBuf *NodeName;
+ StrBuf *Secret;
+ StrBuf *Host;
+ StrBuf *Port;
+}CtdlNodeConf;
+
+HashList* CtdlLoadIgNetCfg(void);
+
+
+int CtdlNetconfigCheckRoomaccess(char *errmsgbuf,
+ size_t n,
+ const char* RemoteIdentifier);
+
+
+typedef struct __NetMap {
+ StrBuf *NodeName;
+ time_t lastcontact;
+ StrBuf *NextHop;
+}CtdlNetMap;
+
+HashList* CtdlReadNetworkMap(void);
+StrBuf *CtdlSerializeNetworkMap(HashList *Map);
+
+
+
+
+/*
+ * Expose API calls from user_ops.c
+ */
+int CtdlGetUser(struct ctdluser *usbuf, char *name);
+int CtdlGetUserLen(struct ctdluser *usbuf, const char *name, long len);
+int CtdlGetUserLock(struct ctdluser *usbuf, char *name);
+void CtdlPutUser(struct ctdluser *usbuf);
+void CtdlPutUserLock(struct ctdluser *usbuf);
+int CtdlLockGetCurrentUser(void);
+void CtdlPutCurrentUserLock(void);
+int CtdlGetUserByNumber(struct ctdluser *usbuf, long number);
+void CtdlGetRelationship(visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room);
+void CtdlSetRelationship(visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room);
+void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix);
+int CtdlLoginExistingUser(const char *username);
+
+/*
+ * Values which may be returned by CtdlLoginExistingUser()
+ */
+enum {
+ pass_ok,
+ pass_already_logged_in,
+ pass_no_user,
+ pass_internal_error,
+ pass_wrong_password
+};
+
+int CtdlTryPassword(const char *password, long len);
+/*
+ * Values which may be returned by CtdlTryPassword()
+ */
+enum {
+ login_ok,
+ login_already_logged_in,
+ login_too_many_users,
+ login_not_found
+};
+
+void CtdlUserLogout(void);
+
+/*
+ * Expose API calls from msgbase.c
+ */
+
+
+/*
+ * Expose API calls from euidindex.c
+ */
+long CtdlLocateMessageByEuid(char *euid, struct ctdlroom *qrbuf);
+
+
+/*
+ * Expose API calls from modules/openid/serv_openid_rp.c in order to turn it into a generic external authentication driver
+ */
+int attach_extauth(struct ctdluser *who, StrBuf *claimed_id);
+
+#endif /* CTDL_MODULE_H */
/*
* Silently try to create the database subdirectory. If it's already there, no problem.
*/
- if ((mkdir(ctdl_data_dir, 0700) != 0) && (errno != EEXIST)) {
- syslog(LOG_ERR, "db: unable to create database directory [%s]: %m", ctdl_data_dir);
+ if ((mkdir(ctdl_db_dir, 0700) != 0) && (errno != EEXIST)) {
+ syslog(LOG_ERR, "db: unable to create database directory [%s]: %m", ctdl_db_dir);
}
- if (chmod(ctdl_data_dir, 0700) != 0) {
- syslog(LOG_ERR, "db: unable to set database directory permissions [%s]: %m", ctdl_data_dir);
+ if (chmod(ctdl_db_dir, 0700) != 0) {
+ syslog(LOG_ERR, "db: unable to set database directory permissions [%s]: %m", ctdl_db_dir);
}
- if (chown(ctdl_data_dir, CTDLUID, (-1)) != 0) {
- syslog(LOG_ERR, "db: unable to set the owner for [%s]: %m", ctdl_data_dir);
+ if (chown(ctdl_db_dir, CTDLUID, (-1)) != 0) {
+ syslog(LOG_ERR, "db: unable to set the owner for [%s]: %m", ctdl_db_dir);
}
syslog(LOG_DEBUG, "db: Setting up DB environment");
// db_env_set_func_yield((int (*)(u_long, u_long))sched_yield);
}
flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_INIT_TXN | DB_INIT_LOCK | DB_THREAD | DB_INIT_LOG;
- syslog(LOG_DEBUG, "db: dbenv->open(dbenv, %s, %d, 0)", ctdl_data_dir, flags);
- ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0); // try opening the database cleanly
+ syslog(LOG_DEBUG, "db: dbenv->open(dbenv, %s, %d, 0)", ctdl_db_dir, flags);
+ ret = dbenv->open(dbenv, ctdl_db_dir, flags, 0); // try opening the database cleanly
if (ret == DB_RUNRECOVERY) {
syslog(LOG_ERR, "db: dbenv->open: %s", db_strerror(ret));
syslog(LOG_ERR, "db: attempting recovery...");
flags |= DB_RECOVER;
- ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0); // try recovery
+ ret = dbenv->open(dbenv, ctdl_db_dir, flags, 0); // try recovery
}
if (ret == DB_RUNRECOVERY) {
syslog(LOG_ERR, "db: dbenv->open: %s", db_strerror(ret));
syslog(LOG_ERR, "db: attempting catastrophic recovery...");
flags &= ~DB_RECOVER;
flags |= DB_RECOVER_FATAL;
- ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0); // try catastrophic recovery
+ ret = dbenv->open(dbenv, ctdl_db_dir, flags, 0); // try catastrophic recovery
}
if (ret) {
syslog(LOG_ERR, "db: dbenv->open: %s", db_strerror(ret));
struct dirent *d;
char filename[PATH_MAX];
- dp = opendir(ctdl_data_dir);
+ dp = opendir(ctdl_db_dir);
if (dp != NULL) {
while (d = readdir(dp), d != NULL) {
if (d->d_name[0] != '.') {
- snprintf(filename, sizeof filename, "%s/%s", ctdl_data_dir, d->d_name);
+ snprintf(filename, sizeof filename, "%s/%s", ctdl_db_dir, d->d_name);
syslog(LOG_DEBUG, "db: chmod(%s, 0600) returned %d", filename, chmod(filename, 0600));
syslog(LOG_DEBUG, "db: chown(%s, CTDLUID, -1) returned %d",
filename, chown(filename, CTDLUID, (-1))
/* Close the handle. */
ret = dbenv->close(dbenv, 0);
if (ret) {
- syslog(LOG_EMERG, "db: DBENV->close: %s", db_strerror(ret));
+ syslog(LOG_ERR, "db: DBENV->close: %s", db_strerror(ret));
}
}
if (uncompress((Bytef *) uncompressed_data,
(uLongf *) & destLen, (const Bytef *) compressed_data, (uLong) sourceLen) != Z_OK) {
- syslog(LOG_EMERG, "db: uncompress() error");
+ syslog(LOG_ERR, "db: uncompress() error");
cdb_abort();
}
compressed_data = malloc(buffer_len);
if (compress2((Bytef *) (compressed_data + sizeof(struct CtdlCompressHeader)),
&destLen, (Bytef *) cdata, (uLongf) cdatalen, 1) != Z_OK) {
- syslog(LOG_EMERG, "db: compress2() error");
+ syslog(LOG_ERR, "db: compress2() error");
cdb_abort();
}
zheader.compressed_len = (size_t) destLen;
0 // flags
);
if (ret) {
- syslog(LOG_EMERG, "db: cdb_store(%d): %s", cdb, db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_store(%d): %s", cdb, db_strerror(ret));
cdb_abort();
}
if (compressing) {
txabort(tid);
goto retry;
} else {
- syslog(LOG_EMERG, "db: cdb_store(%d): %s", cdb, db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_store(%d): %s", cdb, db_strerror(ret));
cdb_abort();
}
} else {
if (TSD->tid != NULL) {
ret = dbp[cdb]->del(dbp[cdb], TSD->tid, &dkey, 0);
if (ret) {
- syslog(LOG_EMERG, "db: cdb_delete(%d): %s", cdb, db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_delete(%d): %s", cdb, db_strerror(ret));
if (ret != DB_NOTFOUND) {
cdb_abort();
}
txabort(tid);
goto retry;
} else {
- syslog(LOG_EMERG, "db: cdb_delete(%d): %s", cdb, db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_delete(%d): %s", cdb, db_strerror(ret));
cdb_abort();
}
} else {
}
if (ret) {
- syslog(LOG_EMERG, "db: localcursor: %s", db_strerror(ret));
+ syslog(LOG_ERR, "db: localcursor: %s", db_strerror(ret));
cdb_abort();
}
}
if ((ret != 0) && (ret != DB_NOTFOUND)) {
- syslog(LOG_EMERG, "db: cdb_fetch(%d): %s", cdb, db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_fetch(%d): %s", cdb, db_strerror(ret));
cdb_abort();
}
tempcdb = (struct cdbdata *) malloc(sizeof(struct cdbdata));
if (tempcdb == NULL) {
- syslog(LOG_EMERG, "db: cdb_fetch: Cannot allocate memory for tempcdb");
+ syslog(LOG_ERR, "db: cdb_fetch: Cannot allocate memory for tempcdb");
cdb_abort();
return NULL; /* make it easier for static analysis... */
} else {
int ret = 0;
if (TSD->cursors[cdb] != NULL) {
- syslog(LOG_EMERG, "db: cdb_rewind: must close cursor on database %d before reopening", cdb);
+ syslog(LOG_ERR, "db: cdb_rewind: must close cursor on database %d before reopening", cdb);
cdb_abort();
/* cclose(TSD->cursors[cdb]); */
}
*/
ret = dbp[cdb]->cursor(dbp[cdb], TSD->tid, &TSD->cursors[cdb], 0);
if (ret) {
- syslog(LOG_EMERG, "db: cdb_rewind: db_cursor: %s", db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_rewind: db_cursor: %s", db_strerror(ret));
cdb_abort();
}
}
if (ret) {
if (ret != DB_NOTFOUND) {
- syslog(LOG_EMERG, "db: cdb_next_item(%d): %s", cdb, db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_next_item(%d): %s", cdb, db_strerror(ret));
cdb_abort();
}
cdb_close_cursor(cdb);
bailIfCursor(TSD->cursors, "can't begin transaction during r/o cursor");
if (TSD->tid != NULL) {
- syslog(LOG_EMERG, "db: cdb_begin_transaction: ERROR: nested transaction");
+ syslog(LOG_ERR, "db: cdb_begin_transaction: ERROR: nested transaction");
cdb_abort();
}
u_int32_t count;
if (TSD->tid != NULL) {
- syslog(LOG_EMERG, "db: cdb_trunc must not be called in a transaction.");
+ syslog(LOG_ERR, "db: cdb_trunc must not be called in a transaction.");
cdb_abort();
} else {
bailIfCursor(TSD->cursors, "attempt to write during r/o cursor");
/* txabort(tid); */
goto retry;
} else {
- syslog(LOG_EMERG, "db: cdb_truncate(%d): %s", cdb, db_strerror(ret));
+ syslog(LOG_ERR, "db: cdb_truncate(%d): %s", cdb, db_strerror(ret));
if (ret == ENOMEM) {
- syslog(LOG_EMERG, "db: You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
+ syslog(LOG_ERR, "db: You may need to tune your database; please read http://www.citadel.org/doku.php?id=faq:troubleshooting:out_of_lock_entries for more information.");
}
exit(CTDLEXIT_DB);
}
+++ /dev/null
-#ifndef __CITADEL_DIRS_H
-#define __CITADEL_DIRS_H
-
-#include <limits.h>
-
-
-extern char ctdl_home_directory[PATH_MAX];
-
-
-/* all our directories */
-extern char ctdl_data_dir[PATH_MAX];
-extern char ctdl_file_dir[PATH_MAX];
-extern char ctdl_shared_dir[PATH_MAX];
-extern char ctdl_image_dir[PATH_MAX];
-extern char ctdl_info_dir[PATH_MAX];
-extern char ctdl_key_dir[PATH_MAX];
-extern char ctdl_message_dir[PATH_MAX];
-extern char ctdl_usrpic_dir[PATH_MAX];
-extern char ctdl_autoetc_dir[PATH_MAX];
-extern char ctdl_run_dir[PATH_MAX];
-extern char ctdl_spool_dir[PATH_MAX];
-extern char ctdl_netdigest_dir[PATH_MAX];
-extern char ctdl_nettmp_dir[PATH_MAX];
-extern char ctdl_netcfg_dir[PATH_MAX];
-extern char ctdl_bbsbase_dir[PATH_MAX];
-extern char ctdl_sbin_dir[PATH_MAX];
-extern char ctdl_bin_dir[PATH_MAX];
-extern char ctdl_utilbin_dir[PATH_MAX];
-
-
-
-/* some of the frequently used files */
-extern char file_citadel_config[PATH_MAX];
-extern char file_lmtp_socket[PATH_MAX];
-extern char file_lmtp_unfiltered_socket[PATH_MAX];
-extern char file_arcq[PATH_MAX];
-extern char file_citadel_socket[PATH_MAX];
-extern char file_citadel_admin_socket[PATH_MAX];
-extern char file_pid_file[PATH_MAX];
-extern char file_pid_paniclog[PATH_MAX];
-extern char file_crpt_file_key[PATH_MAX];
-extern char file_crpt_file_csr[PATH_MAX];
-extern char file_crpt_file_cer[PATH_MAX];
-extern char file_chkpwd[PATH_MAX];
-extern char file_guesstimezone[PATH_MAX];
-
-extern void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, int dbg);
-
-
-extern int create_run_directories(long UID, long GUID);
-
-extern size_t assoc_file_name(char *buf,
- size_t n,
- struct ctdlroom *qrbuf,
- const char *prefix);
-
-extern FILE *create_digest_file(struct ctdlroom *room, int forceCreate);
-extern void remove_digest_file(struct ctdlroom *room);
-#endif /* __CITADEL_DIRS_H */
+++ /dev/null
-
-#ifndef CTDL_MODULE_H
-#define CTDL_MODULE_H
-
-#include "sysdep.h"
-
-#ifdef HAVE_GC
-#define GC_THREADS
-#define GC_REDIRECT_TO_LOCAL
-#include <gc/gc_local_alloc.h>
-#else
-#define GC_MALLOC malloc
-#define GC_MALLOC_ATOMIC malloc
-#define GC_FREE free
-#define GC_REALLOC realloc
-#endif
-
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <ctype.h>
-#include <signal.h>
-#include <pwd.h>
-#include <errno.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <time.h>
-#include <sys/wait.h>
-#include <string.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
-#include <limits.h>
-
-#include <libcitadel.h>
-
-#include "server.h"
-#include "sysdep_decls.h"
-#include "msgbase.h"
-#include "threads.h"
-#include "citadel_dirs.h"
-#include "context.h"
-
-/*
- * define macros for module init stuff
- */
-
-#define CTDL_MODULE_INIT(module_name) char *ctdl_module_##module_name##_init (int threading)
-
-#define CTDL_INIT_CALL(module_name) ctdl_module_##module_name##_init (threading)
-
-#define CTDL_MODULE_UPGRADE(module_name) char *ctdl_module_##module_name##_upgrade (void)
-
-#define CTDL_UPGRADE_CALL(module_name) ctdl_module_##module_name##_upgrade ()
-
-#define CtdlAideMessage(TEXT, SUBJECT) \
- quickie_message( \
- "Citadel", \
- NULL, \
- NULL, \
- AIDEROOM, \
- TEXT, \
- FMT_CITADEL, \
- SUBJECT)
-
-/*
- * Hook functions available to modules.
- */
-/* Priorities for */
-#define PRIO_QUEUE 500
-#define PRIO_AGGR 1000
-#define PRIO_SEND 1500
-#define PRIO_CLEANUP 2000
-/* Priorities for EVT_HOUSE */
-#define PRIO_HOUSE 3000
-/* Priorities for EVT_LOGIN */
-#define PRIO_CREATE 10000
-/* Priorities for EVT_LOGOUT */
-#define PRIO_LOGOUT 15000
-/* Priorities for EVT_LOGIN */
-#define PRIO_LOGIN 20000
-/* Priorities for EVT_START */
-#define PRIO_START 25000
-/* Priorities for EVT_STOP */
-#define PRIO_STOP 30000
-/* Priorities for EVT_ASYNC */
-#define PRIO_ASYNC 35000
-/* Priorities for EVT_SHUTDOWN */
-#define PRIO_SHUTDOWN 40000
-/* Priorities for EVT_UNSTEALTH */
-#define PRIO_UNSTEALTH 45000
-/* Priorities for EVT_STEALTH */
-#define PRIO_STEALTH 50000
-
-
-void CtdlRegisterSessionHook(void (*fcn_ptr)(void), int EventType, int Priority);
-void CtdlUnregisterSessionHook(void (*fcn_ptr)(void), int EventType);
-void CtdlShutdownServiceHooks(void);
-
-void CtdlRegisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
-void CtdlUnregisterUserHook(void (*fcn_ptr)(struct ctdluser *), int EventType);
-
-void CtdlRegisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
-void CtdlUnregisterXmsgHook(int (*fcn_ptr)(char *, char *, char *, char *), int order);
-
-void CtdlRegisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes*),
- int EventType);
-void CtdlUnregisterMessageHook(int (*handler)(struct CtdlMessage *, recptypes *),
- int EventType);
-
-void CtdlRegisterRoomHook(int (*fcn_ptr)(struct ctdlroom *) );
-void CtdlUnregisterRoomHook(int (*fnc_ptr)(struct ctdlroom *) );
-
-void CtdlRegisterDeleteHook(void (*handler)(char *, long) );
-void CtdlUnregisterDeleteHook(void (*handler)(char *, long) );
-
-void CtdlRegisterCleanupHook(void (*fcn_ptr)(void));
-void CtdlUnregisterCleanupHook(void (*fcn_ptr)(void));
-
-void CtdlRegisterEVCleanupHook(void (*fcn_ptr)(void));
-void CtdlUnregisterEVCleanupHook(void (*fcn_ptr)(void));
-
-void CtdlRegisterProtoHook(void (*handler)(char *), char *cmd, char *desc);
-
-void CtdlRegisterServiceHook(int tcp_port,
- char *sockpath,
- void (*h_greeting_function) (void),
- void (*h_command_function) (void),
- void (*h_async_function) (void),
- const char *ServiceName
-);
-void CtdlUnregisterServiceHook(int tcp_port,
- char *sockpath,
- void (*h_greeting_function) (void),
- void (*h_command_function) (void),
- void (*h_async_function) (void)
-);
-
-void CtdlRegisterFixedOutputHook(char *content_type,
- void (*output_function) (char *supplied_data, int len)
-);
-void CtdlUnRegisterFixedOutputHook(char *content_type);
-
-void CtdlRegisterMaintenanceThread(char *name, void *(*thread_proc) (void *arg));
-
-void CtdlRegisterSearchFuncHook(void (*fcn_ptr)(int *, long **, const char *), char *name);
-
-/*
- * if you say a) (which may take a while)
- * don't forget to say b)
- */
-void CtdlDisableHouseKeeping(void);
-void CtdlEnableHouseKeeping(void);
-
-/*
- * Directory services hooks for LDAP etc
- */
-
-#define DIRECTORY_USER_DEL 1 // Delete a user entry
-#define DIRECTORY_CREATE_HOST 2 // Create a host entry if not already there.
-#define DIRECTORY_CREATE_OBJECT 3 // Create a new object for directory entry
-#define DIRECTORY_ATTRIB_ADD 4 // Add an attribute to the directory entry object
-#define DIRECTORY_SAVE_OBJECT 5 // Save the object to the directory service
-#define DIRECTORY_FREE_OBJECT 6 // Free the object and its attributes
-
-int CtdlRegisterDirectoryServiceFunc(int (*func)(char *cn, char *ou, void **object), int cmd, char *module);
-int CtdlDoDirectoryServiceFunc(char *cn, char *ou, void **object, char *module, int cmd);
-
-/* TODODRW: This needs to be changed into a hook type interface
- * for now we have this horrible hack
- */
-void CtdlModuleStartCryptoMsgs(char *ok_response, char *nosup_response, char *error_response);
-
-/* return the current context list as an array and do it in a safe manner
- * The returned data is a copy so only reading is useful
- * The number of contexts is returned in count.
- * Beware, this does not copy any of the data pointed to by the context.
- * This means that you can not rely on things like the redirect buffer being valid.
- * You must free the returned pointer when done.
- */
-struct CitContext *CtdlGetContextArray (int *count);
-void CtdlFillSystemContext(struct CitContext *context, char *name);
-int CtdlTrySingleUser(void);
-void CtdlEndSingleUser(void);
-int CtdlWantSingleUser(void);
-int CtdlIsSingleUser(void);
-
-
-int CtdlIsUserLoggedIn (char *user_name);
-int CtdlIsUserLoggedInByNum (long usernum);
-void CtdlBumpNewMailCounter(long which_user);
-
-
-/*
- * CtdlGetCurrentMessageNumber() - Obtain the current highest message number in the system
- * This provides a quick way to initialise a variable that might be used to indicate
- * messages that should not be processed. For example, a new inbox script will use this
- * to record determine that messages older than this should not be processed.
- * This function is defined in control.c
- */
-long CtdlGetCurrentMessageNumber(void);
-
-
-
-/*
- * Expose various room operation functions from room_ops.c to the modules API
- */
-typedef struct CfgLineType CfgLineType;
-typedef struct RoomNetCfgLine RoomNetCfgLine;
-typedef struct OneRoomNetCfg OneRoomNetCfg;
-
-unsigned CtdlCreateRoom(char *new_room_name,
- int new_room_type,
- char *new_room_pass,
- int new_room_floor,
- int really_create,
- int avoid_access,
- int new_room_view);
-int CtdlGetRoom(struct ctdlroom *qrbuf, const char *room_name);
-int CtdlGetRoomLock(struct ctdlroom *qrbuf, const char *room_name);
-int CtdlDoIHavePermissionToDeleteThisRoom(struct ctdlroom *qr);
-void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, int *result, int *view);
-void CtdlPutRoomLock(struct ctdlroom *qrbuf);
-typedef void (*ForEachRoomCallBack)(struct ctdlroom *EachRoom, void *out_data);
-void CtdlForEachRoom(ForEachRoomCallBack CB, void *in_data);
-typedef void (*ForEachRoomNetCfgCallBack)(struct ctdlroom *EachRoom, void *out_data, OneRoomNetCfg *OneRNCFG);
-char *LoadRoomNetConfigFile(long roomnum);
-void CtdlForEachNetCfgRoom(ForEachRoomNetCfgCallBack CB, void *in_data);
-void SaveChangedConfigs(void);
-void CtdlDeleteRoom(struct ctdlroom *qrbuf);
-int CtdlRenameRoom(char *old_name, char *new_name, int new_floor);
-void CtdlUserGoto (char *where, int display_result, int transiently, int *msgs, int *new, long *oldest, long *newest);
-struct floor *CtdlGetCachedFloor(int floor_num);
-void CtdlScheduleRoomForDeletion(struct ctdlroom *qrbuf);
-void CtdlGetFloor (struct floor *flbuf, int floor_num);
-void CtdlPutFloor (struct floor *flbuf, int floor_num);
-void CtdlPutFloorLock(struct floor *flbuf, int floor_num);
-int CtdlGetFloorByName(const char *floor_name);
-int CtdlGetFloorByNameLock(const char *floor_name);
-int CtdlGetAvailableFloor(void);
-int CtdlIsNonEditable(struct ctdlroom *qrbuf);
-void CtdlPutRoom(struct ctdlroom *);
-
-/*
- * Possible return values for CtdlRenameRoom()
- */
-enum {
- crr_ok, /* success */
- crr_room_not_found, /* room not found */
- crr_already_exists, /* new name already exists */
- crr_noneditable, /* cannot edit this room */
- crr_invalid_floor, /* target floor does not exist */
- crr_access_denied /* not allowed to edit this room */
-};
-
-
-
-/*
- * API declarations from citserver.h
- */
-int CtdlAccessCheck(int);
-/* 'required access level' values which may be passed to CtdlAccessCheck()
- */
-enum {
- ac_none,
- ac_logged_in_or_guest,
- ac_logged_in,
- ac_room_aide,
- ac_aide,
- ac_internal,
-};
-
-
-
-/*
- * API declarations from serv_extensions.h
- */
-void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name);
-
-#define NODENAME CtdlGetConfigStr("c_nodename")
-#define FQDN CtdlGetConfigStr("c_fqdn")
-#define CTDLUID ctdluid
-#define CREATAIDE CtdlGetConfigInt("c_creataide")
-#define REGISCALL CtdlGetConfigInt("c_regiscall")
-#define TWITDETECT CtdlGetConfigInt("c_twitdetect")
-#define TWITROOM CtdlGetConfigStr("c_twitroom")
-#define RESTRICT_INTERNET CtdlGetConfigInt("c_restrict")
-
-typedef void (*CfgLineParser)(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *rncfg);
-typedef void (*CfgLineSerializer)(const CfgLineType *ThisOne, StrBuf *OuptputBuffer, OneRoomNetCfg *rncfg, RoomNetCfgLine *data);
-typedef void (*CfgLineDeAllocator)(const CfgLineType *ThisOne, RoomNetCfgLine **data);
-
-struct CfgLineType {
- RoomNetCfg C;
- CfgLineParser Parser;
- CfgLineSerializer Serializer;
- CfgLineDeAllocator DeAllocator;
- ConstStr Str;
- int IsSingleLine;
- int nSegments;
-};
-
-struct RoomNetCfgLine {
- RoomNetCfgLine *next;
- int nValues;
- StrBuf **Value;
-};
-
-struct OneRoomNetCfg {
- long lastsent;
- // long changed;
- StrBuf *Sender;
- StrBuf *RoomInfo;
- RoomNetCfgLine *NetConfigs[maxRoomNetCfg];
- StrBuf *misc;
-};
-
-
-#define CtdlREGISTERRoomCfgType(a, p, uniq, nSegs, s, d) RegisterRoomCfgType(#a, sizeof(#a) - 1, a, p, uniq, nSegs, s, d);
-void RegisterRoomCfgType(const char* Name, long len, RoomNetCfg eCfg, CfgLineParser p, int uniq, int nSegments, CfgLineSerializer s, CfgLineDeAllocator d);
-void ParseGeneric(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *sc);
-void SerializeGeneric(const CfgLineType *ThisOne, StrBuf *OutputBuffer, OneRoomNetCfg *sc, RoomNetCfgLine *data);
-void DeleteGenericCfgLine(const CfgLineType *ThisOne, RoomNetCfgLine **data);
-RoomNetCfgLine *DuplicateOneGenericCfgLine(const RoomNetCfgLine *data);
-void AddRoomCfgLine(OneRoomNetCfg *OneRNCfg, struct ctdlroom *qrbuf, RoomNetCfg LineType, RoomNetCfgLine *Line);
-
-OneRoomNetCfg *CtdlGetNetCfgForRoom(long QRNumber);
-void SaveRoomNetConfigFile(OneRoomNetCfg *, long);
-void FreeRoomNetworkStruct(OneRoomNetCfg **);
-
-typedef struct _nodeconf {
- int DeleteMe;
- StrBuf *NodeName;
- StrBuf *Secret;
- StrBuf *Host;
- StrBuf *Port;
-}CtdlNodeConf;
-
-HashList* CtdlLoadIgNetCfg(void);
-
-
-int CtdlNetconfigCheckRoomaccess(char *errmsgbuf,
- size_t n,
- const char* RemoteIdentifier);
-
-
-typedef struct __NetMap {
- StrBuf *NodeName;
- time_t lastcontact;
- StrBuf *NextHop;
-}CtdlNetMap;
-
-HashList* CtdlReadNetworkMap(void);
-StrBuf *CtdlSerializeNetworkMap(HashList *Map);
-
-
-
-
-/*
- * Expose API calls from user_ops.c
- */
-int CtdlGetUser(struct ctdluser *usbuf, char *name);
-int CtdlGetUserLen(struct ctdluser *usbuf, const char *name, long len);
-int CtdlGetUserLock(struct ctdluser *usbuf, char *name);
-void CtdlPutUser(struct ctdluser *usbuf);
-void CtdlPutUserLock(struct ctdluser *usbuf);
-int CtdlLockGetCurrentUser(void);
-void CtdlPutCurrentUserLock(void);
-int CtdlGetUserByNumber(struct ctdluser *usbuf, long number);
-void CtdlGetRelationship(visit *vbuf, struct ctdluser *rel_user, struct ctdlroom *rel_room);
-void CtdlSetRelationship(visit *newvisit, struct ctdluser *rel_user, struct ctdlroom *rel_room);
-void CtdlMailboxName(char *buf, size_t n, const struct ctdluser *who, const char *prefix);
-int CtdlLoginExistingUser(const char *username);
-
-/*
- * Values which may be returned by CtdlLoginExistingUser()
- */
-enum {
- pass_ok,
- pass_already_logged_in,
- pass_no_user,
- pass_internal_error,
- pass_wrong_password
-};
-
-int CtdlTryPassword(const char *password, long len);
-/*
- * Values which may be returned by CtdlTryPassword()
- */
-enum {
- login_ok,
- login_already_logged_in,
- login_too_many_users,
- login_not_found
-};
-
-void CtdlUserLogout(void);
-
-/*
- * Expose API calls from msgbase.c
- */
-
-
-/*
- * Expose API calls from euidindex.c
- */
-long CtdlLocateMessageByEuid(char *euid, struct ctdlroom *qrbuf);
-
-
-/*
- * Expose API calls from modules/openid/serv_openid_rp.c in order to turn it into a generic external authentication driver
- */
-int attach_extauth(struct ctdluser *who, StrBuf *claimed_id);
-
-#endif /* CTDL_MODULE_H */
* NOTE: if the noise word list is altered in any way, the FT_WORDBREAKER_ID
* must also be changed, so that the index is rebuilt.
*/
-
-noise_word *noise_words[26];
-
-static char *noise_words_init[] = {
+static char *noise_words[] = {
"about",
"after",
"also",
"would",
"your"
};
-
-
-void initialize_noise_words(void)
-{
- int i;
- int len;
- int ch;
- noise_word *next;
-
- memset (noise_words, 0, sizeof(noise_words));
-
- for (i=0; i<(sizeof(noise_words_init)/sizeof(char *)); ++i)
- {
- ch = noise_words_init[i][0] - 'a';
- len = strlen(noise_words_init[i]);
-
- next = malloc(sizeof(noise_word));
- next->len = len;
- next->word = strdup(noise_words_init[i]);
- next->next = noise_words[ch];
- noise_words[ch] = next;
- }
-}
+#define NUM_NOISE (sizeof(noise_words) / sizeof(char *))
/*
char word[256];
int i;
int word_crc;
- noise_word *noise;
-
if (text == NULL) { /* no NULL text please */
*num_tokens = 0;
word_start = NULL;
/* are we ok with the length? */
- if ( (word_len >= WB_MIN)
- && (word_len <= WB_MAX) ) {
+ if ( (word_len >= WB_MIN) && (word_len <= WB_MAX) ) {
for (i=0; i<word_len; ++i) {
word[i] = tolower(word[i]);
}
/* disqualify noise words */
- noise = noise_words[(int) (word[0]-'a')];
- while (noise)
- {
- if (noise->len == word_len)
- {
- if (!strcmp(word, noise->word))
- {
- word_len = 0;
- break;
- }
+ for (i=0; i<NUM_NOISE; ++i) {
+ if (!strcmp(word, noise_words[i])) {
+ word_len = 0;
+ break;
}
- noise = noise->next;
}
+
if (word_len == 0)
continue;
- word_crc = (int)
- CalcCRC16Bytes(word_len, word);
+ word_crc = (int) CalcCRC16Bytes(word_len, word);
++wb_num_tokens;
if (wb_num_tokens > wb_num_alloc) {
/*
- * Copyright (c) 2005-2012 by the citadel.org team
+ * Copyright (c) 2005-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 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.
- *
- *
- *
- *
+ * 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.
*/
-
/*
* This is an ID for the wordbreaker module. If we do pluggable wordbreakers
* later on, or even if we update this one, we can use a different ID so the
#define WB_MAX 40
void wordbreaker(const char *text, int *num_tokens, int **tokens);
-
-void initialize_noise_words(void);
-void noise_word_cleanup(void);
-
-
-typedef struct noise_word noise_word;
-
-struct noise_word {
- unsigned int len;
- char *word;
- noise_word *next;
-};
if (!threading)
{
initialize_ft_cache();
- initialize_noise_words();
CtdlRegisterProtoHook(cmd_srch, "SRCH", "Full text search");
CtdlRegisterDeleteHook(ft_delete_remove);
CtdlRegisterSearchFuncHook(ft_search, "fulltext");
/* If there are digest recipients, we have to build a digest */
if (sc->digestfp == NULL) {
- sc->digestfp = create_digest_file(&sc->room, 1);
+ sc->digestfp = tmpfile();
if (sc->digestfp == NULL)
return;
* This module handles shared rooms, inter-Citadel mail, and outbound
* mailing list processing.
*
- * Copyright (c) 2000-2020 by the citadel.org team
+ * Copyright (c) 2000-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.
network_deliver_digest(sc); /* deliver */
fclose(sc->digestfp);
sc->digestfp = NULL;
- remove_digest_file(&sc->room);
}
/* Now rewrite the netconfig */
}
-/*
- * It's ok if these directories already exist. Just fail silently.
- */
-void create_spool_dirs(void) {
- if ((mkdir(ctdl_spool_dir, 0700) != 0) && (errno != EEXIST))
- syslog(LOG_EMERG, "netspool: unable to create directory [%s]: %s", ctdl_spool_dir, strerror(errno));
- if (chown(ctdl_spool_dir, CTDLUID, (-1)) != 0)
- syslog(LOG_EMERG, "netspool: unable to set the access rights for [%s]: %s", ctdl_spool_dir, strerror(errno));
- if ((mkdir(ctdl_nettmp_dir, 0700) != 0) && (errno != EEXIST))
- syslog(LOG_EMERG, "netspool: unable to create directory [%s]: %s", ctdl_nettmp_dir, strerror(errno));
- if (chown(ctdl_nettmp_dir, CTDLUID, (-1)) != 0)
- syslog(LOG_EMERG, "netspool: unable to set the access rights for [%s]: %s", ctdl_nettmp_dir, strerror(errno));
-}
-
-
/*
* Module entry point
*/
CtdlREGISTERRoomCfgType(digestrecp, ParseGeneric, 0, 1, SerializeGeneric, DeleteGenericCfgLine);
CtdlREGISTERRoomCfgType(participate, ParseGeneric, 0, 1, SerializeGeneric, DeleteGenericCfgLine);
CtdlREGISTERRoomCfgType(roommailalias, ParseRoomAlias, 0, 1, SerializeGeneric, DeleteGenericCfgLine);
- create_spool_dirs();
}
return "network_spool";
}
) {
CC->download_fp = tmpfile();
if (CC->download_fp == NULL) {
- syslog(LOG_EMERG, "msgbase: mime_download() couldn't write: %m");
+ syslog(LOG_ERR, "msgbase: mime_download() couldn't write: %m");
cprintf("%d cannot open temporary file: %s\n", ERROR + INTERNAL_ERROR, strerror(errno));
return;
}
rv = fwrite(content, length, 1, CC->download_fp);
if (rv <= 0) {
- syslog(LOG_EMERG, "msgbase: mime_download() Couldn't write: %m");
+ syslog(LOG_ERR, "msgbase: mime_download() Couldn't write: %m");
cprintf("%d unable to write tempfile.\n", ERROR + TOO_BIG);
fclose(CC->download_fp);
CC->download_fp = NULL;
StrBufAppendBufPlain(Message, HKEY("\n\n"), 0);
StrBufAppendBufPlain(Message, CKEY(ErrGeneral[3]), 0);
- syslog(LOG_EMERG, "extensions: %s", ChrPtr(Message));
- syslog(LOG_EMERG, "extensions: %s", ErrSubject);
+ syslog(LOG_ERR, "extensions: %s", ChrPtr(Message));
+ syslog(LOG_ERR, "extensions: %s", ErrSubject);
quickie_message("Citadel", NULL, NULL, AIDEROOM, ChrPtr(Message), FMT_FIXED, ErrSubject);
FreeStrBuf(&Message);
#include <grp.h>
#include <sys/file.h>
#include <libcitadel.h>
-
#include "citserver.h"
#include "svn_revision.h"
#include "modules_init.h"
/*
* Create or remove a lock file, so we only have one Citadel Server running at a time.
+ * Set 'op' to nonzero to lock, zero to unlock.
*/
-void ctdl_lockfile(int yo) {
+void ctdl_lockfile(int op) {
static char lockfilename[PATH_MAX];
static FILE *fp;
- if (yo) {
+ if (op) {
syslog(LOG_DEBUG, "main: creating lockfile");
snprintf(lockfilename, sizeof lockfilename, "%s/citadel.lock", ctdl_run_dir);
fp = fopen(lockfilename, "w");
/*
* Here's where it all begins.
*/
-int main(int argc, char **argv)
-{
+int main(int argc, char **argv) {
+
size_t basesize = 64;
char facility[32];
int a; /* General-purpose variables */
struct passwd pw, *pwp = NULL;
char pwbuf[SIZ];
int drop_root_perms = 1;
- int relh=0;
- int home=0;
- int dbg=0;
int max_log_level = LOG_INFO;
- char relhome[PATH_MAX]="";
- char ctdldir[PATH_MAX]=CTDLDIR;
+ char *ctdldir = CTDLDIR;
int syslog_facility = LOG_DAEMON;
uid_t u = 0;
struct passwd *p = NULL;
struct stat filestats;
#endif
- /* initialize the master context */
- InitializeMasterCC();
- InitializeMasterTSD();
+ /* Tell 'em who's in da house */
+ syslog(LOG_INFO, " ");
+ syslog(LOG_INFO, " ");
+ syslog(LOG_INFO, "*** Citadel server engine ***\n");
+ syslog(LOG_INFO, "Version %d (build %s) ***", REV_LEVEL, svn_revision());
+ syslog(LOG_INFO, "Copyright (C) 1987-2021 by the Citadel development team.");
+ syslog(LOG_INFO, " ");
+ syslog(LOG_INFO, "This program is open source software: you can redistribute it and/or");
+ syslog(LOG_INFO, "modify it under the terms of the GNU General Public License, version 3.");
+ syslog(LOG_INFO, " ");
+ syslog(LOG_INFO, "This program is distributed in the hope that it will be useful,");
+ syslog(LOG_INFO, "but WITHOUT ANY WARRANTY; without even the implied warranty of");
+ syslog(LOG_INFO, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the");
+ syslog(LOG_INFO, "GNU General Public License for more details.");
+ syslog(LOG_INFO, " ");
+ syslog(LOG_INFO, "%s", libcitadel_version_string());
/* parse command-line arguments */
while ((a=getopt(argc, argv, "cl:dh:x:t:B:Dru:s:")) != EOF) switch(a) {
// specify the data directory
case 'h':
- relh = optarg[0] != '/';
- if (!relh) {
- safestrncpy(ctdl_home_directory, optarg, sizeof ctdl_home_directory);
- }
- else {
- safestrncpy(relhome, optarg, sizeof relhome);
- }
- home=1;
+ ctdldir = optarg;
break;
// identify the desired logging severity level
case 't':
break;
- // basesize (what is this?)
+ // basesize (passed to libcitadel)
case 'B':
basesize = atoi(optarg);
break;
+ // deprecated
case 'D':
- dbg = 1;
break;
// -r tells the server not to drop root permissions.
"citserver "
"[-l LogFacility] "
"[-x MaxLogLevel] "
- "[-d] [-D] [-r] "
+ "[-d] [-r] "
"[-u user] "
"[-h HomeDir]\n"
);
exit(1);
}
+ if (chdir(ctdldir) != 0) {
+ syslog(LOG_ERR, "main: unable to change directory to [%s]: %m", ctdldir);
+ }
+ else {
+ syslog(LOG_INFO, "main: running in data directory %s", ctdldir);
+ }
+
+ if ((ctdluid == 0) && (drop_root_perms == 0)) {
+ fprintf(stderr, "citserver: cannot determine user to run as; please specify -r or -u options\n");
+ exit(CTDLEXIT_UNUSER);
+ }
+
/* Last ditch effort to determine the user name ... if there's a user called "citadel" then use that */
if (ctdluid == 0) {
p = getpwnam("citadel");
}
}
- if ((ctdluid == 0) && (drop_root_perms == 0)) {
- fprintf(stderr, "citserver: cannot determine user to run as; please specify -r or -u options\n");
- exit(CTDLEXIT_UNUSER);
- }
+ /* initialize the master context */
+ InitializeMasterCC();
+ InitializeMasterTSD();
StartLibCitadel(basesize);
setlogmask(LOG_UPTO(max_log_level));
syslog_facility
);
- calc_dirs_n_files(relh, home, relhome, ctdldir, dbg);
/* daemonize, if we were asked to */
if (running_as_daemon) {
start_daemon(0);
drop_root_perms = 1;
}
- /* Tell 'em who's in da house */
- syslog(LOG_INFO, " ");
- syslog(LOG_INFO, " ");
- syslog(LOG_INFO, "*** Citadel server engine ***\n");
- syslog(LOG_INFO, "Version %d (build %s) ***", REV_LEVEL, svn_revision());
- syslog(LOG_INFO, "Copyright (C) 1987-2021 by the Citadel development team.");
- syslog(LOG_INFO, " ");
- syslog(LOG_INFO, "This program is open source software: you can redistribute it and/or");
- syslog(LOG_INFO, "modify it under the terms of the GNU General Public License, version 3.");
- syslog(LOG_INFO, " ");
- syslog(LOG_INFO, "This program is distributed in the hope that it will be useful,");
- syslog(LOG_INFO, "but WITHOUT ANY WARRANTY; without even the implied warranty of");
- syslog(LOG_INFO, "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the");
- syslog(LOG_INFO, "GNU General Public License for more details.");
- syslog(LOG_INFO, " ");
- syslog(LOG_INFO, "%s", libcitadel_version_string());
-
if ((mkdir(ctdl_run_dir, 0755) != 0) && (errno != EEXIST)) {
syslog(LOG_ERR, "main: unable to create run directory [%s]: %m", ctdl_run_dir);
}
syslog(LOG_INFO, "main: upgrading modules"); // Run any upgrade entry points
upgrade_modules();
-/*
- * Load the user for the masterCC or create them if they don't exist
- */
- if (CtdlGetUser(&masterCC.user, "SYS_Citadel"))
- {
+ /*
+ * Load the user for the masterCC or create them if they don't exist
+ */
+ if (CtdlGetUser(&masterCC.user, "SYS_Citadel")) {
/* User doesn't exist. We can't use create user here as the user number needs to be 0 */
strcpy (masterCC.user.fullname, "SYS_Citadel") ;
CtdlPutUser(&masterCC.user);
- CtdlGetUser(&masterCC.user, "SYS_Citadel"); /* Just to be safe */
+ CtdlGetUser(&masterCC.user, "SYS_Citadel"); /* Just to be safe */
}
/*
* Load any server-side extensions available here.
*/
syslog(LOG_INFO, "main: initializing server extensions");
-
initialise_modules(0);
/*
checkcrash();
/*
- * Now that we've bound the sockets, change to the Citadel user id and its
- * corresponding group ids
+ * Now that we've bound the sockets, change to the Citadel user id and its corresponding group ids
*/
if (drop_root_perms) {
cdb_chmod_data(); /* make sure we own our data files */
-
-#ifdef HAVE_GETPWUID_R
-#ifdef SOLARIS_GETPWUID
- pwp = getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf));
-#else // SOLARIS_GETPWUID
getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
-#endif // SOLARIS_GETPWUID
-#else // HAVE_GETPWUID_R
- pwp = NULL;
-#endif // HAVE_GETPWUID_R
-
if (pwp == NULL)
syslog(LOG_ERR, "main: WARNING, getpwuid(%ld): %m Group IDs will be incorrect.", (long)CTDLUID);
else {
initgroups(pw.pw_name, pw.pw_gid);
- if (setgid(pw.pw_gid))
+ if (setgid(pw.pw_gid)) {
syslog(LOG_ERR, "main: setgid(%ld): %m", (long)pw.pw_gid);
+ }
}
syslog(LOG_INFO, "main: changing uid to %ld", (long)CTDLUID);
if (setuid(CTDLUID) != 0) {
/* We want to check for idle sessions once per minute */
CtdlRegisterSessionHook(terminate_idle_sessions, EVT_TIMER, PRIO_CLEANUP + 1);
+ /* Go into multithreaded mode. When this call exits, the server is stopping. */
go_threading();
+ /* Get ready to shut down the server. */
int exit_code = master_cleanup(exit_signal);
ctdl_lockfile(0);
if (restart_server) {
- syslog(LOG_INFO, "main: *** CITADEL SERVER IS RESTARTING ***");
+ syslog(LOG_INFO, "main: *** CITADEL SERVER IS RESTARTING ***");
execv(argv[0], argv);
}
return(exit_code);
#include "citadel.h"
#include "citadel_dirs.h"
-/* our directories... */
-char ctdl_home_directory[PATH_MAX] = "";
-char ctdl_data_dir[PATH_MAX]="data";
-char ctdl_file_dir[PATH_MAX]="files";
-char ctdl_shared_dir[PATH_MAX]="";
-char ctdl_image_dir[PATH_MAX]="images";
-char ctdl_info_dir[PATH_MAX]="info";
-char ctdl_key_dir[PATH_MAX]=SSL_DIR;
-char ctdl_message_dir[PATH_MAX]="messages";
-char ctdl_usrpic_dir[PATH_MAX]="userpics";
-char ctdl_bbsbase_dir[PATH_MAX]="";
-char ctdl_autoetc_dir[PATH_MAX]="";
-/* attention! this may be non volatile on some oses */
-char ctdl_run_dir[PATH_MAX]="";
-char ctdl_spool_dir[PATH_MAX]="network";
-char ctdl_netdigest_dir[PATH_MAX]="network/digest";
-char ctdl_nettmp_dir[PATH_MAX]="network/spooltmp";
-char ctdl_netcfg_dir[PATH_MAX]="netconfigs";
-char ctdl_utilbin_dir[PATH_MAX]="";
-char ctdl_sbin_dir[PATH_MAX]="";
-char ctdl_bin_dir[PATH_MAX]="";
-
-/* some of our files, that are needed in several places */
-char file_citadel_config[PATH_MAX]="";
-char file_lmtp_socket[PATH_MAX]="";
-char file_lmtp_unfiltered_socket[PATH_MAX]="";
-char file_arcq[PATH_MAX]="";
-char file_citadel_socket[PATH_MAX]="";
-char file_citadel_admin_socket[PATH_MAX]="";
-char file_mail_aliases[PATH_MAX]="";
-char file_pid_file[PATH_MAX]="";
-char file_pid_paniclog[PATH_MAX]="";
-char file_crpt_file_key[PATH_MAX]="";
-char file_crpt_file_csr[PATH_MAX]="";
-char file_crpt_file_cer[PATH_MAX]="";
-char file_chkpwd[PATH_MAX]="";
-char file_guesstimezone[PATH_MAX]="";
-
-
-
-
-
-#define COMPUTE_DIRECTORY(SUBDIR) memcpy(dirbuffer,SUBDIR, sizeof dirbuffer);\
- snprintf(SUBDIR,sizeof SUBDIR, "%s%s%s%s%s%s%s", \
- (home&!relh)?ctdl_home_directory:basedir, \
- ((basedir!=ctdldir)&(home&!relh))?basedir:"/", \
- ((basedir!=ctdldir)&(home&!relh))?"/":"", \
- relhome, \
- (relhome[0]!='\0')?"/":"",\
- dirbuffer,\
- (dirbuffer[0]!='\0')?"/":"");
-
-#define DBG_PRINT(A) if (dbg==1) fprintf (stderr,"%s : %s \n", #A, A)
-
-
-void calc_dirs_n_files(int relh, int home, const char *relhome, char *ctdldir, int dbg)
-{
- const char* basedir = "";
- char dirbuffer[PATH_MAX] = "";
-
- /*
- * Ok, we keep our binaries either in the citadel base dir,
- * or in /usr/sbin / /usr/bin
- */
- StripSlashes(ctdldir, 1);
-#ifdef HAVE_ETC_DIR
- snprintf(ctdl_sbin_dir, sizeof ctdl_sbin_dir, "/usr/sbin/");
- snprintf(ctdl_bin_dir, sizeof ctdl_bin_dir, "/usr/bin/");
-#else
- snprintf(ctdl_sbin_dir, sizeof ctdl_sbin_dir, ctdldir);
- snprintf(ctdl_bin_dir, sizeof ctdl_bin_dir, ctdldir);
-#endif
- StripSlashes(ctdl_sbin_dir, 1);
- StripSlashes(ctdl_bin_dir, 1);
-
-#ifndef HAVE_AUTO_ETC_DIR
- basedir=ctdldir;
-#else
- basedir=AUTO_ETC_DIR;
-#endif
- COMPUTE_DIRECTORY(ctdl_autoetc_dir);
- StripSlashes(ctdl_autoetc_dir, 1);
-
-#ifndef HAVE_ETC_DIR
- basedir=ctdldir;
-#else
- basedir=ETC_DIR;
-#endif
- COMPUTE_DIRECTORY(ctdl_netcfg_dir);
- StripSlashes(ctdl_netcfg_dir, 1);
-
-#ifndef HAVE_UTILBIN_DIR
- basedir=ctdldir;
-#else
- basedir=UTILBIN_DIR;
-#endif
- COMPUTE_DIRECTORY(ctdl_utilbin_dir);
- StripSlashes(ctdl_utilbin_dir, 1);
-
-#ifndef HAVE_RUN_DIR
- basedir=ctdldir;
-#else
- basedir=RUN_DIR;
-#endif
- COMPUTE_DIRECTORY(ctdl_run_dir);
- StripSlashes(ctdl_run_dir, 1);
-
-#ifndef HAVE_STATICDATA_DIR
- basedir=ctdldir;
-#else
- basedir=STATICDATA_DIR;
-#endif
- COMPUTE_DIRECTORY(ctdl_message_dir);
- StripSlashes(ctdl_message_dir, 1);
-
-#ifndef HAVE_DATA_DIR
- basedir=ctdldir;
-#else
- basedir=DATA_DIR;
-#endif
- COMPUTE_DIRECTORY(ctdl_data_dir);
- COMPUTE_DIRECTORY(ctdl_file_dir);
- COMPUTE_DIRECTORY(ctdl_image_dir);
- COMPUTE_DIRECTORY(ctdl_info_dir);
- COMPUTE_DIRECTORY(ctdl_usrpic_dir);
- COMPUTE_DIRECTORY(ctdl_bbsbase_dir);
-
- StripSlashes(ctdl_data_dir, 1);
- StripSlashes(ctdl_file_dir, 1);
- StripSlashes(ctdl_image_dir, 1);
- StripSlashes(ctdl_info_dir, 1);
- StripSlashes(ctdl_usrpic_dir, 1);
- StripSlashes(ctdl_bbsbase_dir, 1);
-
-#ifndef HAVE_SPOOL_DIR
- basedir=ctdldir;
-#else
- basedir=SPOOL_DIR;
-#endif
- COMPUTE_DIRECTORY(ctdl_spool_dir);
- COMPUTE_DIRECTORY(ctdl_netdigest_dir);
- COMPUTE_DIRECTORY(ctdl_nettmp_dir);
-
- StripSlashes(ctdl_spool_dir, 1);
- StripSlashes(ctdl_netdigest_dir, 1);
- StripSlashes(ctdl_nettmp_dir, 1);
-
- /* ok, now we know the dirs, calc some commonly used files */
-
- snprintf(file_arcq,
- sizeof file_arcq,
- "%srefcount_adjustments.dat",
- ctdl_autoetc_dir);
- StripSlashes(file_arcq, 0);
-
- snprintf(file_citadel_config,
- sizeof file_citadel_config,
- "%scitadel.config",
- ctdl_autoetc_dir);
- StripSlashes(file_citadel_config, 0);
- snprintf(file_lmtp_socket,
- sizeof file_lmtp_socket,
- "%slmtp.socket",
- ctdl_run_dir);
- StripSlashes(file_lmtp_socket, 0);
- snprintf(file_lmtp_unfiltered_socket,
- sizeof file_lmtp_socket,
- "%slmtp-unfiltered.socket",
- ctdl_run_dir);
- StripSlashes(file_lmtp_unfiltered_socket, 0);
- snprintf(file_citadel_socket,
- sizeof file_citadel_socket,
- "%scitadel.socket",
- ctdl_run_dir);
- StripSlashes(file_citadel_socket, 0);
- snprintf(file_citadel_admin_socket,
- sizeof file_citadel_admin_socket,
- "%scitadel-admin.socket",
- ctdl_run_dir);
- StripSlashes(file_citadel_admin_socket, 0);
- snprintf(file_pid_file,
- sizeof file_pid_file,
- "%scitadel.pid",
- ctdl_run_dir);
- StripSlashes(file_pid_file, 0);
- snprintf(file_pid_paniclog,
- sizeof file_pid_paniclog,
- "%spanic.log",
- ctdl_home_directory);
- StripSlashes(file_pid_paniclog, 0);
- snprintf(file_crpt_file_key,
- sizeof file_crpt_file_key,
- "%s/citadel.key",
- ctdl_key_dir);
- StripSlashes(file_crpt_file_key, 0);
- snprintf(file_crpt_file_csr,
- sizeof file_crpt_file_csr,
- "%s/citadel.csr",
- ctdl_key_dir);
- StripSlashes(file_crpt_file_csr, 0);
- snprintf(file_crpt_file_cer,
- sizeof file_crpt_file_cer,
- "%s/citadel.cer",
- ctdl_key_dir);
- StripSlashes(file_crpt_file_cer, 0);
- snprintf(file_chkpwd,
- sizeof file_chkpwd,
- "%schkpwd",
- ctdl_utilbin_dir);
- StripSlashes(file_chkpwd, 0);
- snprintf(file_guesstimezone,
- sizeof file_guesstimezone,
- "%sguesstimezone.sh",
- ctdl_utilbin_dir);
-
- /*
- * DIRTY HACK FOLLOWS! due to configs in the network dir in the
- * legacy installations, we need to calculate ifdeffed here.
- */
- snprintf(file_mail_aliases,
- sizeof file_mail_aliases,
- "%smail.aliases",
- ctdl_spool_dir
- );
- StripSlashes(file_mail_aliases, 0);
-
- DBG_PRINT(ctdl_data_dir);
- DBG_PRINT(ctdl_file_dir);
- DBG_PRINT(ctdl_image_dir);
- DBG_PRINT(ctdl_info_dir);
- DBG_PRINT(ctdl_key_dir);
- DBG_PRINT(ctdl_message_dir);
- DBG_PRINT(ctdl_usrpic_dir);
- DBG_PRINT(ctdl_run_dir);
- DBG_PRINT(ctdl_spool_dir);
- DBG_PRINT(ctdl_netdigest_dir);
- DBG_PRINT(ctdl_nettmp_dir);
- DBG_PRINT(ctdl_netcfg_dir);
- DBG_PRINT(ctdl_bbsbase_dir);
- DBG_PRINT(ctdl_sbin_dir);
- DBG_PRINT(ctdl_bin_dir);
- DBG_PRINT(ctdl_utilbin_dir);
- DBG_PRINT(file_citadel_config);
- DBG_PRINT(file_lmtp_socket);
- DBG_PRINT(file_lmtp_unfiltered_socket);
- DBG_PRINT(file_arcq);
- DBG_PRINT(file_citadel_socket);
- DBG_PRINT(file_mail_aliases);
- DBG_PRINT(file_pid_file);
- DBG_PRINT(file_pid_paniclog);
- DBG_PRINT(file_crpt_file_key);
- DBG_PRINT(file_crpt_file_csr);
- DBG_PRINT(file_crpt_file_cer);
- DBG_PRINT(file_chkpwd);
- DBG_PRINT(file_guesstimezone);
-}
+/* all our directories */
+char *ctdl_home_directory = ".";
+char *ctdl_db_dir = "data";
+char *ctdl_file_dir = "files";
+char *ctdl_shared_dir = ".";
+char *ctdl_image_dir = "images";
+char *ctdl_info_dir = "info";
+char *ctdl_key_dir = "keys";
+char *ctdl_message_dir = "messages";
+char *ctdl_usrpic_dir = "userpics";
+char *ctdl_autoetc_dir = ".";
+char *ctdl_run_dir = ".";
+char *ctdl_netcfg_dir = "netconfigs";
+char *ctdl_bbsbase_dir = ".";
+char *ctdl_sbin_dir = ".";
+char *ctdl_bin_dir = ".";
+char *ctdl_utilbin_dir = ".";
+
+/* some of the frequently used files */
+char *file_citadel_config = "citadel.config";
+char *file_lmtp_socket = "lmtp.socket";
+char *file_lmtp_unfiltered_socket = "lmtp-unfiltered.socket";
+char *file_arcq = "refcount_adjustments.dat";
+char *file_citadel_socket = "citadel.socket";
+char *file_citadel_admin_socket = "citadel-admin.socket";
+char *file_pid_file = "/var/run/citserver.pid";
+char *file_pid_paniclog = "panic.log";
+char *file_crpt_file_key = "keys/citadel.key";
+char *file_crpt_file_csr = "keys/citadel.csr";
+char *file_crpt_file_cer = "keys/citadel.cer";
+char *file_chkpwd = "chkpwd";
+char *file_guesstimezone = "guesstimezone.sh";
/*
}
-void remove_digest_file(struct ctdlroom *room) {
- char buf[PATH_MAX];
-
- snprintf(buf, PATH_MAX, "%s/%ld.eml", ctdl_netdigest_dir, room->QRnumber);
- StripSlashes(buf, 0);
- unlink(buf);
-}
-
-
-FILE *create_digest_file(struct ctdlroom *room, int forceCreate) {
- struct stat stbuf;
- char fn[PATH_MAX];
- int exists;
- FILE *fp;
-
- snprintf(fn, PATH_MAX, "%s/%ld.eml", ctdl_netdigest_dir, room->QRnumber);
- StripSlashes(fn, 0);
-
- exists = stat(fn, &stbuf);
- if (!forceCreate && (exists == -1))
- return NULL;
-
- fp = fopen(fn, "w+");
- if (fp == NULL) {
- syslog(LOG_ERR, "failed to create digest file %s: %s", fn, strerror(errno));
- }
- return fp;
-}
-
-
int create_dir(char *which, long ACCESS, long UID, long GID) {
int rv;
rv = mkdir(which, ACCESS);
int rv = 0;
rv += create_dir(ctdl_message_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
- rv += create_dir(ctdl_spool_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
- rv += create_dir(ctdl_netdigest_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
- rv += create_dir(ctdl_nettmp_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
rv += create_dir(ctdl_run_dir , S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, UID, GID);
return rv;
/*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * 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.
int uid;
char ctdldir[PATH_MAX]=CTDLDIR;
- calc_dirs_n_files(0,0,"", ctdldir, 0);
-
printf("\n\n ** host auth mode test utility **\n\n");
start_chkpwd_daemon();
* some other non-Citadel MTA. It basically just contacts the Citadel LMTP
* listener on a unix domain socket and transmits the message.
*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2021by 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 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.
+ * 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.
*/
#include "sysdep.h"
}
}
- /* TODO: should we be able to calculate relative dirs? */
- calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
-
pw = getpwuid(getuid());
fp = tmpfile();
if (fp == NULL) return(errno);
- serv_sock = uds_connectsock(file_lmtp_socket); /* FIXME: if called as 'sendmail' connect to file_lmtp_unfiltered_socket */
+ serv_sock = uds_connectsock(file_lmtp_socket);
serv_gets(buf);
if (buf[0] != '2') {
fprintf(stderr, "%s\n", &buf[4]);
* The scope of this program isn't wide enough to make a difference. If you don't like
* it you can rewrite it.
*
- * Copyright (c) 2009-2018 citadel.org
+ * Copyright (c) 2009-2021 citadel.org
*
* 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.
char spinning[4] = "-\\|/" ;
int exitcode = 0;
- calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
CtdlMakeTempFileName(socket_path, sizeof socket_path);
cmdexit = system("clear");
/*
* Command-line utility to transmit a server command.
*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * 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.
}
}
- calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
-
fprintf(stderr, "sendcommand: started (pid=%d) connecting to Citadel server at %s\n",
(int) getpid(),
file_citadel_admin_socket
}
}
- calc_dirs_n_files(relh, home, relhome, ctdldir, 0);
SetTitles();
enable_home = ( relh | home );
+++ /dev/null
-ubuntu/CitadelBuildGutsy
-ubuntu/CitadelBuildFeisty
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
-debian/CitadelBuildEtch
-debian/CitadelBuildSid
+++ /dev/null
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
-debian/CitadelBuildEtch
-debian/CitadelBuildSid
-
+++ /dev/null
-debian/CitadelBuildEtch
-debian/CitadelBuildSid
-ubuntu/CitadelBuildGutsy
-ubuntu/CitadelBuildFeisty
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
+++ /dev/null
-ubuntu/CitadelBuildBreezy
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
-debian/CitadelBuildSarge
-debian/CitadelBuildSarge_bdb44
+++ /dev/null
-ubuntu/CitadelBuildGutsy
-ubuntu/CitadelBuildFeisty
-ubuntu/CitadelBuildBreezy
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
-debian/CitadelBuildEtch
-debian/CitadelBuildEtch_bdb44
-debian/CitadelBuildSarge
-debian/CitadelBuildSarge_bdb44
-debian/CitadelBuildSid
+++ /dev/null
-ubuntu/CitadelBuildBreezy
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
-debian/CitadelBuildSarge
-debian/CitadelBuildSarge_bdb44
+++ /dev/null
-ubuntu/CitadelBuildGutsy
-ubuntu/CitadelBuildFeisty
-ubuntu/CitadelBuildBreezy
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
-debian/CitadelBuildEtch
-debian/CitadelBuildEtch_bdb44
-debian/CitadelBuildSarge
-debian/CitadelBuildSarge_bdb44
-debian/CitadelBuildSid
+++ /dev/null
-ubuntu/CitadelBuildBreezy
-ubuntu/CitadelBuildDapper
-ubuntu/CitadelBuildEdgy
-debian/CitadelBuildSarge
-debian/CitadelBuildSarge_bdb44
+++ /dev/null
-#!/bin/bash
-# find out the package version from conf
-if test -f Makefile; then
- make distclean
-fi
-
-./bootstrap
-
-export `grep PACKAGE_VERSION= configure |sed -e "s;';;g" -e "s;PACKAGE;LIBCITADEL;" -e "s;4.;;"`
-
-DATE=`date '+%a, %d %b %Y %H:%I:00 %z'`
-ACTUAL_DIR=`pwd`
-
-
-rm -rf debian/libcitadel debian/libcitadel-dev debian/libcitadel1 debian/libcitadel1-dbg debian/tmp
-if echo "$ACTUAL_DIR" |grep -q "$LIBCITADEL_VERSION"; then
- echo "directory ($ACTUAL_DIR) naming scheme seems right. nothing done."
-else
- done=false
- if test -L "$ACTUAL_DIR"; then
- SYMLINK_=`pwd`
- SYMLINK=`ls -l $SYMLINK_|sed "s;.*-> ;;"`
- if ls -l $SYMLINK|grep -q "$LIBCITADEL_VERSION"; then
- done=true
- fi
- else
- SYMLINK=`pwd|sed "s;.*/;;"`
- fi
- if test "$done" = "false"; then
- cd ..
- ln -sf libcitadel "libcitadel-$LIBCITADEL_VERSION"
- cd "libcitadel-$LIBCITADEL_VERSION"
- else
- cd "../libcitadel-$LIBCITADEL_VERSION"
- fi
-
-fi
-
-
-case $1 in
- debian)
- if grep -q "($LIBCITADEL_VERSION" debian/changelog; then
- echo rebuilding package.
- else
- echo "Upstream Version higher than local."
-
- fi
- if test "$2" == "src"; then
- cd ..
- rm -rf tmp
- mkdir tmp
- cp -rL libcitadel-$LIBCITADEL_VERSION tmp
- cd tmp/libcitadel-$LIBCITADEL_VERSION
- rm -rf `find -name .svn ` svn*tmp config.log config.status `find -name .libs`
- find -type f -exec chmod a-x {} \;
- chmod a+x configure
- cd ..
- tar -chzf libcitadel_${LIBCITADEL_VERSION}.orig.tar.gz libcitadel-${LIBCITADEL_VERSION}/ --exclude "debian/*"
- pwd
- cd libcitadel-${LIBCITADEL_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
- else
- fakeroot dpkg-buildpackage
- fi
- ;;
- csw)
- if !test -d ~/pkgs/; then
- mkdir ~/pkgs
- fi
- echo "
-PKG=CSWlibcitadel
-NAME=libcitadel - The groupware server for Web 2.0
-VERSION=${PACKAGE_VERSION}
-CATEGORY=application
-VENDOR=http://www.citadel.org/ packaged for CSW by Wilfried Goesgens
-HOTLINE=https://uncensored.citadel.org/ Room citadel support
-EMAIL=citadel@outgesourced.org
-" >~/pkgs/citadel
- 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-ical=/usr/local/ \
- --without-curses \
- --with-prefix=/opt/csw/ \
- --with-datadir=/opt/csw/var/lib/citadel \
- --with-sysconfdir=/opt/csw/etc/citadel \
- --with-ssldir=/opt/csw/etc/ssl/citadel/ \
- --with-spooldir=/opt/csw/var/spool/citadel \
- --with-rundir=/opt/csw/var/run/citadel \
- --with-docdir=/opt/csw/share/doc/citadel-doc/ \
- --with-pam \
- --with-zlib \
- --with-ldap \
- --with-libsieve
-
- gmake citserver aidepost msgform citmail userlist sendcommand base64 whobbs citadel
- gmake DESTDIR=$ACTUAL_DIR/cswstage install-new
-
-
-
- ;;
- sourcedist)
- cd ..; tar \
- --exclude ".gitignore" \
- --exclude "*.lo" \
- --exclude "*.o" \
- --exclude "*.d" \
- --exclude "autom4te.cache/*" \
- --exclude "debian/*" \
- --exclude "sysdep.h" \
- \
- --exclude .libs \
- --exclude tests/testdata \
- \
- -chvzf libcitadel-$LIBCITADEL_VERSION.tar.gz libcitadel-$LIBCITADEL_VERSION/
- ;;
- version)
- echo This would build libcitadel-$LIBCITADEL_VERSION
- ;;
- *)
- echo "Not yet implemented. we have: debian, sourcedist "
- ;;
-esac
+++ /dev/null
-*.log
-*.substvars
-*.debhelper
-libcitadel2-dbg
-libcitadel2
-files
\ No newline at end of file
+++ /dev/null
-libcitadel (925-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 19 Dec 2018 16:57:49 -0500
-
-libcitadel (924-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 19 Dec 2018 16:57:49 -0500
-
-libcitadel (917-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 03 Jan 2018 16:57:49 -0500
-
-libcitadel (9.16-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 01 Jan 2018 12:56:30 -0400
-
-libcitadel (9.14-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 26 Dec 2017 12:56:30 -0400
-
-libcitadel (9.01-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 01 Apr 2015 12:56:30 -0400
-
-libcitadel (8.29-1) stable; urgency=low
-
- * development prerelease
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Sat, 07 Dec 2013 11:41:23 +0100
-
-libcitadel (8.21-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 16 Oct 2013 22:00:00 +0001
-
-libcitadel (8.20-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 16 Jul 2013 22:00:00 +0001
-
-libcitadel (8.19.99-1) stable; urgency=low
-
- * development vesrion
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Mon, 16 Jun 2012 22:00:00 +0001
-
-libcitadel (8.13-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Mon, 16 Jun 2012 22:00:00 +0001
-
-libcitadel (8.12-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 26 Jun 2012 22:00:00 +0001
-
-libcitadel (8.11-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 16 May 2012 22:00:00 +0001
-
-libcitadel (8.10-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Fri, 11 Nov 2011 22:00:00 +0001
-
-libcitadel (8.02-1) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Fri, 11 Nov 2011 22:00:00 +0001
-
-libcitadel (7.83-91) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 28 Jul 2010 22:00:00 +0001
-
-libcitadel (7.80-90) stable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 19 Jul 2010 22:00:00 +0001
-
-libcitadel (7.72-90) stable; urgency=low
-
- * new maintenance release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 17 Feb 2010 22:00:00 +0001
-
-libcitadel (7.71-89) unstable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 5 Jan 2010 22:00:00 +0001
-
-libcitadel (7.70-86) unstable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 16 Dec 2009 22:00:00 +0002
-
-libcitadel (7.67-85) unstable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 1 Sep 2009 8:00:00 +0002
-
-libcitadel (7.66-84) unstable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Mon, 28 Sep 2009 18:00:00 +0001
-
-libcitadel (7.63-83) unstable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 1 Sep 2009 8:00:00 +0002
-
-libcitadel (7.61-82) unstable; urgency=low
-
- * tiny bugfix
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Mon, 17 Aug 2009 23:00:00 +0002
-
-libcitadel (7.61-81) unstable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 6 Aug 2009 10:00:00 +0002
-
-libcitadel (7.60-80) unstable; urgency=low
-
- * new release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 28 Jul 2009 00:00:00 +0002
-
-libcitadel (7.50-73) unstable; urgency=low
-
- * release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 17 Mar 2009 00:00:00 +0002
-
-libcitadel (7.43-72) unstable; urgency=low
-
- * Beta release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 17 Mar 2009 00:00:00 +0002
-
-libcitadel (7.42-71) unstable; urgency=low
-
- * Beta release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Wed, 25 Feb 2009 00:00:00 +0002
-
-libcitadel (7.41-70) unstable; urgency=low
-
- * Beta release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Fri, 20 Feb 2009 18:00:00 +0002
-
-libcitadel (7.38-8) stable; urgency=low
-
- * new upstream version
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Thu, 1 Aug 2008 22:00:00 +0002
-
-libcitadel (7.37-7) stable; urgency=low
-
- * new upstream version
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Thu, 19 Jun 2008 22:00:00 +0002
-
-libcitadel (1.14-6) stable; urgency=low
-
- * new upstream version
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Fri, 30 May 2008 19:00:00 +0002
-
-libcitadel (1.09-5) stable; urgency=low
-
- * new upstream version
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 22 Apr 2008 19:00:00 +0002
-
-libcitadel (1.08-5) stable; urgency=low
-
- * minor upstream bugfixes
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Mon, 17 Mar 2008 22:00:00 +0001
-
-libcitadel (1.08-4) stable; urgency=high
-
- * release 1.08; hashing / sorting implemented
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Mo, 3 Mar 2008 22:00:00 +0001
-libcitadel (1.07-8) stable; urgency=high
-
- * new upstream version
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Sat, 23 Feb 2008 0:00:00 +0001
-
-libcitadel (1.06-7) stable; urgency=high
-
- * mime to icon guessing
- * fixed hash lookups
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Sat, 23 Feb 2008 0:00:00 +0001
-libcitadel (1.05-4) stable; urgency=high
-
- * include xdgmime
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Tue, 12 Feb 2008 0:00:00 +0001
-libcitadel (1.03-3) unstable; urgency=low
-
- * initial debian release
-
- -- Wilfried Goesgens <w.goesgens@outgesourced.org> Sun, 18 Nov 2007 23:55:21 +0100
+++ /dev/null
-Source: libcitadel
-Section: libs
-Priority: extra
-Maintainer: Citadel Team <room_citadel_development@uncensored.citadel.org>
-Uploaders: Wilfried Goesgens <w.goesgens@outgesourced.org>, Alexander Wirt <formorer@debian.org>
-Build-Depends: debhelper (>= 5), zlib1g-dev
-Standards-Version: 3.8.0
-Homepage: http://citadel.org
-
-Package: libcitadel4
-Architecture: any
-Depends: ${shlibs:Depends}, shared-mime-info
-Description: Citadel toolbox
- This library contains the commonly used routines for the citadel suite.
-
-Package: libcitadel4-dbg
-Section: libdevel
-Architecture: any
-Depends: ${shlibs:Depends}, libcitadel4
-Description: Debugging symbols for libcitadel4
- This library contains the commonly used routines for the citadel suite.
- .
- This package provides the debugging symbols.
-
-Package: libcitadel-dev
-Section: libdevel
-Architecture: any
-Depends: ${shlibs:Depends}, pkg-config,
- libcitadel4 (= ${binary:Version})
-Description: Development files for libcitadel4
- This library contains the commonly used routines for the citadel suite.
- .
- This package provides development files and static libraries.
+++ /dev/null
-usr/share/doc
+++ /dev/null
-usr/share/doc
+++ /dev/null
-usr/lib/pkgconfig
-usr/lib/*.{so,a}
-usr/include
+++ /dev/null
-usr/lib/*.so.*
+++ /dev/null
-#!/usr/bin/make -f
-# -*- mode: makefile; coding: utf-8 -*-
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
-
-export DH_COMPAT = 5
-
-DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
-DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
-
-CFLAGS = -Wall -g -Wformat -Werror=format-security
-#-finline-functions
-LDFALGS =
-# -finline-functions
-ifneq (,$(findstring debug,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D DEBUG -D VALGRIND
- EXTRA_ARGS = --with-backtrace
-else
-# CFLAGS += -O2 -fPIC
- CFLAGS += -O0 -ggdb -rdynamic -MD -MP -D DEBUG -D VALGRIND
-endif
-
-ifneq (,$(findstring profiling,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -pg
- LDFLAGS += -pg
-endif
-
-ifneq (,$(findstring sprofiling,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -D SIZE_DEBUG
-endif
-
-ifneq (,$(findstring gcov,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -fprofile-arcs -ftest-coverage
- LDFLAGS += -fprofile-arcs -ftest-coverage
-endif
-
-
-build: build-stamp
-build-stamp:
- dh_testdir
-
- export CFLAGS="$(CFLAGS)"; export LDFLAGS="$(LDFLAGS)"; ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
- $(EXTRA_ARGS) \
- --prefix=/usr
-
-# Build libcitadel
- $(MAKE)
-
- touch build-stamp
-
-clean:
- dh_testdir
- dh_testroot
- rm -f build-stamp install*-stamp
-
- [ ! -f Makefile ] || $(MAKE) distclean
-
- dh_clean
-
-install: install-stamp
-install-stamp: build-stamp
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- $(MAKE) DESTDIR=`pwd`/debian/tmp install
-
- touch install-stamp
-
-# Build architecture-independent files here.
-binary-indep: build install
-# dh_testdir -i
- dh_testroot -i
-# dh_installdocs -i -A README
-# dh_installchangelogs -i debian/no-upstream-changelog
-# dh_install -i --sourcedir=debian/tmp
-# dh_link -i
-# dh_strip -i
-# dh_compress -i
-# dh_fixperms -i
-# dh_installdeb -i
-# dh_shlibdeps -i
-# dh_gencontrol -i
-# dh_md5sums -i
-# dh_builddeb -i
-
-# Build architecture-dependent files here.
-binary-arch: build install
- dh_testdir -a
- dh_testroot -a
- dh_installchangelogs -a -plibcitadel4
- dh_installdocs -a
- dh_install -a --sourcedir=debian/tmp
- dh_link -a
- dh_strip -a --dbg-package=libcitadel4-dbg
- dh_compress -a
- dh_fixperms -a
- dh_makeshlibs -a -V
- dh_installdeb -a
- dh_shlibdeps -a
- dh_gencontrol -a
- dh_md5sums -a
- dh_builddeb -a
-
-source diff:
- @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+++ /dev/null
-This file is for notes on converting things to use the hash functions Dothebart added.
-
-
-Convert the server config to use these functions.
-Alter citserver to read key value pairs for the config instead of an ordered file.
-Alter citserver to store the config in the data base.
-Add code to serv_upgrade to convert the current file into a normal message in the DB.
-serv_upgrade will read the file create at setup time on first boot to get it into
-the DB this way the existing setup tools don't need to be altered.
-
-Webcit can then ask for the site wide config using normal MSG* commands.
-Webcit will need to parse the message into key value pairs which is dead simple to do.
-
-Hmm, just a thought but has anyone wondered about locking things like this so two Admins can't
-change them at the same time which would result in some changes getting lost.
-
-
-
-We can use this code for any key value pair situation since the has should be faster than sequential search.
-Possible candidates are.
-
-
-get_user and friends.
-Load the user list into the hash at boot.
-Write new entries to the DB when the occur.
-Use 2 hashes so we can quickly get user by name or number. This might be possible since
-the hash value can be any object. user name hash is master and sync'd wuth DB and has real destructor,
-user number hash uses exact same user object but dummy destructor that does nothing. That way
-destructing a key from the hash has expected results. Destructor could also call purge_user maybe?
-Perhaps delay writing changes if the server is busy.
-This would save on DB accesses which can be a bottle neck.
-Definately would save on DB reads.
-
-
-netconfigs??
-
-
-mail.aliases
-Load into a hash at startup and done with?
-Perhaps even bring this into the DB as a MSG update the MSG if the file changes for backward compat. Then
-we can make it changeable via client. File gets out of date though.
-Read from the DB as needed, cache into the hash?
-
-
-Webcit URL's
-Some of these might benefit from a hash.
-bstr does a sequential search for the key so a hash would be faster in cases where the URL contains lots of
-stuff like site config and probably more.
-
-
-Since the hash can store arbitrary objects we can probably use it to store contexts and threads.
-At first this seems as though it won't do much for performance but done right I think we will be
-able to do away with the locking of the entire list and reduce the granularity to locking only the context/thread struct
-we are currently working on.
-Perhaps a modified hash that locks the retrieved entry and unlocks the entry by a call to unlock key.
+++ /dev/null
-#!/bin/bash
-if test -x Makefile; then
- make clean
-fi
-./bootstrap
-export `grep PACKAGE_VERSION= configure |sed -e "s;';;g" -e "s;PACKAGE;WEBCIT;"`
-
-PACKAGE_VERSION=`cat packageversion`
-DATE=`date '+%a, %d %b %Y %H:%I:00 %z'`
-ACTUAL_DIR=`pwd`
-
-
-rm -rf debian/citadel-webcit debian/tmp/
-if echo "$ACTUAL_DIR" |grep -q "$WEBCIT_VERSION"; then
- echo "directory ($ACTUAL_DIR) naming scheme seems right. nothing done."
-else
- done=false
- if test -L "$ACTUAL_DIR"; then
- SYMLINK_=`pwd`
- SYMLINK=`ls -l $SYMLINK_|sed "s;.*-> ;;"`
- if ls -l $SYMLINK_|grep -q "$WEBCIT_VERSION"; then
- done=true
- fi
- else
- SYMLINK=`pwd|sed "s;.*/;;"`
- fi
- if test "$done" = "false"; then
- cd ..
- ln -sf webcit "webcit-$WEBCIT_VERSION"
- cd "webcit-$WEBCIT_VERSION"
- else
- cd "../webcit-$WEBCIT_VERSION"
- fi
-
-fi
-
-case $1 in
- debian)
- if grep -q "($WEBCIT_VERSION" debian/changelog; then
- echo rebuilding package.
- else
- echo "Upstream Version higher than local."
- fi
- if test "$2" == "src"; then
- cd ..
- rm -rf tmp
- mkdir tmp
- cp -rL webcit-$WEBCIT_VERSION tmp
- cd tmp/webcit-$WEBCIT_VERSION
- rm -rf `find -name .svn ` svn*tmp* build-stamp configure-stamp *~ config.guess config.log config.status autom4te.cache Makefile
- find -type f -exec chmod a-x {} \;
- chmod a+x configure debian/rules po/create-pot.sh mk_module_init.sh
- cd ..
- tar -chzf webcit_${WEBCIT_VERSION}.orig.tar.gz webcit-${WEBCIT_VERSION}/ --exclude "debian/*"
- pwd
- cd webcit-${WEBCIT_VERSION}; debuild -S -sa -kw.goesgens@outgesourced.org
- else
- fakeroot dpkg-buildpackage
- fi
- ;;
- sourcedist)
- if test "$2" == "dfsg"; then
- NONDFSG=-"-exclude static/webcit_icons/openid-small.gif"
- fi
- cd ..; tar \
- --exclude ".gitignore" \
- --exclude "*.lo" \
- --exclude "*.o" \
- --exclude "*.d" \
- --exclude "autom4te.cache/*" \
- --exclude "debian/*" \
- --exclude "sysdep.h" \
- \
- $NONDFSG \
- \
- -cvhzf webcit-${WEBCIT_VERSION}.tar.gz webcit-${WEBCIT_VERSION}/
- ;;
- i18n)
- ./webcit -G `pwd`/i18n_templatelist.c
- cd po/webcit; ./create-pot.sh
- ;;
- version)
- echo This would build webcit-${WEBCIT_VERSION}
- ;;
- *)
- echo "Not yet implemented. we have: debian, sourcedist, i18n (needs ready compiled & installed webcit in your system)"
- ;;
-esac