utillib/citadel_dirs.c \
citserver.c clientsocket.c config.c control.c $(DATABASE) \
domain.c serv_extensions.c genstamp.c \
- housekeeping.c ical_dezonify.c internet_addressing.c ecrash.c \
+ housekeeping.c ical_dezonify.c internet_addressing.c \
locate_host.c auth.c msgbase.c parsedate.c \
room_ops.c euidindex.c server_main.c ldap.c \
support.c sysdep.c user_ops.c journaling.c threads.c \
msgbase.o euidindex.o \
locate_host.o housekeeping.o ical_dezonify.o \
internet_addressing.o journaling.o \
- parsedate.o genstamp.o ecrash.o threads.o context.o \
+ parsedate.o genstamp.o threads.o context.o \
clientsocket.o modules_init.o modules_upgrade.o $(SERV_MODULES) \
svn_revision.o ldap.o netconfig.o md5.o
.PHONY: install-data install-doc install-exec clean cleaner distclean
install-locale:
- cd po/citadel-setup; $(MAKE)
+ cd po/citadel-setup
+ $(MAKE)
for i in `find locale -type d | grep -v .svn` \
; do \
test -d $(DESTDIR)$(LOCALEDIR)/$$i || mkdir -p $(DESTDIR)$(LOCALEDIR)/$$i; \
@echo
install-data:
- @for i in messages network/spoolin ; do
- $(srcdir)/mkinstalldirs $(DESTDIR)$(prefix)/$$i; \
- done
+ $(srcdir)/mkinstalldirs $(DESTDIR)$(prefix)/messages
@for i in public_clients citadel_urlshorteners.rc \
`find $(srcdir)/messages $(srcdir)/network -type f | grep -v .svn`; do \
echo $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
fi
install-data-new:
- @for i in network/spoolin network/systems; do \
- $(srcdir)/mkinstalldirs $(DESTDIR)$(RUN_DIR)/$$i; \
- done
$(srcdir)/mkinstalldirs $(DESTDIR)$(ETC_DIR)/
$(INSTALL_DATA) $(srcdir)/public_clients $(DESTDIR)$(ETC_DIR)/public_clients
$(INSTALL_DATA) $(srcdir)/citadel_urlshorteners.rc $(DESTDIR)$(ETC_DIR)/citadel_urlshorteners.rc
echo $(INSTALL_DATA) $$i $(DESTDIR)$(STATICDATA_DIR)/$$i; \
$(INSTALL_DATA) $$i $(DESTDIR)$(STATICDATA_DIR)/$$i; \
done
- $(srcdir)/mkinstalldirs $(DESTDIR)$(SPOOL_DIR)/network/spoolin
-@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; \
fi
- @for i in bio files images info userpics; do \
+ @for i in files; do \
$(srcdir)/mkinstalldirs $(DESTDIR)$(DATA_DIR)/$$i; \
done
echo $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
$(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
done
- @$(srcdir)/mkinstalldirs $(DESTDIR)$(prefix)/techdoc
- @for i in `find $(srcdir)/techdoc -type f | grep -v .svn`; do \
- echo $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
- $(INSTALL_DATA) $$i $(DESTDIR)$(prefix)/$$i; \
- done
echo $(INSTALL_DATA) README.txt $(DESTDIR)$(prefix)/README.txt
$(INSTALL_DATA) README.txt $(DESTDIR)$(prefix)/README.txt
$(INSTALL_DATA) README.txt $(DESTDIR)$(DOC_DIR)/README.txt
install-exec: all
- @for i in bio files images info userpics; do \
+ @for i in files; do \
$(srcdir)/mkinstalldirs $(DESTDIR)$(prefix)/$$i; \
done
@for i in $(SERVER_TARGETS) $(UTIL_TARGETS) $(UTILBIN_TARGETS); do \
*/
#define CITADEL PACKAGE_STRING
-#define REV_LEVEL 920 // This version
+#define REV_LEVEL 921 // This version
#define REV_MIN 591 // Oldest compatible database
#define EXPORT_REV_MIN 760 // Oldest compatible export files
#define LIBCITADEL_MIN 920 // Minimum required version of libcitadel
#include <sys/stat.h>
#include "sysdep.h"
#include <time.h>
-#if HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
#include <libcitadel.h>
#include "ctdl_module.h"
int panic_fd;
int openid_level_supported = 0;
-/*
- * print the actual stack frame.
- */
-void cit_backtrace(void)
-{
-#ifdef HAVE_BACKTRACE
- void *stack_frames[50];
- size_t size, i;
- char **strings;
-
- const char *p = IOSTR;
- if (p == NULL) p = "";
- size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
- strings = backtrace_symbols(stack_frames, size);
- for (i = 0; i < size; i++) {
- if (strings != NULL) {
- syslog(LOG_DEBUG, "citserver: %s %s", p, strings[i]);
- }
- else {
- syslog(LOG_DEBUG, "citserver: %s %p", p, stack_frames[i]);
- }
- }
- free(strings);
-#endif
-}
-
-void cit_oneline_backtrace(void)
-{
-#ifdef HAVE_BACKTRACE
- void *stack_frames[50];
- size_t size, i;
- char **strings;
- StrBuf *Buf;
-
- size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
- strings = backtrace_symbols(stack_frames, size);
- if (size > 0)
- {
- Buf = NewStrBuf();
- for (i = 1; i < size; i++) {
- if (strings != NULL)
- StrBufAppendPrintf(Buf, "%s : ", strings[i]);
- else
- StrBufAppendPrintf(Buf, "%p : ", stack_frames[i]);
- }
- free(strings);
- syslog(LOG_DEBUG, "citserver: %s %s", IOSTR, ChrPtr(Buf));
- FreeStrBuf(&Buf);
- }
-#endif
-}
-
-
-/*
- * print the actual stack frame.
- */
-void cit_panic_backtrace(int SigNum)
-{
-#ifdef HAVE_BACKTRACE
- void *stack_frames[10];
- size_t size, i;
- char **strings;
-
- printf("caught signal 11\n");
- size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
- strings = backtrace_symbols(stack_frames, size);
- for (i = 0; i < size; i++) {
- if (strings != NULL) {
- syslog(LOG_DEBUG, "%s", strings[i]);
- }
- else {
- syslog(LOG_DEBUG, "%p", stack_frames[i]);
- }
- }
- free(strings);
-#endif
- exit(-1);
-}
/*
* Various things that need to be initialized at startup
/*
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2018 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.
#define CTDLUSERIP (IsEmptyStr(CC->cs_addr) ? CC->cs_clientinfo: CC->cs_addr)
-void cit_backtrace(void);
-void cit_oneline_backtrace(void);
-void cit_panic_backtrace(int SigNum);
void master_startup (void);
int master_cleanup (int exitcode);
void set_wtmpsupp (char *newtext);
#include "ctdl_module.h"
#include "serv_extensions.h"
-#include "ecrash.h"
#include "citserver.h"
#include "user_ops.h"
#include "locate_host.h"
{
/* check for only one context here */
if (num_sessions == 1)
- return TRUE;
+ return 1;
}
- return FALSE;
+ return 0;
}
c = "WTF?";
}
syslog(LOG_DEBUG, "context: RemoveContext(%s) session %d", c, con->cs_pid);
-/// cit_backtrace();
/* Run any cleanup routines registered by loadable modules.
* Note: We have to "become_session()" because the cleanup functions
geteuid(),
getegid()
);
- cit_backtrace();
exit(CTDLEXIT_DB);
}
{
if (!IsEmptyStr(msg)) {
syslog(LOG_DEBUG, "db: %s", msg);
- cit_backtrace();
}
}
{
int *FOO = NULL;
syslog(LOG_ERR, "db: %s", msg);
- cit_backtrace();
*FOO = 1;
}
static void dbpanic(DB_ENV * env, int errval)
{
syslog(LOG_ERR, "db: PANIC: %s", db_strerror(errval));
- cit_backtrace();
}
static void cclose(DBC * cursor)
+++ /dev/null
-/*
- * author: David Frascone
- *
- * eCrash Implementation
- *
- * eCrash will allow you to capture stack traces in the
- * event of a crash, and write those traces to disk, stdout,
- * or any other file handle.
- *
- * modified to integrate closer into citadel by Wilfried Goesgens
- *
- * vim: ts=4
- *
- * 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.
- */
-
-#include "sysdep.h"
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <fcntl.h>
-#include <syslog.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <pthread.h>
-#include <libcitadel.h>
-#include "server.h"
-#include "sysdep_decls.h"
-#include "support.h"
-#include "config.h"
-#include "citserver.h"
-#include "ecrash.h"
-
-#define NIY() printf("function not implemented yet!\n");
-#ifdef HAVE_BACKTRACE
-#include <execinfo.h>
-static eCrashParameters gbl_params;
-
-static int gbl_backtraceEntries;
-static void **gbl_backtraceBuffer;
-static char **gbl_backtraceSymbols;
-static int gbl_backtraceDoneFlag = 0;
-
-static void *stack_frames[50];
-static size_t size, NThread;
-static char **strings;
-
-/*
- * Private structures for our thread list
- */
-typedef struct thread_list_node{
- char *threadName;
- pthread_t thread;
- int backtraceSignal;
- sighandler_t oldHandler;
- struct thread_list_node *Next;
-} ThreadListNode;
-
-static pthread_mutex_t ThreadListMutex = PTHREAD_MUTEX_INITIALIZER;
-static ThreadListNode *ThreadList = NULL;
-
-/*********************************************************************
- *********************************************************************
- ** P R I V A T E F U N C T I O N S
- *********************************************************************
- ********************************************************************/
-
-
-/*!
- * Insert a node into our threadList
- *
- * @param name Text string indicating our thread
- * @param thread Our Thread Id
- * @param signo Signal to create backtrace with
- * @param old_handler Our old handler for signo
- *
- * @returns zero on success
- */
-static int addThreadToList(char *name, pthread_t thread,int signo,
- sighandler_t old_handler)
-{
- ThreadListNode *node;
-
- node = malloc(sizeof(ThreadListNode));
- if (!node) return -1;
-
- DPRINTF(ECRASH_DEBUG_VERBOSE,
- "Adding thread 0x%08x (%s)\n", (unsigned int)thread, name);
- node->threadName = strdup(name);
- node->thread = thread;
- node->backtraceSignal = signo;
- node->oldHandler = old_handler;
-
- /* And, add it to the list */
- pthread_mutex_lock(&ThreadListMutex);
- node->Next = ThreadList;
- ThreadList = node;
- pthread_mutex_unlock(&ThreadListMutex);
-
- return 0;
-
-} // addThreadToList
-
-/*!
- * Remove a node from our threadList
- *
- * @param thread Our Thread Id
- *
- * @returns zero on success
- */
-static int removeThreadFromList(pthread_t thread)
-{
- ThreadListNode *Probe, *Prev=NULL;
- ThreadListNode *Removed = NULL;
-
- DPRINTF(ECRASH_DEBUG_VERBOSE,
- "Removing thread 0x%08x from list . . .\n", (unsigned int)thread);
- pthread_mutex_lock(&ThreadListMutex);
- for (Probe=ThreadList;Probe != NULL; Probe = Probe->Next) {
- if (Probe->thread == thread) {
- // We found it! Unlink it and move on!
- Removed = Probe;
- if (Prev == NULL) { // head of list
- ThreadList = Probe->Next;
- } else {
- // Prev != null, so we need to link around ourselves.
- Prev->Next = Probe->Next;
- }
- Removed->Next = NULL;
- break;
- }
-
- Prev = Probe;
- }
- pthread_mutex_unlock(&ThreadListMutex);
-
- // Now, if something is in Removed, free it, and return success
- if (Removed) {
- DPRINTF(ECRASH_DEBUG_VERBOSE,
- " Found %s -- removing\n", Removed->threadName);
- // Reset the signal handler
- signal(Removed->backtraceSignal, Removed->oldHandler);
-
- // And free the allocated memory
- free (Removed->threadName);
- free (Removed);
-
- return 0;
- } else {
- DPRINTF(ECRASH_DEBUG_VERBOSE,
- " Not Found\n");
- return -1; // Not Found
- }
-} // removeThreadFromList
-
-/*!
- * Print out a line of output to all our destinations
- *
- * One by one, output a line of text to all of our output destinations.
- *
- * Return failure if we fail to output to any of them.
- *
- * @param format Normal printf style vararg format
- *
- * @returns nothing// bytes written, or error on failure.
- */
-static void outputPrintf(char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
-
- vsyslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, format, ap);
-} // outputPrintf
-
-
-
-/*!
- * Dump our backtrace into a global location
- *
- * This function will dump out our backtrace into our
- * global holding area.
- *
- */
-static void createGlobalBacktrace( void )
-{
-
- size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
- for (NThread = 0; NThread < size; NThread++)
- {
- syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p ", stack_frames[NThread]);
- }
- strings = backtrace_symbols(stack_frames, size);
- for (NThread = 0; NThread < size; NThread++) {
- if (strings != NULL) {
- syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p ", strings[NThread]);
- }
- }
-} /* createGlobalBacktrace */
-static void outputRawtrace( void )
-{
-
- size = backtrace(stack_frames, sizeof(stack_frames) / sizeof(void*));
- for (NThread = 0; NThread < size; NThread++)
- {
- syslog(LOG_CRIT|LOG_NDELAY|LOG_MAIL, "RAW: %p ", stack_frames[NThread]);
- }
-} /* createGlobalBacktrace */
-
-/*!
- * Print out (to all the fds, etc), or global backtrace
- */
-static void outputGlobalBacktrace ( void )
-{
- int i;
-
- for (i=0; i < gbl_backtraceEntries; i++) {
- if (gbl_backtraceSymbols != FALSE) {
- outputPrintf("* Frame %02x: %s\n",
- i, gbl_backtraceSymbols[i]);
- } else {
- outputPrintf("* Frame %02x: %p\n", i,
- gbl_backtraceBuffer[i]);
- }
- }
-} // outputGlobalBacktrace
-
-/*!
- * Output our current stack's backtrace
- */
-static void outputBacktrace( void )
-{
- createGlobalBacktrace();
- outputGlobalBacktrace();
-} /* outputBacktrace */
-
-static void outputBacktraceThreads( void )
-{
- ThreadListNode *probe;
- int i;
-
- // When we're backtracing, don't worry about the mutex . . hopefully
- // we're in a safe place.
-
- for (probe=ThreadList; probe; probe=probe->Next) {
- gbl_backtraceDoneFlag = 0;
- pthread_kill(probe->thread, probe->backtraceSignal);
- for (i=0; i < gbl_params.threadWaitTime; i++) {
- if (gbl_backtraceDoneFlag)
- break;
- sleep(1);
- }
- if (gbl_backtraceDoneFlag) {
- outputPrintf("* Backtrace of \"%s\" (0x%08x)\n",
- probe->threadName, (unsigned int)probe->thread);
- outputGlobalBacktrace();
- } else {
- outputPrintf("* Error: unable to get backtrace of \"%s\" (0x%08x)\n",
- probe->threadName, (unsigned int)probe->thread);
- }
- outputPrintf("*\n");
- }
-} // outputBacktraceThreads
-
-
-/*!
- * Handle signals (crash signals)
- *
- * This function will catch all crash signals, and will output the
- * crash dump.
- *
- * It will physically write (and sync) the current thread's information
- * before it attempts to send signals to other threads.
- *
- * @param signum Signal received.
- */
-static void crash_handler(int signo)
-{
- outputRawtrace();
- outputPrintf("*********************************************************\n");
- outputPrintf("* eCrash Crash Handler\n");
- outputPrintf("*********************************************************\n");
- outputPrintf("*\n");
- outputPrintf("* Got a crash! signo=%d\n", signo);
- outputPrintf("*\n");
- outputPrintf("* Offending Thread's Backtrace:\n");
- outputPrintf("*\n");
- outputBacktrace();
- outputPrintf("*\n");
-
- if (gbl_params.dumpAllThreads != FALSE) {
- outputBacktraceThreads();
- }
-
- outputPrintf("*\n");
- outputPrintf("*********************************************************\n");
- outputPrintf("* eCrash Crash Handler\n");
- outputPrintf("*********************************************************\n");
-
- exit(signo);
-} // crash_handler
-
-/*!
- * Handle signals (bt signals)
- *
- * This function shoudl be called to generate a crashdump into our
- * global area. Once the dump has been completed, this function will
- * return after tickling a global. Since mutexes are not async
- * signal safe, the main thread, after signaling us to generate our
- * own backtrace, will sleep for a few seconds waiting for us to complete.
- *
- * @param signum Signal received.
- */
-static void bt_handler(int signo)
-{
- createGlobalBacktrace();
- gbl_backtraceDoneFlag=1;
-} // bt_handler
-
-/*!
- * Validate a passed-in symbol table
- *
- * For now, just print it out (if verbose), and make sure it's
- * sorted and none of the pointers are zero.
- */
-static int ValidateSymbolTable( void )
-{
- int i;
- int rc=0;
- unsigned long lastAddress =0;
-
- // Get out of here if the table is empty
- if (!gbl_params.symbolTable) return 0;
-
- // Dump it in verbose mode
- DPRINTF(ECRASH_DEBUG_VERBOSE,
- "Symbol Table Provided with %d symbols\n",
- gbl_params.symbolTable->numSymbols);
- for (i=0; i < gbl_params.symbolTable->numSymbols; i++){
- // Dump it in verbose mode
- DPRINTF(ECRASH_DEBUG_VERBOSE,
- "%-30s %p\n",
- gbl_params.symbolTable->symbols[i].function,
- gbl_params.symbolTable->symbols[i].address);
- if (lastAddress >
- (unsigned long)gbl_params.symbolTable->symbols[i].address) {
- DPRINTF(ECRASH_DEBUG_ERROR,
- "Error: symbol table is not sorted (last=%p, current=%p)\n",
- (void *)lastAddress,
- gbl_params.symbolTable->symbols[i].address);
- rc = -1;
- }
-
- } // for
-
- return rc;
-
-} // ValidateSymbolTable
-
-/*********************************************************************
- *********************************************************************
- ** P U B L I C F U N C T I O N S
- *********************************************************************
- ********************************************************************/
-
-/*!
- * Initialize eCrash.
- *
- * This function must be called before calling any other eCrash
- * functions. It sets up the global behavior of the system, and
- * registers the calling thread for crash dumps.
- *
- * @param params Our input parameters. The passed in structure will be copied.
- *
- * @return Zero on success.
- */
-int eCrash_Init(eCrashParameters *params)
-{
- int sigIndex;
- int ret = 0;
-#ifdef DO_SIGNALS_RIGHT
- sigset_t blocked;
- struct sigaction act;
-#endif
-
- DPRINTF(ECRASH_DEBUG_VERY_VERBOSE,"Init Starting params = %p\n", params);
-
- if (params == NULL) return -1;
- // Allocate our backtrace area
- gbl_backtraceBuffer = malloc(sizeof(void *) * (params->maxStackDepth+5));
-
-#ifdef DO_SIGNALS_RIGHT
- sigemptyset(&blocked);
- act.sa_sigaction = crash_handler;
- act.sa_mask = blocked;
- act.sa_flags = SA_SIGINFO;
-#endif
-
- if (params != NULL) {
- // Make ourselves a global copy of params.
- gbl_params = *params;
- gbl_params.filename = strdup(params->filename);
-
- // Set our defaults, if they weren't specified
- if (gbl_params.maxStackDepth == 0 )
- gbl_params.maxStackDepth = ECRASH_DEFAULT_STACK_DEPTH;
-
- if (gbl_params.defaultBacktraceSignal == 0 )
- gbl_params.defaultBacktraceSignal = ECRASH_DEFAULT_BACKTRACE_SIGNAL;
-
- if (gbl_params.threadWaitTime == 0 )
- gbl_params.threadWaitTime = ECRASH_DEFAULT_THREAD_WAIT_TIME;
-
- if (gbl_params.debugLevel == 0 )
- gbl_params.debugLevel = ECRASH_DEBUG_DEFAULT;
-
- // Copy our symbol table
- if (gbl_params.symbolTable) {
- DPRINTF(ECRASH_DEBUG_VERBOSE,
- "symbolTable @ %p -- %d symbols\n", gbl_params.symbolTable,
- gbl_params.symbolTable->numSymbols);
- // Make a copy of our symbol table
- gbl_params.symbolTable = malloc(sizeof(eCrashSymbolTable));
- memcpy(gbl_params.symbolTable, params->symbolTable,
- sizeof(eCrashSymbolTable));
-
- // Now allocate / copy the actual table.
- gbl_params.symbolTable->symbols = malloc(sizeof(eCrashSymbol) *
- gbl_params.symbolTable->numSymbols);
- memcpy(gbl_params.symbolTable->symbols,
- params->symbolTable->symbols,
- sizeof(eCrashSymbol) * gbl_params.symbolTable->numSymbols);
-
- ValidateSymbolTable();
- }
-
- // And, finally, register for our signals
- for (sigIndex=0; gbl_params.signals[sigIndex] != 0; sigIndex++) {
- DPRINTF(ECRASH_DEBUG_VERY_VERBOSE,
- " Catching signal[%d] %d\n", sigIndex,
- gbl_params.signals[sigIndex]);
-
- // I know there's a better way to catch signals with pthreads.
- // I'll do it later TODO
- signal(gbl_params.signals[sigIndex], crash_handler);
- }
- } else {
- DPRINTF(ECRASH_DEBUG_ERROR, " Error: Null Params!\n");
- ret = -1;
- }
- DPRINTF(ECRASH_DEBUG_VERY_VERBOSE, "Init Complete ret=%d\n", ret);
- return ret;
-} /* eCrash_Init */
-
-/*!
- * UnInitialize eCrash.
- *
- * This function may be called to de-activate eCrash, release the
- * signal handlers, and free any memory allocated by eCrash.
- *
- * @return Zero on success.
- */
-int eCrash_Uninit( void )
-{
- NIY();
-
- return 0;
-} /* eCrash_Uninit */
-
-/*!
- * Register a thread for backtracing on crash.
- *
- * This function must be called by any thread wanting it's stack
- * dumped in the event of a crash. The thread my specify what
- * signal should be used, or the default, SIGUSR1 will be used.
- *
- * @param signo Signal to use to generate dump (default: SIGUSR1)
- *
- * @return Zero on success.
- */
-int eCrash_RegisterThread(char *name, int signo)
-{
- sighandler_t old_handler;
-
- // Register for our signal
- if (signo == 0) {
- signo = gbl_params.defaultBacktraceSignal;
- }
-
- old_handler = signal(signo, bt_handler);
- return addThreadToList(name, pthread_self(), signo, old_handler);
-
-} /* eCrash_RegisterThread */
-
-/*!
- * Un-register a thread for stack dumps.
- *
- * This function may be called to un-register any previously
- * registered thread.
- *
- * @return Zero on success.
- */
-int eCrash_UnregisterThread( void )
-{
- return removeThreadFromList(pthread_self());
-} /* eCrash_UnregisterThread */
-
-#endif
+++ /dev/null
-/*
- * eCrash.h
- * David Frascone
- *
- * eCrash types and prototypes.
- *
- * vim: ts=4
- */
-
-#ifndef _ECRASH_H_
-#define _ECRASH_H_
-
-#include <stdio.h>
-#include <signal.h>
-
-typedef void (*sighandler_t)(int);
-
-typedef long BOOL;
-
-#define MAX_LINE_LEN 256
-
-#ifndef TRUE
-#define TRUE 1
-#define FALSE 0
-#define BOOL int
-#endif
-
-#define ECRASH_DEFAULT_STACK_DEPTH 10
-#define ECRASH_DEFAULT_BACKTRACE_SIGNAL SIGUSR2
-#define ECRASH_DEFAULT_THREAD_WAIT_TIME 10
-#define ECRASH_MAX_NUM_SIGNALS 30
-
-/** \struct eCrashSymbol
- * \brief Function Name / Address pair
- *
- * This is used in conjunction with eCrashSymbolTable to
- * provide an alternative to backtrace_symbols.
- */
-typedef struct {
- char *function;
- void *address;
-} eCrashSymbol;
-/** \struct eCrashSymbolTable
- * \brief Symbol table used to avoid backtrace_symbols()
- *
- * This structure is used to provide a alternative to
- * backtrace_symbols which is not async signal safe.
- *
- * The symbol table should be sorted by address (it will
- * be either binary or linearly searched)
- */
-typedef struct {
- int numSymbols;
- eCrashSymbol *symbols;
-} eCrashSymbolTable;
-
-
-
-#define ECRASH_DEBUG_ENABLE /* undef to turn off debug */
-
-#ifdef ECRASH_DEBUG_ENABLE
-# define ECRASH_DEBUG_VERY_VERBOSE 1
-# define ECRASH_DEBUG_VERBOSE 2
-# define ECRASH_DEBUG_INFO 3
-# define ECRASH_DEBUG_WARN 4
-# define ECRASH_DEBUG_ERROR 5
-# define ECRASH_DEBUG_OFF 6
-# define ECRASH_DEBUG_DEFAULT (ECRASH_DEBUG_ERROR)
-# define DPRINTF(level, fmt...) \
- if (level >= gbl_params.debugLevel) { printf(fmt); fflush(stdout); }
-#else /* ECRASH_DEBUG_ENABLE */
-# define DPRINTF(level, fmt...)
-#endif /* ECRASH_DEBUG_ENABLE */
-
-
-/** \struct eCrashParameters
- * \brief eCrash Initialization Parameters
- *
- * This structure contains all the global initialization functions
- * for eCrash.
- *
- * @see eCrash_Init
- */
-typedef struct {
-
-
- /* OUTPUT OPTIONS */
- /** Filename to output to, or NULL */
- char *filename;
- /** FILE * to output to or NULL */
- FILE *filep;
- /** fd to output to or -1 */
- int fd;
-
- int debugLevel;
-
- /** If true, all registered threads will
- * be dumped
- */
- BOOL dumpAllThreads;
-
- /** How far to backtrace each stack */
- unsigned int maxStackDepth;
-
- /** Default signal to use to tell a thread to drop it's
- * stack.
- */
- int defaultBacktraceSignal;
-
- /** How long to wait for a threads
- * dump
- */
- unsigned int threadWaitTime;
-
- /** If this is non-zero, the dangerous function, backtrace_symbols
- * will be used. That function does a malloc(), so is not async
- * signal safe, and could cause deadlocks.
- */
- BOOL useBacktraceSymbols;
-
- /** To avoid the issues with backtrace_symbols (see comments above)
- * the caller can supply it's own symbol table, containing function
- * names and start addresses. This table can be created using
- * a script, or a static table.
- *
- * If this variable is not null, it will be used, instead of
- * backtrace_symbols, reguardless of the setting
- * of useBacktraceSymbols.
- */
- eCrashSymbolTable *symbolTable;
-
- /** Array of crash signals to catch,
- * ending in 0 I would have left it a [] array, but I
- * do a static copy, so I needed a set size.
- */
- int signals[ECRASH_MAX_NUM_SIGNALS];
-
-} eCrashParameters;
-
-/*!
- * Initialize eCrash.
- *
- * This function must be called before calling any other eCrash
- * functions. It sets up the global behavior of the system.
- *
- * @param params Our input parameters. The passed in structure will be copied.
- *
- * @return Zero on success.
- */
-int eCrash_Init(eCrashParameters *params);
-/*!
- * UnInitialize eCrash.
- *
- * This function may be called to de-activate eCrash, release the
- * signal handlers, and free any memory allocated by eCrash.
- *
- * @return Zero on success.
- */
-int eCrash_Uninit( void );
-
-/*!
- * Register a thread for backtracing on crash.
- *
- * This function must be called by any thread wanting it's stack
- * dumped in the event of a crash. The thread my specify what
- * signal should be used, or the default, SIGUSR1 will be used.
- *
- * @param name String used to refer to us in crash dumps
- * @param signo Signal to use to generate dump (default: SIGUSR1)
- *
- * @return Zero on success.
- */
-int eCrash_RegisterThread(char *name, int signo);
-
-/*!
- * Un-register a thread for stack dumps.
- *
- * This function may be called to un-register any previously
- * registered thread.
- *
- * @return Zero on success.
- */
-int eCrash_UnregisterThread( void );
-
-#endif /* _E_CRASH_H_ */
smtp_handler_hook *h;
if (FLen >= MaxSMTPCmdLen)
- cit_panic_backtrace (0);
+ {
+ abort();
+ }
h = (smtp_handler_hook*) malloc(sizeof(smtp_handler_hook));
memset(h, 0, sizeof(smtp_handler_hook));
if (sSMTP == NULL) {
syslog(LOG_EMERG, "Session SMTP data is null. WTF? We will crash now.");
- return cit_panic_backtrace (0);
+ abort();
}
time(&CCC->lastcmd);
if (!CM_IsValidMsg(TheMessage)) {
syslog(LOG_ERR, "msgbase: error; invalid preloaded message for output");
- cit_backtrace ();
return(om_no_such_msg);
}
#include "serv_extensions.h"
#include "citadel_dirs.h"
#include "user_ops.h"
-#include "ecrash.h"
uid_t ctdluid = 0;
const char *CitadelServiceUDS="citadel-UDS";
struct passwd *p = NULL;
#ifdef HAVE_RUN_DIR
struct stat filestats;
-#endif
-#ifdef HAVE_BACKTRACE
- eCrashParameters params;
-// eCrashSymbolTable symbol_table;
#endif
/* initialize the master context */
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
fprintf(fd, "Sending: BufSize: %d BufContent: [", nbytes);
}
} else {
syslog(LOG_ERR, "sysdep: client_write(%d bytes) select failed: %m", nbytes - bytes_written);
- cit_backtrace();
client_close();
Ctx->kill_me = KILLME_SELECT_FAILED;
return -1;
retval = write(Ctx->client_socket, &buf[bytes_written], nbytes - bytes_written);
if (retval < 1) {
syslog(LOG_ERR, "sysdep: client_write(%d bytes) failed: %m", nbytes - bytes_written);
- cit_backtrace();
client_close();
Ctx->kill_me = KILLME_WRITE_FAILED;
return -1;
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
fprintf(fd, "Reading BLOB: BufSize: %d ", bytes);
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
fprintf(fd, "Read: %d BufContent: [", StrLength(Target));
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
fprintf(fd, "Reading BLOB: BufSize: %d ",
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
fprintf(fd, "Read: %d BufContent: [",
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
fprintf(fd, "Read: BufSize: %d BufContent: [",
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
pch = ChrPtr(CCC->RecvBuf.Buf);
fd = fopen(fn, "a+");
if (fd == NULL) {
syslog(LOG_ERR, "%s: %m", fn);
- cit_backtrace();
exit(1);
}
pch = ChrPtr(CCC->RecvBuf.Buf);
CtdlDestroyServiceHook();
CtdlDestroyRoomHooks();
CtdlDestroySearchHooks();
- #ifdef HAVE_BACKTRACE
-/// eCrash_Uninit();
- #endif
}
if (len >= USERNAME_SIZE)
{
syslog(LOG_INFO, "Username too long: %s", username);
- cit_backtrace ();
len = USERNAME_SIZE - 1;
username[len]='\0';
}
if (len >= USERNAME_SIZE)
{
syslog(LOG_INFO, "Username too long: %s", username);
- cit_backtrace ();
len = USERNAME_SIZE - 1;
}
for (i=0; i<=len; ++i) {
* 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-2016 citadel.org
+ * Copyright (c) 2009-2018 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.
#include "sysdep.h"
#include "config.h"
#include "citadel_dirs.h"
-#if HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
/*
* Citadel setup utility
*
- * Copyright (c) 1987-2017 by the citadel.org team
+ * Copyright (c) 1987-2018 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.
#include "axdefs.h"
#include "sysdep.h"
#include "citadel_dirs.h"
-#if HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
#ifdef ENABLE_NLS
#ifdef HAVE_XLOCALE_H
distclean: clean
rm -f Makefile config.cache config.log config.status \
po/webcit/Makefile \
+ ical_maps.c \
$(srcdir)/TAGS
setup: setup.o gettext.o
paramhandling.o utils.o ical_maps.o ical_subst.o static.o feed_generator.o \
$(LIBS)
+ical_maps.c: scripts/get_ical_data.sh
+ sh scripts/get_ical_data.sh
+
%.o: %.c ${HEADERS}
echo "CC $<"
$(CC) $(CFLAGS) $(DEFS) $(PTHREAD_DEFS) -c -o $@ $<
# Remove any vestiges of pre-6.05 build environments
rm -f .libs modules *.so *.lo *.la 2>/dev/null
-if ./scripts/get_ical_data.sh; then
-
- echo ... running aclocal ...
- aclocal
+echo ... running aclocal ...
+aclocal
- echo ... running autoconf ...
- autoconf
+echo ... running autoconf ...
+autoconf
# If your autoconf version changes, the autom4te.cache stuff will mess you up.
# Get rid of it.
- echo ... removing autoheader cache files ...
- rm -rf autom4te*.cache
+echo ... removing autoheader cache files ...
+rm -rf autom4te*.cache
- echo ... running autoheader ...
- autoheader
+echo ... running autoheader ...
+autoheader
- echo ... mk_module_init.sh ...
- ./scripts/mk_module_init.sh
+echo ... mk_module_init.sh ...
+./scripts/mk_module_init.sh
- echo
- echo This script has been tested with autoconf 2.53 and
- echo automake 1.5. Other versions may work, but I recommend the latest
- echo compatible versions of these.
- echo
- echo Also note that autoconf and automake should be configured
- echo with the same prefix.
- echo
-fi
+echo
+echo This script has been tested with autoconf 2.53 and
+echo automake 1.5. Other versions may work, but I recommend the latest
+echo compatible versions of these.
+echo
+echo Also note that autoconf and automake should be configured
+echo with the same prefix.
+echo
grep '^#define CLIENT_VERSION' webcit.h | sed 's/[^0-9]*//g' >package-version.txt
CtxType CTX_ICALTIME = CTX_NONE;
CtxType CTX_ICALATTENDEE = CTX_NONE;
CtxType CTX_ICALCONFLICT = CTX_NONE;
-#if 0
-void SortPregetMatter(HashList *Cals)
-{
- disp_cal *Cal;
- void *vCal;
- const char *Key;
- long KLen;
- IcalEnumMap *SortMap[10];
- IcalEnumMap *Map;
- void *vSort;
- const char *Next = NULL;
- const StrBuf *SortVector;
- StrBuf *SortBy;
- int i = 0;
- HashPos *It;
-
- SortVector = SBSTR("ICALSortVec");
- if (SortVector == NULL)
- return;
-
- for (i = 0; i < 10; i++) SortMap[i] = NULL;
- SortBy = NewStrBuf();
- while (StrBufExtract_NextToken(SortBy, SortVector, &Next, ':') > 0) {
- GetHash(IcalComponentMap, SKEY(SortBy), &vSort);
- Map = (IcalEnumMap*) vSort;
- SortMap[i] = Map;
- i++;
- if (i > 9)
- break;
- }
-
- if (i == 0)
- return;
-
- switch (SortMap[i - 1]->map) {
- /* case */
-
- default:
- break;
- }
-
- It = GetNewHashPos(Cals, 0);
- while (GetNextHashPos(Cals, It, &KLen, &Key, &vCal)) {
- i = 0;
- Cal = (disp_cal*) vCal;
- Cal->Status = icalcomponent_get_status(Cal->cal);
- Cal->SortBy = Cal->cal;
-
-
- while ((SortMap[i] != NULL) &&
- (Cal->SortBy != NULL))
- {
- /****Cal->SortBy = icalcomponent_get_first_property(Cal->SortBy, SortMap[i++]->map); */
- }
- }
-}
-#endif
-
void tmplput_ICalItem(StrBuf *Target, WCTemplputParams *TP)
{
#!/bin/sh
+
+echo Running $0
+
+
ICAL=/usr/local/ctdlsupport/include/libical/ical.h
if test -f /usr/include/libical/ical.h; then
ICAL=/usr/include/libical/ical.h