/*****************************************************************************/
#include "sysdep.h"
-#include <stdlib.h>
-#include <unistd.h>
#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#include <dirent.h>
-#include <syslog.h>
#include <zlib.h>
#ifdef HAVE_DB_H
#include <libcitadel.h>
-#include "citadel.h"
-#include "server.h"
-#include "citserver.h"
-#include "database.h"
-#include "msgbase.h"
-#include "sysdep_decls.h"
-#include "threads.h"
-#include "config.h"
-#include "control.h"
#include "ctdl_module.h"
+#include "control.h"
+#include "citserver.h"
static DB *dbp[MAXCDB]; /* One DB handle for each Citadel database */
#define DBGLOG(LEVEL) if ((LEVEL != LOG_DEBUG) || (SeentDebugEnabled != 0))
#define SEENM_syslog(LEVEL, FORMAT) \
DBGLOG(LEVEL) syslog(LEVEL, \
- "IO[%ld]CC[%ld] SEEN[%s][%d] " FORMAT, \
- ioid, ccid, Facility, cType)
+ "%s[%ld]CC[%ld] SEEN[%s][%d] " FORMAT, \
+ IOSTR, ioid, ccid, Facility, cType)
time_t CheckIfAlreadySeen(const char *Facility,
StrBuf *guid,
{
SEENM_syslog(LOG_DEBUG, "Loading");
cdbut = cdb_fetch(CDB_USETABLE, SKEY(guid));
- if (cdbut != NULL) {
+ if ((cdbut != NULL) && (cdbut->ptr != NULL)) {
memcpy(&ut, cdbut->ptr,
((cdbut->len > sizeof(struct UseTable)) ?
sizeof(struct UseTable) : cdbut->len));
}
else
{
+ if (cdbut) cdb_free(cdbut);
+
SEENM_syslog(LOG_DEBUG, "not Found");
}