This is a step towards the coding convention listed on the web site.
/*
- * lprintf() ... Write logging information;
+ * CtdlLogPrintf() ... Write logging information;
* simple here to have the same
* symbols in the client.
*/
enum LogLevel {CTDL_EMERG};
-void lprintf(enum LogLevel loglevel, const char *format, ...) {
+void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...) {
va_list arg_ptr;
va_start(arg_ptr, format);
#define FILTERLIST "application/x-citadel-filter-list"
#define SIEVECONFIG "application/x-citadel-sieve-config"
-#define TRACE lprintf(CTDL_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
+#define TRACE CtdlLogPrintf(CTDL_DEBUG, "Checkpoint: %s, %d\n", __FILE__, __LINE__)
#ifndef LONG_MAX
#define LONG_MAX 2147483647L
strings = backtrace_symbols(stack_frames, size);
for (i = 0; i < size; i++) {
if (strings != NULL)
- lprintf(1, "%s\n", strings[i]);
+ CtdlLogPrintf(1, "%s\n", strings[i]);
else
- lprintf(1, "%p\n", stack_frames[i]);
+ CtdlLogPrintf(1, "%p\n", stack_frames[i]);
}
free(strings);
#endif
strings = backtrace_symbols(stack_frames, size);
for (i = 0; i < size; i++) {
if (strings != NULL)
- lprintf(1, "%s\n", strings[i]);
+ CtdlLogPrintf(1, "%s\n", strings[i]);
else
- lprintf(1, "%p\n", stack_frames[i]);
+ CtdlLogPrintf(1, "%p\n", stack_frames[i]);
}
free(strings);
#endif
FILE *urandom;
struct ctdlroom qrbuf;
- lprintf(CTDL_DEBUG, "master_startup() started\n");
+ CtdlLogPrintf(CTDL_DEBUG, "master_startup() started\n");
time(&server_startup_time);
- lprintf(CTDL_INFO, "Opening databases\n");
+ CtdlLogPrintf(CTDL_INFO, "Opening databases\n");
open_databases();
ctdl_thread_internal_init_tsd();
check_ref_counts();
- lprintf(CTDL_INFO, "Creating base rooms (if necessary)\n");
+ CtdlLogPrintf(CTDL_INFO, "Creating base rooms (if necessary)\n");
create_room(config.c_baseroom, 0, "", 0, 1, 0, VIEW_BBS);
create_room(AIDEROOM, 3, "", 0, 1, 0, VIEW_BBS);
create_room(SYSCONFIGROOM, 3, "", 0, 1, 0, VIEW_BBS);
lputroom(&qrbuf);
}
- lprintf(CTDL_INFO, "Seeding the pseudo-random number generator...\n");
+ CtdlLogPrintf(CTDL_INFO, "Seeding the pseudo-random number generator...\n");
urandom = fopen("/dev/urandom", "r");
if (urandom != NULL) {
fread(&seed, sizeof seed, 1, urandom);
}
srandom(seed);
- lprintf(CTDL_INFO, "Initializing ipgm secret\n");
+ CtdlLogPrintf(CTDL_INFO, "Initializing ipgm secret\n");
get_config();
config.c_ipgm_secret = rand();
put_config();
- lprintf(CTDL_DEBUG, "master_startup() finished\n");
+ CtdlLogPrintf(CTDL_DEBUG, "master_startup() finished\n");
}
sysdep_master_cleanup();
/* Close databases */
- lprintf(CTDL_INFO, "Closing databases\n");
+ CtdlLogPrintf(CTDL_INFO, "Closing databases\n");
close_databases();
#ifdef DEBUG_MEMORY_LEAKS
/* If the operator requested a halt but not an exit, halt here. */
if (shutdown_and_halt) {
- lprintf(CTDL_NOTICE, "citserver: Halting server without exiting.\n");
+ CtdlLogPrintf(CTDL_NOTICE, "citserver: Halting server without exiting.\n");
fflush(stdout); fflush(stderr);
while(1) {
sleep(32767);
release_control();
/* Now go away. */
- lprintf(CTDL_NOTICE, "citserver: Exiting with status %d\n", exitcode);
+ CtdlLogPrintf(CTDL_NOTICE, "citserver: Exiting with status %d\n", exitcode);
fflush(stdout); fflush(stderr);
if (restart_server != 0)
void RemoveContext (struct CitContext *con)
{
if (con==NULL) {
- lprintf(CTDL_ERR,
+ CtdlLogPrintf(CTDL_ERR,
"WARNING: RemoveContext() called with NULL!\n");
return;
}
- lprintf(CTDL_DEBUG, "RemoveContext() session %d\n", con->cs_pid);
+ CtdlLogPrintf(CTDL_DEBUG, "RemoveContext() session %d\n", con->cs_pid);
/* Run any cleanup routines registered by loadable modules.
* Note: We have to "become_session()" because the cleanup functions
PerformSessionHooks(EVT_STOP);
become_session(NULL);
- lprintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
+ CtdlLogPrintf(CTDL_NOTICE, "[%3d] Session ended.\n", con->cs_pid);
/* If the client is still connected, blow 'em away. */
- lprintf(CTDL_DEBUG, "Closing socket %d\n", con->client_socket);
+ CtdlLogPrintf(CTDL_DEBUG, "Closing socket %d\n", con->client_socket);
close(con->client_socket);
- lprintf(CTDL_DEBUG, "Done with RemoveContext()\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Done with RemoveContext()\n");
}
*/
if (stat(public_clients_file, &statbuf) != 0) {
/* No public_clients file exists, so bail out */
- lprintf(CTDL_WARNING, "Warning: '%s' does not exist\n",
+ CtdlLogPrintf(CTDL_WARNING, "Warning: '%s' does not exist\n",
public_clients_file);
return(0);
}
if (statbuf.st_mtime > pc_timestamp) {
begin_critical_section(S_PUBLIC_CLIENTS);
- lprintf(CTDL_INFO, "Loading %s\n", public_clients_file);
+ CtdlLogPrintf(CTDL_INFO, "Loading %s\n", public_clients_file);
public_clientspos = &public_clients[0];
public_clientsend = public_clientspos + SIZ;
end_critical_section(S_PUBLIC_CLIENTS);
}
- lprintf(CTDL_DEBUG, "Checking whether %s is a local or public client\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Checking whether %s is a local or public client\n",
CC->cs_addr);
for (i=0; i<num_parms(public_clients); ++i) {
extract_token(addrbuf, public_clients, i, '|', sizeof addrbuf);
if (!strcasecmp(CC->cs_addr, addrbuf)) {
- lprintf(CTDL_DEBUG, "... yes it is.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "... yes it is.\n");
return(1);
}
}
/* No hits. This is not a public client. */
- lprintf(CTDL_DEBUG, "... no it isn't.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "... no it isn't.\n");
return(0);
}
}
if (do_lookup) {
- lprintf(CTDL_DEBUG, "Looking up hostname '%s'\n", from_host);
+ CtdlLogPrintf(CTDL_DEBUG, "Looking up hostname '%s'\n", from_host);
if ((addr.s_addr = inet_addr(from_host)) != -1) {
locate_host(CC->cs_host, sizeof CC->cs_host,
CC->cs_addr, sizeof CC->cs_addr,
}
}
- lprintf(CTDL_NOTICE, "Client %d/%d/%01d.%02d (%s) from %s\n",
+ CtdlLogPrintf(CTDL_NOTICE, "Client %d/%d/%01d.%02d (%s) from %s\n",
dev_code,
cli_code,
(rev_level / 100),
return;
}
- lprintf(CTDL_DEBUG, "Locating session to kill\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Locating session to kill\n");
begin_critical_section(S_SESSION_TABLE);
for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
if (session_num == ccptr->cs_pid) {
sleep(5);
cprintf("%d Authentication failed.\n",
ERROR + PASSWORD_REQUIRED);
- lprintf(CTDL_ERR, "Warning: ipgm authentication failed.\n");
+ CtdlLogPrintf(CTDL_ERR, "Warning: ipgm authentication failed.\n");
CC->kill_me = 1;
}
Reply = "%d Restarting server. See you soon.\n";
if ((restart_server > 0) && !running_as_daemon)
{
- lprintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
+ CtdlLogPrintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
Reply = "%d Warning, not running in deamon mode. maybe we will come up again, but don't lean on it.\n";
state = ERROR;
}
restart_server = 1;
if (!running_as_daemon)
{
- lprintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
+ CtdlLogPrintf(CTDL_ERR, "The user requested restart, but not running as deamon! Geronimooooooo!\n");
Reply = "%d %d Warning, not running in deamon mode. maybe we will come up again, but don't lean on it.\n";
state = ERROR;
}
}
if (!CC->is_local_socket) {
- lprintf(CTDL_NOTICE, "Session started from %s [%s].\n", con->cs_host, con->cs_addr);
+ CtdlLogPrintf(CTDL_NOTICE, "Session started from %s [%s].\n", con->cs_host, con->cs_addr);
}
else {
- lprintf(CTDL_NOTICE, "Session started via local socket.\n");
+ CtdlLogPrintf(CTDL_NOTICE, "Session started via local socket.\n");
}
/* Run any session startup routines registered by loadable modules */
time(&CC->lastcmd);
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
- lprintf(CTDL_ERR, "Client disconnected: ending session.\n");
+ CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\n");
CC->kill_me = 1;
CtdlThreadName(old_name);
return;
/* Log the server command, but don't show passwords... */
if ( (strncasecmp(cmdbuf, "PASS", 4))
&& (strncasecmp(cmdbuf, "SETP", 4)) ) {
- lprintf(CTDL_INFO, "%s\n", cmdbuf);
+ CtdlLogPrintf(CTDL_INFO, "%s\n", cmdbuf);
}
else {
- lprintf(CTDL_INFO, "<password command sent>\n");
+ CtdlLogPrintf(CTDL_INFO, "<password command sent>\n");
}
buffer_output();
if (pse) {
sin.sin_port = pse->s_port;
} else if ((sin.sin_port = htons((u_short) atoi(service))) == 0) {
- lprintf(CTDL_CRIT, "Can't get %s service entry: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "Can't get %s service entry: %s\n",
service, strerror(errno));
return(-1);
}
if (phe) {
memcpy(&sin.sin_addr, phe->h_addr, phe->h_length);
} else if ((sin.sin_addr.s_addr = inet_addr(host)) == INADDR_NONE) {
- lprintf(CTDL_ERR, "Can't get %s host entry: %s\n",
+ CtdlLogPrintf(CTDL_ERR, "Can't get %s host entry: %s\n",
host, strerror(errno));
return(-1);
}
if ((ppe = getprotobyname(protocol)) == 0) {
- lprintf(CTDL_CRIT, "Can't get %s protocol entry: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "Can't get %s protocol entry: %s\n",
protocol, strerror(errno));
return(-1);
}
s = socket(PF_INET, type, ppe->p_proto);
if (s < 0) {
- lprintf(CTDL_CRIT, "Can't create socket: %s\n", strerror(errno));
+ CtdlLogPrintf(CTDL_CRIT, "Can't create socket: %s\n", strerror(errno));
return(-1);
}
/* Now try to connect to the remote host. */
if (connect(s, (struct sockaddr *) &sin, sizeof(sin)) < 0) {
- lprintf(CTDL_ERR, "Can't connect to %s:%s: %s\n",
+ CtdlLogPrintf(CTDL_ERR, "Can't connect to %s:%s: %s\n",
host, service, strerror(errno));
close(s);
return(-1);
retval = select(sock+1, &rfds, NULL, NULL, &tv);
if (FD_ISSET(sock, &rfds) == 0) { /* timed out */
- lprintf(CTDL_ERR, "sock_read() timed out.\n");
+ CtdlLogPrintf(CTDL_ERR, "sock_read() timed out.\n");
return(-1);
}
rlen = read(sock, &buf[len], bytes-len);
if (rlen<1) {
- lprintf(CTDL_ERR, "sock_read() failed: %s\n",
+ CtdlLogPrintf(CTDL_ERR, "sock_read() failed: %s\n",
strerror(errno));
return(-1);
}
*/
if (flock(fileno(control_fp), (LOCK_EX | LOCK_NB))) {
- lprintf(CTDL_EMERG, "citserver: unable to lock %s.\n", file_citadel_control);
- lprintf(CTDL_EMERG, "Is another citserver already running?\n");
+ CtdlLogPrintf(CTDL_EMERG, "citserver: unable to lock %s.\n", file_citadel_control);
+ CtdlLogPrintf(CTDL_EMERG, "Is another citserver already running?\n");
exit(CTDLEXIT_CONTROL);
}
#endif
}
}
if (control_fp == NULL) {
- lprintf(CTDL_ALERT, "ERROR opening %s: %s\n",
+ CtdlLogPrintf(CTDL_ALERT, "ERROR opening %s: %s\n",
file_citadel_control,
strerror(errno));
return;
/* Verbose logging callback */
void cdb_verbose_log(const DB_ENV *dbenv, const char *msg)
{
- lprintf(CTDL_DEBUG, "BDB: %s\n", msg);
+ CtdlLogPrintf(CTDL_DEBUG, "BDB: %s\n", msg);
}
/* Verbose logging callback */
void cdb_verbose_err(const DB_ENV *dbenv, const char *errpfx, const char *msg)
{
- lprintf(CTDL_ALERT, "BDB: %s\n", msg);
+ CtdlLogPrintf(CTDL_ALERT, "BDB: %s\n", msg);
}
ret = tid->abort(tid);
if (ret) {
- lprintf(CTDL_EMERG, "cdb_*: txn_abort: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: txn_abort: %s\n",
db_strerror(ret));
abort();
}
ret = tid->commit(tid, 0);
if (ret) {
- lprintf(CTDL_EMERG, "cdb_*: txn_commit: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: txn_commit: %s\n",
db_strerror(ret));
abort();
}
ret = dbenv->txn_begin(dbenv, NULL, tid, 0);
if (ret) {
- lprintf(CTDL_EMERG, "cdb_*: txn_begin: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: txn_begin: %s\n",
db_strerror(ret));
abort();
}
static void dbpanic(DB_ENV * env, int errval)
{
- lprintf(CTDL_EMERG, "cdb_*: Berkeley DB panic: %d\n", errval);
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: Berkeley DB panic: %d\n", errval);
}
static void cclose(DBC * cursor)
int ret;
if ((ret = cursor->c_close(cursor))) {
- lprintf(CTDL_EMERG, "cdb_*: c_close: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: c_close: %s\n",
db_strerror(ret));
abort();
}
for (i = 0; i < MAXCDB; i++)
if (cursors[i] != NULL) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_*: cursor still in progress on cdb %d: %s\n",
i, msg);
abort();
bailIfCursor(tsd->cursors, "in check_handles");
if (tsd->tid != NULL) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_*: transaction still in progress!");
abort();
}
/* Get the list of names. */
if ((ret = dbenv->log_archive(dbenv, &list, flags)) != 0) {
- lprintf(CTDL_ERR, "cdb_cull_logs: %s\n", db_strerror(ret));
+ CtdlLogPrintf(CTDL_ERR, "cdb_cull_logs: %s\n", db_strerror(ret));
return;
}
/* Print the list of names. */
if (list != NULL) {
for (file = list; *file != NULL; ++file) {
- lprintf(CTDL_DEBUG, "Deleting log: %s\n", *file);
+ CtdlLogPrintf(CTDL_DEBUG, "Deleting log: %s\n", *file);
ret = unlink(*file);
if (ret != 0) {
snprintf(errmsg, sizeof(errmsg),
last_run = time(NULL);
*/
- lprintf(CTDL_DEBUG, "-- db checkpoint --\n");
+ CtdlLogPrintf(CTDL_DEBUG, "-- db checkpoint --\n");
ret = dbenv->txn_checkpoint(dbenv,
MAX_CHECKPOINT_KBYTES,
MAX_CHECKPOINT_MINUTES, 0);
if (ret != 0) {
- lprintf(CTDL_EMERG, "cdb_checkpoint: txn_checkpoint: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_checkpoint: txn_checkpoint: %s\n",
db_strerror(ret));
abort();
}
char dbfilename[SIZ];
u_int32_t flags = 0;
- lprintf(CTDL_DEBUG, "cdb_*: open_databases() starting\n");
- lprintf(CTDL_DEBUG, "Compiled db: %s\n", DB_VERSION_STRING);
- lprintf(CTDL_INFO, " Linked db: %s\n",
+ CtdlLogPrintf(CTDL_DEBUG, "cdb_*: open_databases() starting\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Compiled db: %s\n", DB_VERSION_STRING);
+ CtdlLogPrintf(CTDL_INFO, " Linked db: %s\n",
db_version(NULL, NULL, NULL));
#ifdef HAVE_ZLIB
- lprintf(CTDL_INFO, "Linked zlib: %s\n", zlibVersion());
+ CtdlLogPrintf(CTDL_INFO, "Linked zlib: %s\n", zlibVersion());
#endif
/*
chmod(ctdl_data_dir, 0700);
chown(ctdl_data_dir, CTDLUID, (-1));
- lprintf(CTDL_DEBUG, "cdb_*: Setting up DB environment\n");
+ CtdlLogPrintf(CTDL_DEBUG, "cdb_*: Setting up DB environment\n");
db_env_set_func_yield(sched_yield);
ret = db_env_create(&dbenv, 0);
if (ret) {
- lprintf(CTDL_EMERG, "cdb_*: db_env_create: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: db_env_create: %s\n",
db_strerror(ret));
exit(CTDLEXIT_DB);
}
*/
ret = dbenv->set_cachesize(dbenv, 0, 64 * 1024, 0);
if (ret) {
- lprintf(CTDL_EMERG, "cdb_*: set_cachesize: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: set_cachesize: %s\n",
db_strerror(ret));
dbenv->close(dbenv, 0);
exit(CTDLEXIT_DB);
}
if ((ret = dbenv->set_lk_detect(dbenv, DB_LOCK_DEFAULT))) {
- lprintf(CTDL_EMERG, "cdb_*: set_lk_detect: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_*: set_lk_detect: %s\n",
db_strerror(ret));
dbenv->close(dbenv, 0);
exit(CTDLEXIT_DB);
}
flags = DB_CREATE | DB_INIT_MPOOL | DB_PRIVATE | DB_INIT_TXN | DB_INIT_LOCK | DB_THREAD | DB_RECOVER;
- lprintf(CTDL_DEBUG, "dbenv->open(dbenv, %s, %d, 0)\n", ctdl_data_dir, flags);
+ CtdlLogPrintf(CTDL_DEBUG, "dbenv->open(dbenv, %s, %d, 0)\n", ctdl_data_dir, flags);
ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
if (ret == DB_RUNRECOVERY) {
- lprintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
- lprintf(CTDL_ALERT, "Attempting recovery...\n");
+ CtdlLogPrintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
+ CtdlLogPrintf(CTDL_ALERT, "Attempting recovery...\n");
flags |= DB_RECOVER;
ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
}
if (ret == DB_RUNRECOVERY) {
- lprintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
- lprintf(CTDL_ALERT, "Attempting catastrophic recovery...\n");
+ CtdlLogPrintf(CTDL_ALERT, "dbenv->open: %s\n", db_strerror(ret));
+ CtdlLogPrintf(CTDL_ALERT, "Attempting catastrophic recovery...\n");
flags &= ~DB_RECOVER;
flags |= DB_RECOVER_FATAL;
ret = dbenv->open(dbenv, ctdl_data_dir, flags, 0);
}
if (ret) {
- lprintf(CTDL_DEBUG, "dbenv->open: %s\n", db_strerror(ret));
+ CtdlLogPrintf(CTDL_DEBUG, "dbenv->open: %s\n", db_strerror(ret));
dbenv->close(dbenv, 0);
exit(CTDLEXIT_DB);
}
- lprintf(CTDL_INFO, "Starting up DB\n");
+ CtdlLogPrintf(CTDL_INFO, "Starting up DB\n");
for (i = 0; i < MAXCDB; ++i) {
/* Create a database handle */
ret = db_create(&dbp[i], dbenv, 0);
if (ret) {
- lprintf(CTDL_DEBUG, "db_create: %s\n",
+ CtdlLogPrintf(CTDL_DEBUG, "db_create: %s\n",
db_strerror(ret));
exit(CTDLEXIT_DB);
}
DB_CREATE | DB_AUTO_COMMIT | DB_THREAD,
0600);
if (ret) {
- lprintf(CTDL_EMERG, "db_open[%d]: %s\n", i,
+ CtdlLogPrintf(CTDL_EMERG, "db_open[%d]: %s\n", i,
db_strerror(ret));
exit(CTDLEXIT_DB);
}
if (d->d_name[0] != '.') {
snprintf(filename, sizeof filename,
"%s/%s", ctdl_data_dir, d->d_name);
- lprintf(9, "chmod(%s, 0600) returned %d\n",
+ CtdlLogPrintf(9, "chmod(%s, 0600) returned %d\n",
filename, chmod(filename, 0600)
);
- lprintf(9, "chown(%s, CTDLUID, -1) returned %d\n",
+ CtdlLogPrintf(9, "chown(%s, CTDLUID, -1) returned %d\n",
filename, chown(filename, CTDLUID, (-1))
);
}
closedir(dp);
}
- lprintf(CTDL_DEBUG, "open_databases() finished\n");
+ CtdlLogPrintf(CTDL_DEBUG, "open_databases() finished\n");
CtdlRegisterProtoHook(cmd_cull, "CULL", "Cull database logs");
}
ctdl_thread_internal_free_tsd();
if ((ret = dbenv->txn_checkpoint(dbenv, 0, 0, 0))) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"txn_checkpoint: %s\n", db_strerror(ret));
}
/* close the tables */
for (a = 0; a < MAXCDB; ++a) {
- lprintf(CTDL_INFO, "Closing database %d\n", a);
+ CtdlLogPrintf(CTDL_INFO, "Closing database %d\n", a);
ret = dbp[a]->close(dbp[a], 0);
if (ret) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"db_close: %s\n", db_strerror(ret));
}
/* Close the handle. */
ret = dbenv->close(dbenv, 0);
if (ret) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"DBENV->close: %s\n", db_strerror(ret));
}
}
(uLongf *) & destLen,
(const Bytef *) compressed_data,
(uLong) sourceLen) != Z_OK) {
- lprintf(CTDL_EMERG, "uncompress() error\n");
+ CtdlLogPrintf(CTDL_EMERG, "uncompress() error\n");
abort();
}
CtdlCompressHeader)),
&destLen, (Bytef *) cdata, (uLongf) cdatalen,
1) != Z_OK) {
- lprintf(CTDL_EMERG, "compress2() error\n");
+ CtdlLogPrintf(CTDL_EMERG, "compress2() error\n");
abort();
}
zheader.compressed_len = (size_t) destLen;
&ddata, /* data */
0); /* flags */
if (ret) {
- lprintf(CTDL_EMERG, "cdb_store(%d): %s\n", cdb,
+ CtdlLogPrintf(CTDL_EMERG, "cdb_store(%d): %s\n", cdb,
db_strerror(ret));
abort();
}
txabort(tid);
goto retry;
} else {
- lprintf(CTDL_EMERG, "cdb_store(%d): %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_store(%d): %s\n",
cdb, db_strerror(ret));
abort();
}
if (MYTID != NULL) {
ret = dbp[cdb]->del(dbp[cdb], MYTID, &dkey, 0);
if (ret) {
- lprintf(CTDL_EMERG, "cdb_delete(%d): %s\n", cdb,
+ CtdlLogPrintf(CTDL_EMERG, "cdb_delete(%d): %s\n", cdb,
db_strerror(ret));
if (ret != DB_NOTFOUND)
abort();
txabort(tid);
goto retry;
} else {
- lprintf(CTDL_EMERG, "cdb_delete(%d): %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_delete(%d): %s\n",
cdb, db_strerror(ret));
abort();
}
DB_POSITION);
if (ret) {
- lprintf(CTDL_EMERG, "localcursor: %s\n", db_strerror(ret));
+ CtdlLogPrintf(CTDL_EMERG, "localcursor: %s\n", db_strerror(ret));
abort();
}
}
if ((ret != 0) && (ret != DB_NOTFOUND)) {
- lprintf(CTDL_EMERG, "cdb_fetch(%d): %s\n", cdb,
+ CtdlLogPrintf(CTDL_EMERG, "cdb_fetch(%d): %s\n", cdb,
db_strerror(ret));
abort();
}
tempcdb = (struct cdbdata *) malloc(sizeof(struct cdbdata));
if (tempcdb == NULL) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_fetch: Cannot allocate memory for tempcdb\n");
abort();
}
int ret = 0;
if (MYCURSORS[cdb] != NULL) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_rewind: must close cursor on database %d before reopening.\n",
cdb);
abort();
*/
ret = dbp[cdb]->cursor(dbp[cdb], MYTID, &MYCURSORS[cdb], 0);
if (ret) {
- lprintf(CTDL_EMERG, "cdb_rewind: db_cursor: %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_rewind: db_cursor: %s\n",
db_strerror(ret));
abort();
}
if (ret) {
if (ret != DB_NOTFOUND) {
- lprintf(CTDL_EMERG, "cdb_next_item(%d): %s\n",
+ CtdlLogPrintf(CTDL_EMERG, "cdb_next_item(%d): %s\n",
cdb, db_strerror(ret));
abort();
}
"can't begin transaction during r/o cursor");
if (MYTID != NULL) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_begin_transaction: ERROR: nested transaction\n");
abort();
}
for (i = 0; i < MAXCDB; i++)
if (MYCURSORS[i] != NULL) {
- lprintf(CTDL_WARNING,
+ CtdlLogPrintf(CTDL_WARNING,
"cdb_end_transaction: WARNING: cursor %d still open at transaction end\n",
i);
cclose(MYCURSORS[i]);
}
if (MYTID == NULL) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_end_transaction: ERROR: txcommit(NULL) !!\n");
abort();
} else
u_int32_t count;
if (MYTID != NULL) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_trunc must not be called in a transaction.\n");
abort();
} else {
/* txabort(tid); */
goto retry;
} else {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"cdb_truncate(%d): %s\n", cdb,
db_strerror(ret));
abort();
for (qdcount = ntohs(answer.header.qdcount); qdcount--; ptr += ret + QFIXEDSZ) {
if ((ret = dn_skipname(ptr, endptr)) < 0) {
- lprintf(CTDL_DEBUG, "dn_skipname error\n");
+ CtdlLogPrintf(CTDL_DEBUG, "dn_skipname error\n");
return(0);
}
}
syslog( LOG_CRIT|LOG_NDELAY|LOG_MAIL, StrBuf);
}
else
- lprintf(CTDL_EMERG, format, ap);
+ CtdlLogPrintf(CTDL_EMERG, format, ap);
} // outputPrintf
}
else
for (NThread = 0; NThread < size; NThread++)
- lprintf(1, "RAW: %p\n", stack_frames[NThread]);
+ CtdlLogPrintf(1, "RAW: %p\n", 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, StrBuf);
}
else
- lprintf(1, "%s\n", strings[NThread]);
+ CtdlLogPrintf(1, "%s\n", strings[NThread]);
}
}
} /* createGlobalBacktrace */
}
else
for (NThread = 0; NThread < size; NThread++)
- lprintf(1, "RAW: %p\n", stack_frames[NThread]);
+ CtdlLogPrintf(1, "RAW: %p\n", stack_frames[NThread]);
} /* createGlobalBacktrace */
/*!
struct cdbdata *cdb_euid;
long msgnum = (-1L);
- lprintf(CTDL_DEBUG, "Searching for EUID <%s> in <%s>\n", euid, qrbuf->QRname);
+ CtdlLogPrintf(CTDL_DEBUG, "Searching for EUID <%s> in <%s>\n", euid, qrbuf->QRname);
key_len = strlen(euid) + sizeof(long) + 1;
key = malloc(key_len);
memcpy(&msgnum, cdb_euid->ptr, sizeof(long));
cdb_free(cdb_euid);
}
- lprintf(CTDL_DEBUG, "returning msgnum = %ld\n", msgnum);
+ CtdlLogPrintf(CTDL_DEBUG, "returning msgnum = %ld\n", msgnum);
return(msgnum);
}
char *data;
int data_len;
- lprintf(CTDL_DEBUG, "Indexing message #%ld <%s> in <%s>\n", msgnum, euid, qrbuf->QRname);
+ CtdlLogPrintf(CTDL_DEBUG, "Indexing message #%ld <%s> in <%s>\n", msgnum, euid, qrbuf->QRname);
key_len = strlen(euid) + sizeof(long) + 1;
key = malloc(key_len);
while (rplist != NULL) {
if (getroom(&qr, rplist->name) == 0) {
if (DoesThisRoomNeedEuidIndexing(&qr)) {
- lprintf(CTDL_DEBUG,
+ CtdlLogPrintf(CTDL_DEBUG,
"Rebuilding EUID index for <%s>\n",
rplist->name);
usergoto(rplist->name, 0, 0, NULL, NULL);
break;
}
- if (nttlist != NULL) lprintf(CTDL_DEBUG, "nttlist=<%s>\n", nttlist);
+ if (nttlist != NULL) CtdlLogPrintf(CTDL_DEBUG, "nttlist=<%s>\n", nttlist);
end_critical_section(S_NTTLIST);
return(retval);
}
zone = icaltimezone_get_builtin_timezone(default_zone_name);
}
if (!zone) {
- lprintf(CTDL_ALERT,
+ CtdlLogPrintf(CTDL_ALERT,
"Unable to load '%s' time zone. Defaulting to UTC.\n",
default_zone_name);
zone = icaltimezone_get_utc_timezone();
}
if (!zone) {
- lprintf(1, "Unable to load UTC time zone!\n");
+ CtdlLogPrintf(1, "Unable to load UTC time zone!\n");
}
return zone;
}
/* Convert it to an icaltimezone type. */
if (tzid != NULL) {
- /* lprintf(9, " * Stringy supplied timezone is: '%s'\n", tzid); */
+ /* CtdlLogPrintf(9, " * Stringy supplied timezone is: '%s'\n", tzid); */
if ( (!strcasecmp(tzid, "UTC")) || (!strcasecmp(tzid, "GMT")) ) {
utc_declared_as_tzid = 1;
- /* lprintf(9, " * ...and we handle that internally.\n"); */
+ /* CtdlLogPrintf(9, " * ...and we handle that internally.\n"); */
}
else {
t = icalcomponent_get_timezone(cal, tzid);
- /* lprintf(9, " * ...and I %s have tzdata for that zone.\n",
+ /* CtdlLogPrintf(9, " * ...and I %s have tzdata for that zone.\n",
(t ? "DO" : "DO NOT")
); */
}
return;
}
- /* lprintf(9, " * Was: %s\n", icaltime_as_ical_string(TheTime)); */
+ /* CtdlLogPrintf(9, " * Was: %s\n", icaltime_as_ical_string(TheTime)); */
if (TheTime.is_utc) {
- /* lprintf(9, " * This property is ALREADY UTC.\n"); */
+ /* CtdlLogPrintf(9, " * This property is ALREADY UTC.\n"); */
}
else if (utc_declared_as_tzid) {
- /* lprintf(9, " * Replacing '%s' TZID with 'Z' suffix.\n", tzid); */
+ /* CtdlLogPrintf(9, " * Replacing '%s' TZID with 'Z' suffix.\n", tzid); */
TheTime.is_utc = 1;
}
else {
/* Do the conversion. */
if (t != NULL) {
- /* lprintf(9, " * Timezone prop found. Converting to UTC.\n"); */
+ /* CtdlLogPrintf(9, " * Timezone prop found. Converting to UTC.\n"); */
}
else {
- /* lprintf(9, " * Converting default timezone to UTC.\n"); */
+ /* CtdlLogPrintf(9, " * Converting default timezone to UTC.\n"); */
}
if (t == NULL) {
}
icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
- /* lprintf(9, " * Now: %s\n", icaltime_as_ical_string(TheTime)); */
+ /* CtdlLogPrintf(9, " * Now: %s\n", icaltime_as_ical_string(TheTime)); */
/* Now add the converted property back in. */
if (icalproperty_isa(prop) == ICAL_DTSTART_PROPERTY) {
void ical_dezonify(icalcomponent *cal) {
icalcomponent *vt = NULL;
- /* lprintf(9, "ical_dezonify() started\n"); */
+ /* CtdlLogPrintf(9, "ical_dezonify() started\n"); */
/* Convert all times to UTC */
ical_dezonify_recurse(cal, cal);
icalcomponent_free(vt);
}
- /* lprintf(9, "ical_dezonify() completed\n"); */
+ /* CtdlLogPrintf(9, "ical_dezonify() completed\n"); */
}
else if (!strcasecmp(key, "From")) {
process_rfc822_addr(value, user, node, name);
- lprintf(CTDL_DEBUG, "Converted to <%s@%s> (%s)\n", user, node, name);
+ CtdlLogPrintf(CTDL_DEBUG, "Converted to <%s@%s> (%s)\n", user, node, name);
snprintf(addr, sizeof addr, "%s@%s", user, node);
if (msg->cm_fields['A'] == NULL)
msg->cm_fields['A'] = strdup(name);
else if (!strcasecmp(key, "Message-ID")) {
if (msg->cm_fields['I'] != NULL) {
- lprintf(CTDL_WARNING, "duplicate message id\n");
+ CtdlLogPrintf(CTDL_WARNING, "duplicate message id\n");
}
if (msg->cm_fields['I'] == NULL) {
}
key[keylen++] = 0;
- lprintf(CTDL_DEBUG, "Directory key is <%s>\n", key);
+ CtdlLogPrintf(CTDL_DEBUG, "Directory key is <%s>\n", key);
}
void CtdlDirectoryAddUser(char *internet_addr, char *citadel_addr) {
char key[SIZ];
- lprintf(CTDL_DEBUG, "Dir: %s --> %s\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Dir: %s --> %s\n",
internet_addr, citadel_addr);
if (IsDirectory(internet_addr, 0) == 0) return;
if (rblcheck_backend(tbuf, txt_answer, sizeof txt_answer)) {
sprintf(message_to_spammer, "5.7.1 %s", txt_answer);
- lprintf(CTDL_INFO, "RBL: %s\n", txt_answer);
+ CtdlLogPrintf(CTDL_INFO, "RBL: %s\n", txt_answer);
return(1);
}
}
RES_OUT=`echo $RES | cut -b2-`
/usr/bin/printf "Found entry point in file $i\n"
cat <<EOF >> $C_FILE
- lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
+ CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
EOF
cat <<EOF >>$H_FILE
RES_OUT=`echo $RES | cut -b2-`
/usr/bin/printf "Found upgrade point in file $i\n"
cat <<EOF >> $U_FILE
- lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
+ CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
EOF
cat <<EOF >>$H_FILE
/usr/bin/printf "Found entry point in file modules/$j/$k\n"
# Add this entry point to the .c file
cat <<EOF >> $C_FILE
- lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
+ CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
EOF
# Add this entry point to the .h file
cat <<EOF >> $H_FILE
/usr/bin/printf "Found upgrade point in file modules/$j/$k\n"
# Add this entry point to the .c file
cat <<EOF >> $U_FILE
- lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
+ CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
EOF
# Add this entry point to the .h file
cat <<EOF >> $H_FILE
RES_OUT=`echo $RES | cut -b2-`
/usr/bin/printf "Found entry point in file user_modules/$j/$k\n"
cat <<EOF >> $C_FILE
- lprintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
+ CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_INIT_CALL($RES_OUT));
EOF
cat <<EOF >> $H_FILE
CTDL_MODULE_INIT($RES_OUT);
RES_OUT=`echo $RES | cut -b2-`
/usr/bin/printf "Found upgrade point in file user_modules/$j/$k\n"
cat <<EOF >> $U_FILE
- lprintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
+ CtdlLogPrintf (CTDL_INFO, "%s\n", CTDL_UPGRADE_CALL($RES_OUT));
EOF
cat <<EOF >> $H_FILE
CTDL_MODULE_UPGRADE($RES_OUT);
encaps = icalcomponent_new_vcalendar();
if (encaps == NULL) {
- lprintf(CTDL_CRIT, "Error at %s:%d - could not allocate component!\n",
+ CtdlLogPrintf(CTDL_CRIT, "Error at %s:%d - could not allocate component!\n",
__FILE__, __LINE__);
return NULL;
}
strcpy(summary_string, "Calendar item");
if (request == NULL) {
- lprintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
+ CtdlLogPrintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
return;
}
the_reply = icalcomponent_new_clone(request);
if (the_reply == NULL) {
- lprintf(CTDL_ERR, "ERROR: cannot clone request\n");
+ CtdlLogPrintf(CTDL_ERR, "ERROR: cannot clone request\n");
return;
}
/* Figure out just what event it is we're dealing with */
strcpy(uid, "--==<< InVaLiD uId >>==--");
ical_learn_uid_of_reply(uid, cal);
- lprintf(CTDL_DEBUG, "UID of event being replied to is <%s>\n", uid);
+ CtdlLogPrintf(CTDL_DEBUG, "UID of event being replied to is <%s>\n", uid);
strcpy(hold_rm, CC->room.QRname); /* save current room */
if (getroom(&CC->room, USERCALENDARROOM) != 0) {
getroom(&CC->room, hold_rm);
- lprintf(CTDL_CRIT, "cannot get user calendar room\n");
+ CtdlLogPrintf(CTDL_CRIT, "cannot get user calendar room\n");
return(2);
}
getroom(&CC->room, hold_rm); /* return to saved room */
- lprintf(CTDL_DEBUG, "msgnum_being_replaced == %ld\n", msgnum_being_replaced);
+ CtdlLogPrintf(CTDL_DEBUG, "msgnum_being_replaced == %ld\n", msgnum_being_replaced);
if (msgnum_being_replaced == 0) {
return(1); /* no calendar event found */
}
original_event = oec.c;
if (original_event == NULL) {
- lprintf(CTDL_ERR, "ERROR: Original_component is NULL.\n");
+ CtdlLogPrintf(CTDL_ERR, "ERROR: Original_component is NULL.\n");
return(2);
}
if (found_user != 0) {
strcpy(buf, who);
recp = validate_recipients(buf, NULL, 0);
- lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", buf);
if (recp != NULL) {
if (recp->num_local == 1) {
found_user = getuser(&usbuf, recp->recp_local);
*/
if (found_user != 0) {
snprintf(buf, sizeof buf, "%s@%s", who, config.c_fqdn);
- lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", buf);
recp = validate_recipients(buf, NULL, 0);
if (recp != NULL) {
if (recp->num_local == 1) {
if ( (!strcasecmp(type, "localhost"))
|| (!strcasecmp(type, "directory")) ) {
snprintf(buf, sizeof buf, "%s@%s", who, host);
- lprintf(CTDL_DEBUG, "Trying <%s>\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", buf);
recp = validate_recipients(buf, NULL, 0);
if (recp != NULL) {
if (recp->num_local == 1) {
}
/* Create a VFREEBUSY subcomponent */
- lprintf(CTDL_DEBUG, "Creating VFREEBUSY component\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Creating VFREEBUSY component\n");
fb = icalcomponent_new_vfreebusy();
if (fb == NULL) {
cprintf("%d Internal error: cannot allocate memory.\n",
icalcomponent_add_property(fb, icalproperty_new_organizer(buf));
/* Add busy time from events */
- lprintf(CTDL_DEBUG, "Adding busy time from events\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Adding busy time from events\n");
CtdlForEachMessage(MSGS_ALL, 0, NULL, NULL, NULL, ical_freebusy_backend, (void *)fb );
/* If values for DTSTART and DTEND are still not present, set them
}
/* Put the freebusy component into the calendar component */
- lprintf(CTDL_DEBUG, "Encapsulating\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Encapsulating\n");
encaps = ical_encapsulate_subcomponent(fb);
if (encaps == NULL) {
icalcomponent_free(fb);
}
/* Set the method to PUBLISH */
- lprintf(CTDL_DEBUG, "Setting method\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Setting method\n");
icalcomponent_set_method(encaps, ICAL_METHOD_PUBLISH);
/* Serialize it */
- lprintf(CTDL_DEBUG, "Serializing\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Serializing\n");
serialized_request = strdup(icalcomponent_as_ical_string(encaps));
icalcomponent_free(encaps); /* Don't need this anymore. */
encaps = icalcomponent_new_vcalendar();
if (encaps == NULL) {
- lprintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
__FILE__, __LINE__);
cprintf("%d Could not allocate memory\n", ERROR+INTERNAL_ERROR);
return;
/* Set expiration policy to manual; otherwise objects will be lost! */
if (lgetroom(&qr, USERCALENDARROOM)) {
- lprintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
+ CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
/* Set expiration policy to manual; otherwise objects will be lost! */
if (lgetroom(&qr, USERTASKSROOM)) {
- lprintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
+ CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
/* Set expiration policy to manual; otherwise objects will be lost! */
if (lgetroom(&qr, USERNOTESROOM)) {
- lprintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
+ CtdlLogPrintf(CTDL_CRIT, "Couldn't get the user calendar room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
size_t reqsize;
if (cal == NULL) {
- lprintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
+ CtdlLogPrintf(CTDL_ERR, "ERROR: trying to reply to NULL event?\n");
return;
}
/* Clone the event */
the_request = icalcomponent_new_clone(cal);
if (the_request == NULL) {
- lprintf(CTDL_ERR, "ERROR: cannot clone calendar object\n");
+ CtdlLogPrintf(CTDL_ERR, "ERROR: cannot clone calendar object\n");
return;
}
}
}
- lprintf(CTDL_DEBUG, "<%d> attendees: <%s>\n", num_attendees, attendees_string);
+ CtdlLogPrintf(CTDL_DEBUG, "<%d> attendees: <%s>\n", num_attendees, attendees_string);
/* If there are no attendees, there are no invitations to send, so...
* don't bother putting one together! Punch out, Maverick!
/* Encapsulate the VEVENT component into a complete VCALENDAR */
encaps = icalcomponent_new_vcalendar();
if (encaps == NULL) {
- lprintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Error at %s:%d - could not allocate component!\n",
__FILE__, __LINE__);
icalcomponent_free(the_request);
return;
icalproperty *organizer = NULL;
char organizer_string[SIZ];
- lprintf(CTDL_DEBUG, "ical_saving_vevent() has been called!\n");
+ CtdlLogPrintf(CTDL_DEBUG, "ical_saving_vevent() has been called!\n");
/* Don't send out invitations unless the client wants us to. */
if (CIT_ICAL->server_generated_invitations == 0) {
/* It must be an RFC822 message! */
if (msg->cm_format_type != 4) {
- lprintf(CTDL_DEBUG, "Rejecting non-RFC822 message\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Rejecting non-RFC822 message\n");
return(1); /* You tried to save a non-RFC822 message! */
}
free(msg->cm_fields['E']);
}
msg->cm_fields['E'] = strdup(imm.uid);
- lprintf(CTDL_DEBUG, "Saving calendar UID <%s>\n", msg->cm_fields['E']);
+ CtdlLogPrintf(CTDL_DEBUG, "Saving calendar UID <%s>\n", msg->cm_fields['E']);
}
if (!IsEmptyStr(imm.subject)) {
if (msg->cm_fields['U'] != NULL) {
RAND_egd(EGD_POOL);
if (!RAND_status()) {
- lprintf(CTDL_CRIT,
+ CtdlLogPrintf(CTDL_CRIT,
"PRNG not adequately seeded, won't do SSL/TLS\n");
return;
}
SSLCritters =
malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t *));
if (!SSLCritters) {
- lprintf(CTDL_EMERG, "citserver: can't allocate memory!!\n");
+ CtdlLogPrintf(CTDL_EMERG, "citserver: can't allocate memory!!\n");
/* Nothing's been initialized, just die */
exit(1);
} else {
for (a = 0; a < CRYPTO_num_locks(); a++) {
SSLCritters[a] = malloc(sizeof(pthread_mutex_t));
if (!SSLCritters[a]) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"citserver: can't allocate memory!!\n");
/* Nothing's been initialized, just die */
exit(1);
SSL_load_error_strings();
ssl_method = SSLv23_server_method();
if (!(ssl_ctx = SSL_CTX_new(ssl_method))) {
- lprintf(CTDL_CRIT, "SSL_CTX_new failed: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "SSL_CTX_new failed: %s\n",
ERR_reason_error_string(ERR_get_error()));
return;
}
if (!(SSL_CTX_set_cipher_list(ssl_ctx, CIT_CIPHERS))) {
- lprintf(CTDL_CRIT, "SSL: No ciphers available\n");
+ CtdlLogPrintf(CTDL_CRIT, "SSL: No ciphers available\n");
SSL_CTX_free(ssl_ctx);
ssl_ctx = NULL;
return;
/* Load DH parameters into the context */
dh = DH_new();
if (!dh) {
- lprintf(CTDL_CRIT, "init_ssl() can't allocate a DH object: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "init_ssl() can't allocate a DH object: %s\n",
ERR_reason_error_string(ERR_get_error()));
SSL_CTX_free(ssl_ctx);
ssl_ctx = NULL;
return;
}
if (!(BN_hex2bn(&(dh->p), DH_P))) {
- lprintf(CTDL_CRIT, "init_ssl() can't assign DH_P: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "init_ssl() can't assign DH_P: %s\n",
ERR_reason_error_string(ERR_get_error()));
SSL_CTX_free(ssl_ctx);
ssl_ctx = NULL;
return;
}
if (!(BN_hex2bn(&(dh->g), DH_G))) {
- lprintf(CTDL_CRIT, "init_ssl() can't assign DH_G: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "init_ssl() can't assign DH_G: %s\n",
ERR_reason_error_string(ERR_get_error()));
SSL_CTX_free(ssl_ctx);
ssl_ctx = NULL;
* Generate a key pair if we don't have one.
*/
if (access(file_crpt_file_key, R_OK) != 0) {
- lprintf(CTDL_INFO, "Generating RSA key pair.\n");
+ CtdlLogPrintf(CTDL_INFO, "Generating RSA key pair.\n");
rsa = RSA_generate_key(1024, /* modulus size */
65537, /* exponent */
NULL, /* no callback */
NULL); /* no callback */
if (rsa == NULL) {
- lprintf(CTDL_CRIT, "Key generation failed: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "Key generation failed: %s\n",
ERR_reason_error_string(ERR_get_error()));
}
if (rsa != NULL) {
NULL, /* no callbk */
NULL /* no callbk */
) != 1) {
- lprintf(CTDL_CRIT, "Cannot write key: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "Cannot write key: %s\n",
ERR_reason_error_string(ERR_get_error()));
unlink(file_crpt_file_key);
}
* the CSR in this step so that the next step may commence.
*/
if ( (access(file_crpt_file_cer, R_OK) != 0) && (access(file_crpt_file_csr, R_OK) != 0) ) {
- lprintf(CTDL_INFO, "Generating a certificate signing request.\n");
+ CtdlLogPrintf(CTDL_INFO, "Generating a certificate signing request.\n");
/*
* Read our key from the file. No, we don't just keep this
/* Sign the CSR */
if (!X509_REQ_sign(req, pk, EVP_md5())) {
- lprintf(CTDL_CRIT, "X509_REQ_sign(): error\n");
+ CtdlLogPrintf(CTDL_CRIT, "X509_REQ_sign(): error\n");
}
else {
/* Write it to disk. */
}
else {
- lprintf(CTDL_CRIT, "Unable to read private key.\n");
+ CtdlLogPrintf(CTDL_CRIT, "Unable to read private key.\n");
}
}
* Generate a self-signed certificate if we don't have one.
*/
if (access(file_crpt_file_cer, R_OK) != 0) {
- lprintf(CTDL_INFO, "Generating a self-signed certificate.\n");
+ CtdlLogPrintf(CTDL_INFO, "Generating a self-signed certificate.\n");
/* Same deal as before: always read the key from disk because
* it may or may not have just been generated.
/* Sign the cert */
if (!X509_sign(cer, pk, EVP_md5())) {
- lprintf(CTDL_CRIT, "X509_sign(): error\n");
+ CtdlLogPrintf(CTDL_CRIT, "X509_sign(): error\n");
}
else {
/* Write it to disk. */
SSL_CTX_use_certificate_chain_file(ssl_ctx, file_crpt_file_cer);
SSL_CTX_use_PrivateKey_file(ssl_ctx, file_crpt_file_key, SSL_FILETYPE_PEM);
if ( !SSL_CTX_check_private_key(ssl_ctx) ) {
- lprintf(CTDL_CRIT, "Cannot install certificate: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "Cannot install certificate: %s\n",
ERR_reason_error_string(ERR_get_error()));
}
while (nremain > 0) {
if (SSL_want_write(CC->ssl)) {
if ((SSL_read(CC->ssl, junk, 0)) < 1) {
- lprintf(CTDL_DEBUG, "SSL_read in client_write: %s\n", ERR_reason_error_string(ERR_get_error()));
+ CtdlLogPrintf(CTDL_DEBUG, "SSL_read in client_write: %s\n", ERR_reason_error_string(ERR_get_error()));
}
}
retval =
sleep(1);
continue;
}
- lprintf(CTDL_DEBUG, "SSL_write got error %ld, ret %d\n", errval, retval);
+ CtdlLogPrintf(CTDL_DEBUG, "SSL_write got error %ld, ret %d\n", errval, retval);
if (retval == -1)
- lprintf(CTDL_DEBUG, "errno is %d\n", errno);
+ CtdlLogPrintf(CTDL_DEBUG, "errno is %d\n", errno);
endtls();
client_write(&buf[nbytes - nremain], nremain);
return;
#endif
if (SSL_want_read(CC->ssl)) {
if ((SSL_write(CC->ssl, junk, 0)) < 1) {
- lprintf(CTDL_DEBUG, "SSL_write in client_read: %s\n", ERR_reason_error_string(ERR_get_error()));
+ CtdlLogPrintf(CTDL_DEBUG, "SSL_write in client_read: %s\n", ERR_reason_error_string(ERR_get_error()));
}
}
rlen = SSL_read(CC->ssl, &buf[len], bytes - len);
sleep(1);
continue;
}
- lprintf(CTDL_DEBUG, "SSL_read got error %ld\n", errval);
+ CtdlLogPrintf(CTDL_DEBUG, "SSL_read got error %ld\n", errval);
endtls();
return (client_read_to
(&buf[len], bytes - len, timeout));
int retval, bits, alg_bits;
if (!ssl_ctx) {
- lprintf(CTDL_CRIT, "SSL failed: no ssl_ctx exists?\n");
+ CtdlLogPrintf(CTDL_CRIT, "SSL failed: no ssl_ctx exists?\n");
if (nosup_response != NULL) cprintf("%s", nosup_response);
return;
}
if (!(CC->ssl = SSL_new(ssl_ctx))) {
- lprintf(CTDL_CRIT, "SSL_new failed: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "SSL_new failed: %s\n",
ERR_reason_error_string(ERR_get_error()));
if (error_response != NULL) cprintf("%s", error_response);
return;
}
if (!(SSL_set_fd(CC->ssl, CC->client_socket))) {
- lprintf(CTDL_CRIT, "SSL_set_fd failed: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "SSL_set_fd failed: %s\n",
ERR_reason_error_string(ERR_get_error()));
SSL_free(CC->ssl);
CC->ssl = NULL;
char error_string[128];
errval = SSL_get_error(CC->ssl, retval);
- lprintf(CTDL_CRIT, "SSL_accept failed: retval=%d, errval=%ld, err=%s\n",
+ CtdlLogPrintf(CTDL_CRIT, "SSL_accept failed: retval=%d, errval=%ld, err=%s\n",
retval,
errval,
ERR_error_string(errval, error_string)
}
BIO_set_close(CC->ssl->rbio, BIO_NOCLOSE);
bits = SSL_CIPHER_get_bits(SSL_get_current_cipher(CC->ssl), &alg_bits);
- lprintf(CTDL_INFO, "SSL/TLS using %s on %s (%d of %d bits)\n",
+ CtdlLogPrintf(CTDL_INFO, "SSL/TLS using %s on %s (%d of %d bits)\n",
SSL_CIPHER_get_name(SSL_get_current_cipher(CC->ssl)),
SSL_CIPHER_get_version(SSL_get_current_cipher(CC->ssl)),
bits, alg_bits);
return;
}
- lprintf(CTDL_INFO, "Ending SSL/TLS\n");
+ CtdlLogPrintf(CTDL_INFO, "Ending SSL/TLS\n");
SSL_shutdown(CC->ssl);
SSL_free(CC->ssl);
CC->ssl = NULL;
if (dspam_process (CTX, msgtext) != 0)
{
free(msgtext);
- lprintf(CTDL_CRIT, "ERROR: dspam_process failed");
+ CtdlLogPrintf(CTDL_CRIT, "ERROR: dspam_process failed");
return;
}
if (CTX->signature == NULL)
{
- lprintf(CTDL_CRIT,"No signature provided\n");
+ CtdlLogPrintf(CTDL_CRIT,"No signature provided\n");
}
else
{
SIG.length = CTX->signature->length;
/* Print processing results */
- lprintf (CTDL_DEBUG, "Probability: %2.4f Confidence: %2.4f, Result: %s\n",
+ CtdlLogPrintf (CTDL_DEBUG, "Probability: %2.4f Confidence: %2.4f, Result: %s\n",
CTX->probability,
CTX->confidence,
(CTX->result == DSR_ISSPAM) ? "Spam" : "Innocent");
/// else -> todo: global user for public rooms etc.
if (CTX == NULL)
{
- lprintf(CTDL_CRIT, "ERROR: dspam_init failed!\n");
+ CtdlLogPrintf(CTDL_CRIT, "ERROR: dspam_init failed!\n");
return ERROR + INTERNAL_ERROR;
}
/* Use graham and robinson algorithms, graham's p-values */
#else /* HAVE_LIBDSPAM */
- lprintf(CTDL_INFO, "This server is missing libdspam Spam filtering will be disabled.\n");
+ CtdlLogPrintf(CTDL_INFO, "This server is missing libdspam Spam filtering will be disabled.\n");
#endif /* HAVE_LIBDSPAM */
}
void PurgeMessages(void) {
FILE *purgelist;
- lprintf(CTDL_DEBUG, "PurgeMessages() called\n");
+ CtdlLogPrintf(CTDL_DEBUG, "PurgeMessages() called\n");
messages_purged = 0;
purgelist = tmpfile();
if (purgelist == NULL) {
- lprintf(CTDL_CRIT, "Can't create purgelist temp file: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "Can't create purgelist temp file: %s\n",
strerror(errno));
return;
}
age = time(NULL) - (qrbuf->QRmtime);
purge_secs = (time_t)config.c_roompurge * (time_t)86400;
if (purge_secs <= (time_t)0) return;
- lprintf(CTDL_DEBUG, "<%s> is <%ld> seconds old\n", qrbuf->QRname, (long)age);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s> is <%ld> seconds old\n", qrbuf->QRname, (long)age);
if (age > purge_secs) do_purge = 1;
} /* !QR_MAILBOX */
struct ValidUser *vuptr;
char *transcript = NULL;
- lprintf(CTDL_DEBUG, "PurgeRooms() called\n");
+ CtdlLogPrintf(CTDL_DEBUG, "PurgeRooms() called\n");
/* Load up a table full of valid user numbers so we can delete
if (num_rooms_purged > 0) aide_message(transcript, "Room Autopurger Message");
free(transcript);
- lprintf(CTDL_DEBUG, "Purged %d rooms.\n", num_rooms_purged);
+ CtdlLogPrintf(CTDL_DEBUG, "Purged %d rooms.\n", num_rooms_purged);
return(num_rooms_purged);
}
int num_users_purged = 0;
char *transcript = NULL;
- lprintf(CTDL_DEBUG, "PurgeUsers() called\n");
+ CtdlLogPrintf(CTDL_DEBUG, "PurgeUsers() called\n");
users_not_purged = 0;
switch(config.c_auth_mode) {
ForEachUser(do_uid_user_purge, NULL);
break;
default:
- lprintf(CTDL_DEBUG, "Unknown authentication mode!\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Unknown authentication mode!\n");
break;
}
}
- lprintf(CTDL_DEBUG, "Purged %d users.\n", num_users_purged);
+ CtdlLogPrintf(CTDL_DEBUG, "Purged %d users.\n", num_users_purged);
return(num_users_purged);
}
struct UPurgeList *uptr;
/* Phase 1: traverse through the table, discovering old records... */
- lprintf(CTDL_DEBUG, "Purge use table: phase 1\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Purge use table: phase 1\n");
cdb_rewind(CDB_USETABLE);
while(cdbut = cdb_next_item(CDB_USETABLE), cdbut != NULL) {
}
/* Phase 2: delete the records */
- lprintf(CTDL_DEBUG, "Purge use table: phase 2\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Purge use table: phase 2\n");
while (ul != NULL) {
cdb_delete(CDB_USETABLE, ul->up_key, strlen(ul->up_key));
uptr = ul->next;
ul = uptr;
}
- lprintf(CTDL_DEBUG, "Purge use table: finished (purged %d records)\n", purged);
+ CtdlLogPrintf(CTDL_DEBUG, "Purge use table: finished (purged %d records)\n", purged);
return(purged);
}
struct CtdlMessage *msg = NULL;
/* Phase 1: traverse through the table, discovering old records... */
- lprintf(CTDL_DEBUG, "Purge EUID index: phase 1\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Purge EUID index: phase 1\n");
cdb_rewind(CDB_EUIDINDEX);
while(cdbei = cdb_next_item(CDB_EUIDINDEX), cdbei != NULL) {
}
/* Phase 2: delete the records */
- lprintf(CTDL_DEBUG, "Purge euid index: phase 2\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Purge euid index: phase 2\n");
while (el != NULL) {
cdb_delete(CDB_EUIDINDEX, el->ep_key, el->ep_keylen);
free(el->ep_key);
el = eptr;
}
- lprintf(CTDL_DEBUG, "Purge euid index: finished (purged %d records)\n", purged);
+ CtdlLogPrintf(CTDL_DEBUG, "Purge euid index: finished (purged %d records)\n", purged);
return(purged);
}
struct tm tm;
struct CitContext purgerCC;
- lprintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Auto-purger_thread() initializing\n");
memset(&purgerCC, 0, sizeof(struct CitContext));
purgerCC.internal_pgm = 1;
}
- lprintf(CTDL_INFO, "Auto-purger: starting.\n");
+ CtdlLogPrintf(CTDL_INFO, "Auto-purger: starting.\n");
if (!CtdlThreadCheckStop())
{
retval = PurgeUsers();
- lprintf(CTDL_NOTICE, "Purged %d users.\n", retval);
+ CtdlLogPrintf(CTDL_NOTICE, "Purged %d users.\n", retval);
}
if (!CtdlThreadCheckStop())
{
PurgeMessages();
- lprintf(CTDL_NOTICE, "Expired %d messages.\n", messages_purged);
+ CtdlLogPrintf(CTDL_NOTICE, "Expired %d messages.\n", messages_purged);
}
if (!CtdlThreadCheckStop())
{
retval = PurgeRooms();
- lprintf(CTDL_NOTICE, "Expired %d rooms.\n", retval);
+ CtdlLogPrintf(CTDL_NOTICE, "Expired %d rooms.\n", retval);
}
if (!CtdlThreadCheckStop())
{
retval = PurgeVisits();
- lprintf(CTDL_NOTICE, "Purged %d visits.\n", retval);
+ CtdlLogPrintf(CTDL_NOTICE, "Purged %d visits.\n", retval);
}
if (!CtdlThreadCheckStop())
{
retval = PurgeUseTable();
- lprintf(CTDL_NOTICE, "Purged %d entries from the use table.\n", retval);
+ CtdlLogPrintf(CTDL_NOTICE, "Purged %d entries from the use table.\n", retval);
}
if (!CtdlThreadCheckStop())
{
retval = PurgeEuidIndexTable();
- lprintf(CTDL_NOTICE, "Purged %d entries from the EUID index.\n", retval);
+ CtdlLogPrintf(CTDL_NOTICE, "Purged %d entries from the EUID index.\n", retval);
}
if (!CtdlThreadCheckStop())
{
retval = TDAP_ProcessAdjRefCountQueue();
- lprintf(CTDL_NOTICE, "Processed %d message reference count adjustments.\n", retval);
+ CtdlLogPrintf(CTDL_NOTICE, "Processed %d message reference count adjustments.\n", retval);
}
if (!CtdlThreadCheckStop())
{
- lprintf(CTDL_INFO, "Auto-purger: finished.\n");
+ CtdlLogPrintf(CTDL_INFO, "Auto-purger: finished.\n");
last_purge = now; /* So we don't do it again soon */
}
else
- lprintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
+ CtdlLogPrintf(CTDL_INFO, "Auto-purger: STOPPED.\n");
}
return NULL;
/*
* Go ahead and run the queue
*/
- lprintf(CTDL_DEBUG, "serv_extnotify: processing notify queue\n");
+ CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: processing notify queue\n");
if (getroom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
- lprintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
+ CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
return;
}
CtdlForEachMessage(MSGS_ALL, 0L, NULL,
SPOOLMIME, NULL, process_notify, NULL);
- lprintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n");
+ CtdlLogPrintf(CTDL_DEBUG, "serv_extnotify: queue run completed\n");
doing_queue = 0;
}
/*!
*/
if ((configMsgNum == -1) || (strncasecmp(configMsg, "none", 4) == 0) &&
IsEmptyStr(config.c_pager_program) && IsEmptyStr(config.c_funambol_host)) {
- lprintf(CTDL_DEBUG, "No external notifiers configured on system/user");
+ CtdlLogPrintf(CTDL_DEBUG, "No external notifiers configured on system/user");
goto nuke;
}
// Can Funambol take the message?
// Do a simple string search to see if 'funambol' is selected as the
// type. This string would be at the very top of the message contents.
if (configMsgNum == -1) {
- lprintf(CTDL_ERR, "extNotify_isAllowedByPrefs was passed a non-existant config message id\n");
+ CtdlLogPrintf(CTDL_ERR, "extNotify_isAllowedByPrefs was passed a non-existant config message id\n");
return "none";
}
struct CtdlMessage *prefMsg;
num_msgs = cdbfr->len / sizeof(long);
cdb_free(cdbfr);
} else {
- lprintf(CTDL_DEBUG, "extNotify_getConfigMessage: No config messages found\n");
+ CtdlLogPrintf(CTDL_DEBUG, "extNotify_getConfigMessage: No config messages found\n");
return -1; /* No messages at all? No further action. */
}
int a;
#include "config.h"
#include "sysdep_decls.h"
#include "msgbase.h"
+#include "ctdl_module.h"
/*
* \brief Sends a message to the Funambol server notifying
sprintf(port, "%d", config.c_funambol_port);
sock = sock_connect(config.c_funambol_host, port, "tcp");
if (sock >= 0)
- lprintf(CTDL_DEBUG, "Connected to Funambol!\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Connected to Funambol!\n");
else
goto bail;
// Load the template SOAP message. Get mallocs done too
sock_shutdown(sock, SHUT_WR);
/* Response */
- lprintf(CTDL_DEBUG, "Awaiting response\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Awaiting response\n");
if (sock_getln(sock, buf, SIZ) < 0) {
goto free;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (strncasecmp(buf, "HTTP/1.1 200 OK", strlen("HTTP/1.1 200 OK"))) {
goto free;
}
- lprintf(CTDL_DEBUG, "Funambol notified\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Funambol notified\n");
free:
if (funambolCreds != NULL) free(funambolCreds);
if (SOAPMessage != NULL) free(SOAPMessage);
#include "control.h"
#include "ft_wordbreaker.h"
#include "crc16.h"
+#include "ctdl_module.h"
/*
* Noise words are not included in search indices.
/* extract the word */
word_len = word_end - word_start;
if (word_len >= sizeof word) {
- lprintf(CTDL_DEBUG, "Invalid word length: %d\n", word_len);
+ CtdlLogPrintf(CTDL_DEBUG, "Invalid word length: %d\n", word_len);
safestrncpy(word, word_start, sizeof word);
word[(sizeof word) - 1] = 0;
}
for (i=0; i<65536; ++i) {
if ((time(NULL) - last_update) >= 10) {
- lprintf(CTDL_INFO,
+ CtdlLogPrintf(CTDL_INFO,
"Flushing index cache to disk (%d%% complete)\n",
(i * 100 / 65536)
);
ftc_msgs[i] = NULL;
}
}
- lprintf(CTDL_INFO, "Flushed index cache to disk (100%% complete)\n");
+ CtdlLogPrintf(CTDL_INFO, "Flushed index cache to disk (100%% complete)\n");
}
char *msgtext;
int tok;
- lprintf(CTDL_DEBUG, "ft_index_message() %s msg %ld\n",
+ CtdlLogPrintf(CTDL_DEBUG, "ft_index_message() %s msg %ld\n",
(op ? "adding" : "removing") , msgnum
);
CC->redirect_buffer = NULL;
CC->redirect_len = 0;
CC->redirect_alloc = 0;
- lprintf(CTDL_DEBUG, "Wordbreaking message %ld...\n", msgnum);
+ CtdlLogPrintf(CTDL_DEBUG, "Wordbreaking message %ld...\n", msgnum);
wordbreaker(msgtext, &num_tokens, &tokens);
free(msgtext);
- lprintf(CTDL_DEBUG, "Indexing message %ld [%d tokens]\n", msgnum, num_tokens);
+ CtdlLogPrintf(CTDL_DEBUG, "Indexing message %ld [%d tokens]\n", msgnum, num_tokens);
if (num_tokens > 0) {
for (i=0; i<num_tokens; ++i) {
}
}
else {
- lprintf(CTDL_ALERT, "Invalid token %d !!\n", tok);
+ CtdlLogPrintf(CTDL_ALERT, "Invalid token %d !!\n", tok);
}
}
}
run_time = time(NULL);
- lprintf(CTDL_DEBUG, "do_fulltext_indexing() started (%ld)\n", run_time);
+ CtdlLogPrintf(CTDL_DEBUG, "do_fulltext_indexing() started (%ld)\n", run_time);
/*
* If we've switched wordbreaker modules, burn the index and start
*/
begin_critical_section(S_CONTROL);
if (CitControl.fulltext_wordbreaker != FT_WORDBREAKER_ID) {
- lprintf(CTDL_DEBUG, "wb ver on disk = %d, code ver = %d\n",
+ CtdlLogPrintf(CTDL_DEBUG, "wb ver on disk = %d, code ver = %d\n",
CitControl.fulltext_wordbreaker, FT_WORDBREAKER_ID);
- lprintf(CTDL_INFO, "(re)initializing full text index\n");
+ CtdlLogPrintf(CTDL_INFO, "(re)initializing full text index\n");
cdb_trunc(CDB_FULLTEXT);
CitControl.MMfulltext = 0L;
put_control();
/* Here it is ... do each message! */
for (i=0; i<ft_num_msgs; ++i) {
if (time(NULL) != last_progress) {
- lprintf(CTDL_DEBUG,
+ CtdlLogPrintf(CTDL_DEBUG,
"Indexed %d of %d messages (%d%%)\n",
i, ft_num_msgs,
((i*100) / ft_num_msgs)
/* Check to see if we need to quit early */
if (CtdlThreadCheckStop()) {
- lprintf(CTDL_DEBUG, "Indexer quitting early\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Indexer quitting early\n");
ft_newhighest = ft_newmsgs[i];
break;
}
/* Check to see if we have to maybe flush to disk */
if (i >= FT_MAX_CACHE) {
- lprintf(CTDL_DEBUG, "Time to flush.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Time to flush.\n");
ft_newhighest = ft_newmsgs[i];
break;
}
if (CtdlThreadCheckStop())
return;
- lprintf(CTDL_DEBUG, "do_fulltext_indexing() duration (%ld)\n", end_time - run_time);
+ CtdlLogPrintf(CTDL_DEBUG, "do_fulltext_indexing() duration (%ld)\n", end_time - run_time);
/* Save our place so we don't have to do this again */
ft_flush_cache();
end_critical_section(S_CONTROL);
last_index = time(NULL);
- lprintf(CTDL_DEBUG, "do_fulltext_indexing() finished\n");
+ CtdlLogPrintf(CTDL_DEBUG, "do_fulltext_indexing() finished\n");
return;
}
void *indexer_thread(void *arg) {
struct CitContext indexerCC;
- lprintf(CTDL_DEBUG, "indexer_thread() initializing\n");
+ CtdlLogPrintf(CTDL_DEBUG, "indexer_thread() initializing\n");
memset(&indexerCC, 0, sizeof(struct CitContext));
indexerCC.internal_pgm = 1;
CtdlThreadSleep(300);
}
- lprintf(CTDL_DEBUG, "indexer_thread() exiting\n");
+ CtdlLogPrintf(CTDL_DEBUG, "indexer_thread() exiting\n");
return NULL;
}
#include "imap_tools.h"
#include "imap_fetch.h"
#include "genstamp.h"
+#include "ctdl_module.h"
text_size = 0;
}
- lprintf(CTDL_DEBUG,
+ CtdlLogPrintf(CTDL_DEBUG,
"RFC822: headers=" SIZE_T_FMT
", text=" SIZE_T_FMT
", total=" SIZE_T_FMT "\n",
if (strchr(section, '[') != NULL) {
stripallbut(section, '[', ']');
}
- lprintf(CTDL_DEBUG, "Section is: %s%s\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Section is: %s%s\n",
section,
IsEmptyStr(section) ? "(empty)" : "");
is_partial = 1;
}
if (is_partial == 0) strcpy(partial, "");
- /* if (!IsEmptyStr(partial)) lprintf(CTDL_DEBUG, "Partial is %s\n", partial); */
+ /* if (!IsEmptyStr(partial)) CtdlLogPrintf(CTDL_DEBUG, "Partial is %s\n", partial); */
if (IMAP->cached_body == NULL) {
CC->redirect_buffer = malloc(SIZ);
#include "imap_acl.h"
#include "imap_misc.h"
#include "imap_list.h"
+#include "ctdl_module.h"
/*
}
- lprintf(CTDL_DEBUG, "select metadata: %d to %d\n", select_metadata_left, select_metadata_right);
+ CtdlLogPrintf(CTDL_DEBUG, "select metadata: %d to %d\n", select_metadata_left, select_metadata_right);
/* FIXME blah, we have to do something with this */
/* The folder root appears immediately after the selection options,
/* Might as well look for these while we're in here... */
if (parms[i][0] == '(') strcpy(parms[i], &parms[i][1]);
if (parms[i][strlen(parms[i])-1] == ')') parms[i][strlen(parms[i])-1] = 0;
- lprintf(9, "evaluating <%s>\n", parms[i]);
+ CtdlLogPrintf(9, "evaluating <%s>\n", parms[i]);
if (!strcasecmp(parms[i], "SUBSCRIBED")) {
return_subscribed = 1;
client_getln(buf, sizeof buf);
/* Convert RFC822 newlines (CRLF) to Unix newlines (LF) */
- lprintf(CTDL_DEBUG, "Converting CRLF to LF\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Converting CRLF to LF\n");
stripped_length = 0;
for (i=0; i<literal_length; ++i) {
if (strncmp(&Imap->transmitted_message[i], "\r\n", 2)) {
literal_length = stripped_length;
Imap->transmitted_message[literal_length] = 0; /* reterminate it */
- lprintf(CTDL_DEBUG, "Converting message format\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Converting message format\n");
msg = convert_internet_message(Imap->transmitted_message);
Imap->transmitted_message = NULL;
Imap->transmitted_length = 0;
#include "room_ops.h"
#include "internet_addressing.h"
#include "imap_tools.h"
-
+#include "ctdl_module.h"
#ifndef HAVE_SNPRINTF
#include "snprintf.h"
*destp = 0;
string_init(&dest, destp, destend-destp);
- /* lprintf(CTDL_DEBUG, "toimap %s\r\n", src); */
+ /* CtdlLogPrintf(CTDL_DEBUG, "toimap %s\r\n", src); */
for (;;)
{
if (state == 1)
utf7_closeb64(&dest, v, i);
- /* lprintf(CTDL_DEBUG, " -> %s\r\n", destp); */
+ /* CtdlLogPrintf(CTDL_DEBUG, " -> %s\r\n", destp); */
return string_end(&dest);
}
*destp = 0;
string_init(&dest, destp, destend-destp);
- /* lprintf(CTDL_DEBUG, "fromimap %s\r\n", src); */
+ /* CtdlLogPrintf(CTDL_DEBUG, "fromimap %s\r\n", src); */
do {
c = *p++;
}
} while (c != '\0');
- /* lprintf(CTDL_DEBUG, " -> %s\r\n", destp); */
+ /* CtdlLogPrintf(CTDL_DEBUG, " -> %s\r\n", destp); */
return string_end(&dest);
}
ret = (0 | IR_MAILBOX);
exit:
- lprintf(CTDL_DEBUG, "(That translates to \"%s\")\n", rbuf);
+ CtdlLogPrintf(CTDL_DEBUG, "(That translates to \"%s\")\n", rbuf);
return(ret);
}
struct cdbdata *cdbfr;
if (IMAP->selected == 0) {
- lprintf(CTDL_ERR,
+ CtdlLogPrintf(CTDL_ERR,
"imap_load_msgids() can't run; no room selected\n");
return;
}
int num_recent = 0;
if (IMAP->selected == 0) {
- lprintf(CTDL_ERR,
+ CtdlLogPrintf(CTDL_ERR,
"imap_load_msgids() can't run; no room selected\n");
return;
}
if (cdbfr != NULL) {
msglist = malloc(cdbfr->len);
if (msglist == NULL) {
- lprintf(CTDL_CRIT, "malloc() failed\n");
+ CtdlLogPrintf(CTDL_CRIT, "malloc() failed\n");
abort();
}
memcpy(msglist, cdbfr->ptr, (size_t)cdbfr->len);
imap_do_expunge();
}
- lprintf(CTDL_DEBUG, "Performing IMAP cleanup hook\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Performing IMAP cleanup hook\n");
imap_free_msgids();
imap_free_transmitted_message();
}
free(IMAP);
- lprintf(CTDL_DEBUG, "Finished IMAP cleanup hook\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Finished IMAP cleanup hook\n");
}
long *delmsgs = NULL;
int num_delmsgs = 0;
- lprintf(CTDL_DEBUG, "imap_do_expunge() called\n");
+ CtdlLogPrintf(CTDL_DEBUG, "imap_do_expunge() called\n");
if (IMAP->selected == 0) {
return (0);
}
imap_rescan_msgids();
}
- lprintf(CTDL_DEBUG, "Expunged %d messages from <%s>\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Expunged %d messages from <%s>\n",
num_expunged, CC->room.QRname);
return (num_expunged);
}
if (strchr(parms[2], '\\') != NULL) {
cprintf("%s NO Invalid character in folder name\r\n",
parms[0]);
- lprintf(CTDL_DEBUG, "invalid character in folder name\n");
+ CtdlLogPrintf(CTDL_DEBUG, "invalid character in folder name\n");
return;
}
if (ret < 0) {
cprintf("%s NO Invalid mailbox name or location\r\n",
parms[0]);
- lprintf(CTDL_DEBUG, "invalid mailbox name or location\n");
+ CtdlLogPrintf(CTDL_DEBUG, "invalid mailbox name or location\n");
return;
}
floornum = (ret & 0x00ff); /* lower 8 bits = floor number */
if (flags & IR_MAILBOX) {
if (strncasecmp(parms[2], "INBOX/", 6)) {
cprintf("%s NO Personal folders must be created under INBOX\r\n", parms[0]);
- lprintf(CTDL_DEBUG, "not subordinate to inbox\n");
+ CtdlLogPrintf(CTDL_DEBUG, "not subordinate to inbox\n");
return;
}
}
newroomview = VIEW_BBS;
}
- lprintf(CTDL_INFO, "Create new room <%s> on floor <%d> with type <%d>\n",
+ CtdlLogPrintf(CTDL_INFO, "Create new room <%s> on floor <%d> with type <%d>\n",
roomname, floornum, newroomtype);
ret = create_room(roomname, newroomtype, "", floornum, 1, 0, newroomview);
} else {
cprintf("%s OK CREATE completed\r\n", parms[0]);
}
- lprintf(CTDL_DEBUG, "imap_create() completed\n");
+ CtdlLogPrintf(CTDL_DEBUG, "imap_create() completed\n");
}
irl->irl_newfloor);
if (r != crr_ok) {
/* FIXME handle error returns better */
- lprintf(CTDL_ERR, "CtdlRenameRoom() error %d\n", r);
+ CtdlLogPrintf(CTDL_ERR, "CtdlRenameRoom() error %d\n", r);
}
irlp = irl;
irl = irl->next;
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
flush_output();
if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
- lprintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
+ CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
CC->kill_me = 1;
return;
}
if (IMAP->authstate == imap_as_expecting_password) {
- lprintf(CTDL_INFO, "IMAP: <password>\n");
+ CtdlLogPrintf(CTDL_INFO, "IMAP: <password>\n");
}
else if (IMAP->authstate == imap_as_expecting_plainauth) {
- lprintf(CTDL_INFO, "IMAP: <plain_auth>\n");
+ CtdlLogPrintf(CTDL_INFO, "IMAP: <plain_auth>\n");
}
else if (bmstrcasestr(cmdbuf, " LOGIN ")) {
- lprintf(CTDL_INFO, "IMAP: LOGIN...\n");
+ CtdlLogPrintf(CTDL_INFO, "IMAP: LOGIN...\n");
}
else {
- lprintf(CTDL_INFO, "IMAP: %s\n", cmdbuf);
+ CtdlLogPrintf(CTDL_INFO, "IMAP: %s\n", cmdbuf);
}
while (strlen(cmdbuf) < 5)
gettimeofday(&tv2, NULL);
total_time = (tv2.tv_usec + (tv2.tv_sec * 1000000)) - (tv1.tv_usec + (tv1.tv_sec * 1000000));
- lprintf(CTDL_DEBUG, "IMAP command completed in %ld.%ld seconds\n",
+ CtdlLogPrintf(CTDL_DEBUG, "IMAP command completed in %ld.%ld seconds\n",
(total_time / 1000000),
(total_time % 1000000)
);
void xmpp_stream_start(void *data, const char *supplied_el, const char **attr)
{
- lprintf(CTDL_DEBUG, "New XMPP stream.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "New XMPP stream.\n");
while (*attr) {
if (!strcasecmp(attr[0], "to")) {
strcpy(el, ++sep);
}
- lprintf(CTDL_DEBUG, "XMPP ELEMENT START: <%s>\n", el);
+ CtdlLogPrintf(CTDL_DEBUG, "XMPP ELEMENT START: <%s>\n", el);
for (i=0; attr[i] != NULL; i+=2) {
- lprintf(CTDL_DEBUG, " Attribute '%s' = '%s'\n", attr[i], attr[i+1]);
+ CtdlLogPrintf(CTDL_DEBUG, " Attribute '%s' = '%s'\n", attr[i], attr[i+1]);
}
if (!strcasecmp(el, "stream")) {
strcpy(el, ++sep);
}
- lprintf(CTDL_DEBUG, "XMPP ELEMENT END : <%s>\n", el);
+ CtdlLogPrintf(CTDL_DEBUG, "XMPP ELEMENT END : <%s>\n", el);
if (XMPP->chardata_len > 0) {
- lprintf(CTDL_DEBUG, " chardata: %s\n", XMPP->chardata);
+ CtdlLogPrintf(CTDL_DEBUG, " chardata: %s\n", XMPP->chardata);
}
if (!strcasecmp(el, "resource")) {
/* Don't do this stuff if this is not a XMPP session! */
if (CC->h_command_function != xmpp_command_loop) return;
- lprintf(CTDL_DEBUG, "Performing XMPP cleanup hook\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Performing XMPP cleanup hook\n");
if (XMPP->chardata != NULL) {
free(XMPP->chardata);
XMPP->chardata = NULL;
XMPP->xp = XML_ParserCreateNS("UTF-8", ':');
if (XMPP->xp == NULL) {
- lprintf(CTDL_ALERT, "Cannot create XML parser!\n");
+ CtdlLogPrintf(CTDL_ALERT, "Cannot create XML parser!\n");
CC->kill_me = 1;
return;
}
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
retval = client_read(cmdbuf, 1);
if (retval != 1) {
- lprintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
+ CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
CC->kill_me = 1;
return;
}
}
}
- lprintf(CTDL_DEBUG, "%d sessions for <%s> are now visible to session %d\n",
+ CtdlLogPrintf(CTDL_DEBUG, "%d sessions for <%s> are now visible to session %d\n",
visible_sessions, presence_jid, CC->cs_pid);
if ( (event_type == XMPP_EVT_LOGIN) && (visible_sessions == 1) ) {
- lprintf(CTDL_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid);
+ CtdlLogPrintf(CTDL_DEBUG, "Telling session %d that <%s> logged in\n", CC->cs_pid, presence_jid);
/* Do an unsolicited roster update that adds a new contact. */
for (i=0; i<nContexts; i++) {
}
if (visible_sessions == 0) {
- lprintf(CTDL_DEBUG, "Telling session %d that <%s> logged out\n", CC->cs_pid, presence_jid);
+ CtdlLogPrintf(CTDL_DEBUG, "Telling session %d that <%s> logged out\n", CC->cs_pid, presence_jid);
/* Transmit non-presence information */
cprintf("<presence type=\"unavailable\" from=\"%s\"></presence>", presence_jid);
void xmpp_query_namespace(char *iq_id, char *iq_from, char *iq_to, char *query_xmlns) {
- lprintf(CTDL_DEBUG, "xmpp_query_namespace(%s, %s, %s, %s)\n", iq_id, iq_from, iq_to, query_xmlns);
+ CtdlLogPrintf(CTDL_DEBUG, "xmpp_query_namespace(%s, %s, %s, %s)\n", iq_id, iq_from, iq_to, query_xmlns);
/*
* Beginning of query result.
int purged_something = 0;
struct CitContext *cptr;
- lprintf(CTDL_DEBUG, "xmpp_queue_event(%d, %s)\n", event_type, email_addr);
+ CtdlLogPrintf(CTDL_DEBUG, "xmpp_queue_event(%d, %s)\n", event_type, email_addr);
/* Purge events more than a minute old */
begin_critical_section(S_XMPP_QUEUE);
*/
if (success) {
cprintf("%d %d operation(s) confirmed.\n", CIT_OK, success);
- lprintf(CTDL_NOTICE,
+ CtdlLogPrintf(CTDL_NOTICE,
"Mailing list: %s %ssubscribed to %s with token %s\n",
email,
(!IsEmptyStr(address_to_unsubscribe)) ? "un" : "",
void cmd_mgsve_logout(struct sdm_userdata *u)
{
cprintf("OK\r\n");
- lprintf(CTDL_NOTICE, "MgSve bye.");
+ CtdlLogPrintf(CTDL_NOTICE, "MgSve bye.");
CC->kill_me = 1;
}
length = strlen(parms[0]);
}
if (length < 1) {
- lprintf(CTDL_CRIT, "Client disconnected: ending session.\n");
+ CtdlLogPrintf(CTDL_CRIT, "Client disconnected: ending session.\n");
CC->kill_me = 1;
return;
}
- lprintf(CTDL_INFO, "MANAGESIEVE: %s\n", cmdbuf);
+ CtdlLogPrintf(CTDL_INFO, "MANAGESIEVE: %s\n", cmdbuf);
if ((length>= 12) && (!strncasecmp(parms[0], "AUTHENTICATE", 12))){
cmd_mgsve_auth(num_parms, parms, &u);
}
}
else {
cprintf("No Invalid access or command.\r\n");
- lprintf(CTDL_INFO, "illegal Managesieve command: %s", parms[0]);
+ CtdlLogPrintf(CTDL_INFO, "illegal Managesieve command: %s", parms[0]);
CC->kill_me = 1;
}
/* Don't do this stuff if this is not a managesieve session! */
if (CC->h_command_function != managesieve_command_loop) return;
- lprintf(CTDL_DEBUG, "Performing managesieve cleanup hook\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Performing managesieve cleanup hook\n");
free(MGSVE);
}
* First try the neighbor nodes
*/
if (working_ignetcfg == NULL) {
- lprintf(CTDL_ERR, "working_ignetcfg is NULL!\n");
+ CtdlLogPrintf(CTDL_ERR, "working_ignetcfg is NULL!\n");
if (nexthop != NULL) {
strcpy(nexthop, "");
}
/*
* If we get to this point, the supplied node name is bogus.
*/
- lprintf(CTDL_ERR, "Invalid node name <%s>\n", node);
+ CtdlLogPrintf(CTDL_ERR, "Invalid node name <%s>\n", node);
return(-1);
}
recps = malloc(recps_len);
if (recps == NULL) {
- lprintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
+ CtdlLogPrintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
abort();
}
recps = malloc(recps_len);
if (recps == NULL) {
- lprintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
+ CtdlLogPrintf(CTDL_EMERG, "Cannot allocate %ld bytes for recps...\n", (long)recps_len);
abort();
}
/* Check for valid node name */
if (is_valid_node(NULL, NULL, mptr->remote_nodename) != 0) {
- lprintf(CTDL_ERR, "Invalid node <%s>\n", mptr->remote_nodename);
+ CtdlLogPrintf(CTDL_ERR, "Invalid node <%s>\n", mptr->remote_nodename);
send = 0;
}
/* Check for split horizon */
- lprintf(CTDL_DEBUG, "Path is %s\n", msg->cm_fields['P']);
+ CtdlLogPrintf(CTDL_DEBUG, "Path is %s\n", msg->cm_fields['P']);
bang = num_tokens(msg->cm_fields['P'], '!');
if (bang > 1) for (i=0; i<(bang-1); ++i) {
extract_token(buf, msg->cm_fields['P'],
snprintf(filename, sizeof filename,"%s/%s",
ctdl_netout_dir,
mptr->remote_nodename);
- lprintf(CTDL_DEBUG, "Appending to %s\n", filename);
+ CtdlLogPrintf(CTDL_DEBUG, "Appending to %s\n", filename);
fp = fopen(filename, "ab");
if (fp != NULL) {
fwrite(sermsg.ser,
fclose(fp);
}
else {
- lprintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
+ CtdlLogPrintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
}
/* free the serialized version */
sc = *scc;
fp = fopen(filename, "w");
if (fp == NULL) {
- lprintf(CTDL_CRIT, "ERROR: cannot open %s: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot open %s: %s\n",
filename, strerror(errno));
free_spoolcontrol_struct(scc);
}
* queued for networking and then deleted before it can happen.
*/
if (getroom(&CC->room, room_to_spool) != 0) {
- lprintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", room_to_spool);
+ CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", room_to_spool);
return;
}
assoc_file_name(filename, sizeof filename, &CC->room, ctdl_netcfg_dir);
- lprintf(CTDL_INFO, "Networking started for <%s>\n", CC->room.QRname);
+ CtdlLogPrintf(CTDL_INFO, "Networking started for <%s>\n", CC->room.QRname);
begin_critical_section(S_NETCONFIGS);
/* Only do net processing for rooms that have netconfigs */
/* Concise cleanup because we know there's only one node in the sc */
free(sc.ignet_push_shares);
- lprintf(CTDL_NOTICE, "Synchronized %d messages to <%s>\n",
+ CtdlLogPrintf(CTDL_NOTICE, "Synchronized %d messages to <%s>\n",
num_spooled, target_node);
return(num_spooled);
}
static int serialnum = 0;
size_t size;
- lprintf(CTDL_DEBUG, "entering network_bounce()\n");
+ CtdlLogPrintf(CTDL_DEBUG, "entering network_bounce()\n");
if (msg == NULL) return;
/* Clean up */
if (valid != NULL) free_recipients(valid);
CtdlFreeMessage(msg);
- lprintf(CTDL_DEBUG, "leaving network_bounce()\n");
+ CtdlLogPrintf(CTDL_DEBUG, "leaving network_bounce()\n");
}
firstbyte = buffer[0];
lastbyte = buffer[size-1];
if ( (firstbyte != 255) || (lastbyte != 0) ) {
- lprintf(CTDL_ERR, "Corrupt message ignored. Length=%ld, firstbyte = %d, lastbyte = %d\n",
+ CtdlLogPrintf(CTDL_ERR, "Corrupt message ignored. Length=%ld, firstbyte = %d, lastbyte = %d\n",
size, firstbyte, lastbyte);
return;
}
"%s/%s",
ctdl_netout_dir,
nexthop);
- lprintf(CTDL_DEBUG, "Appending to %s\n", filename);
+ CtdlLogPrintf(CTDL_DEBUG, "Appending to %s\n", filename);
fp = fopen(filename, "ab");
if (fp != NULL) {
fwrite(sermsg.ser,
fclose(fp);
}
else {
- lprintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
+ CtdlLogPrintf(CTDL_ERR, "%s: %s\n", filename, strerror(errno));
}
free(sermsg.ser);
CtdlFreeMessage(msg);
fp = fopen(filename, "rb");
if (fp == NULL) {
- lprintf(CTDL_CRIT, "Error opening %s: %s\n", filename, strerror(errno));
+ CtdlLogPrintf(CTDL_CRIT, "Error opening %s: %s\n", filename, strerror(errno));
return;
}
fseek(fp, 0L, SEEK_END);
- lprintf(CTDL_INFO, "network: processing %ld bytes from %s\n", ftell(fp), filename);
+ CtdlLogPrintf(CTDL_INFO, "network: processing %ld bytes from %s\n", ftell(fp), filename);
rewind(fp);
/* Look for messages in the data stream and break them out */
*/
if (stat(ctdl_netin_dir, &statbuf)) return;
if (statbuf.st_mtime == last_spoolin_mtime) {
- lprintf(CTDL_DEBUG, "network: nothing in inbound queue\n");
+ CtdlLogPrintf(CTDL_DEBUG, "network: nothing in inbound queue\n");
return;
}
last_spoolin_mtime = statbuf.st_mtime;
- lprintf(CTDL_DEBUG, "network: processing inbound queue\n");
+ CtdlLogPrintf(CTDL_DEBUG, "network: processing inbound queue\n");
/*
* Ok, there's something interesting in there, so scan it.
CtdlMakeTempFileName(tempfilename, sizeof tempfilename);
if (sock_puts(sock, "NDOP") < 0) return;
if (sock_getln(sock, buf, sizeof buf) < 0) return;
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
return;
}
bytes_received = 0L;
fp = fopen(tempfilename, "w");
if (fp == NULL) {
- lprintf(CTDL_CRIT, "cannot open download file locally: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "cannot open download file locally: %s\n",
strerror(errno));
return;
}
return;
}
if (download_len > 0) {
- lprintf(CTDL_NOTICE, "Received %ld octets from <%s>\n", download_len, remote_nodename);
+ CtdlLogPrintf(CTDL_NOTICE, "Received %ld octets from <%s>\n", download_len, remote_nodename);
}
- lprintf(CTDL_DEBUG, "%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "%s\n", buf);
/* Now copy the temp file to its permanent location.
* (We copy instead of link because they may be on different filesystems)
if (sock_puts(sock, "NUOP") < 0) return;
if (sock_getln(sock, buf, sizeof buf) < 0) return;
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
return;
}
fd = open(sfname, O_RDONLY);
if (fd < 0) {
if (errno != ENOENT) {
- lprintf(CTDL_CRIT, "cannot open upload file locally: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "cannot open upload file locally: %s\n",
strerror(errno));
}
return;
/* Read the server greeting */
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
/* Identify ourselves */
snprintf(buf, sizeof buf, "NETP %s|%s", config.c_nodename, secret);
extract_token(pass, cmdbuf, 1, '|', sizeof pass);
if (doing_queue) {
- lprintf(CTDL_WARNING, "Network node <%s> refused - spooling", node);
+ CtdlLogPrintf(CTDL_WARNING, "Network node <%s> refused - spooling", node);
cprintf("%d spooling - try again in a few minutes\n",
ERROR + RESOURCE_BUSY);
return;
v = is_valid_node(nexthop, secret, node);
if (v != 0) {
- lprintf(CTDL_WARNING, "Unknown node <%s>\n", node);
+ CtdlLogPrintf(CTDL_WARNING, "Unknown node <%s>\n", node);
cprintf("%d authentication failed\n",
ERROR + PASSWORD_REQUIRED);
return;
}
if (strcasecmp(pass, secret)) {
- lprintf(CTDL_WARNING, "Bad password for network node <%s>", node);
+ CtdlLogPrintf(CTDL_WARNING, "Bad password for network node <%s>", node);
cprintf("%d authentication failed\n", ERROR + PASSWORD_REQUIRED);
return;
}
if (network_talking_to(node, NTT_CHECK)) {
- lprintf(CTDL_WARNING, "Duplicate session for network node <%s>", node);
+ CtdlLogPrintf(CTDL_WARNING, "Duplicate session for network node <%s>", node);
cprintf("%d Already talking to %s right now\n", ERROR + RESOURCE_BUSY, node);
return;
}
safestrncpy(CC->net_node, node, sizeof CC->net_node);
network_talking_to(node, NTT_ADD);
- lprintf(CTDL_NOTICE, "Network node <%s> logged in\n", CC->net_node);
+ CtdlLogPrintf(CTDL_NOTICE, "Network node <%s> logged in\n", CC->net_node);
cprintf("%d authenticated as network node '%s'\n", CIT_OK,
CC->net_node);
}
}
}
- lprintf(9, "UUID of note is: %s\n", uuid);
+ CtdlLogPrintf(9, "UUID of note is: %s\n", uuid);
if (!IsEmptyStr(uuid)) {
if (msg->cm_fields['E'] != NULL) {
/* Don't do this stuff if this is not a POP3 session! */
if (CC->h_command_function != pop3_command_loop) return;
- lprintf(CTDL_DEBUG, "Performing POP3 cleanup hook\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Performing POP3 cleanup hook\n");
if (POP3->msgs != NULL) free(POP3->msgs);
free(POP3);
strcpy(username, argbuf);
striplt(username);
- /* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
+ /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", username); */
if (CtdlLoginExistingUser(NULL, username) == login_ok) {
cprintf("+OK Password required for %s\r\n", username);
}
if (msgs >= 0) {
cprintf("+OK %s is logged in (%d messages)\r\n",
CC->user.fullname, msgs);
- lprintf(CTDL_NOTICE, "POP3 authenticated %s\n", CC->user.fullname);
+ CtdlLogPrintf(CTDL_NOTICE, "POP3 authenticated %s\n", CC->user.fullname);
}
else {
cprintf("-ERR Can't open your mailbox\r\n");
strcpy(password, argbuf);
striplt(password);
- /* lprintf(CTDL_DEBUG, "Trying <%s>\n", password); */
+ /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", password); */
if (CtdlTryPassword(password) == pass_ok) {
pop3_login();
}
time(&CC->lastcmd);
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
- lprintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
+ CtdlLogPrintf(CTDL_ERR, "Client disconnected: ending session.\r\n");
CC->kill_me = 1;
return;
}
if (!strncasecmp(cmdbuf, "PASS", 4)) {
- lprintf(CTDL_INFO, "POP3: PASS...\r\n");
+ CtdlLogPrintf(CTDL_INFO, "POP3: PASS...\r\n");
}
else {
- lprintf(CTDL_INFO, "POP3: %s\r\n", cmdbuf);
+ CtdlLogPrintf(CTDL_INFO, "POP3: %s\r\n", cmdbuf);
}
while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
struct cdbdata *cdbut;
struct UseTable ut;
- lprintf(CTDL_DEBUG, "POP3: %s %s %s <password>\n", roomname, pop3host, pop3user);
- lprintf(CTDL_NOTICE, "Connecting to <%s>\n", pop3host);
+ CtdlLogPrintf(CTDL_DEBUG, "POP3: %s %s %s <password>\n", roomname, pop3host, pop3user);
+ CtdlLogPrintf(CTDL_NOTICE, "Connecting to <%s>\n", pop3host);
if (CtdlThreadCheckStop())
return;
sock = sock_connect(pop3host, "110", "tcp");
if (sock < 0) {
- lprintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
+ CtdlLogPrintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
return;
}
if (CtdlThreadCheckStop())
goto bail;
- lprintf(CTDL_DEBUG, "Connected!\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
/* Read the server greeting */
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
if (strncasecmp(buf, "+OK", 3)) goto bail;
if (CtdlThreadCheckStop())
* actually barfs on LF-terminated newlines.
*/
snprintf(buf, sizeof buf, "USER %s\r", pop3user);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
if (strncasecmp(buf, "+OK", 3)) goto bail;
if (CtdlThreadCheckStop())
/* Password */
snprintf(buf, sizeof buf, "PASS %s\r", pop3pass);
- lprintf(CTDL_DEBUG, "<PASS <password>\n");
+ CtdlLogPrintf(CTDL_DEBUG, "<PASS <password>\n");
if (sock_puts(sock, buf) <0) goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
if (strncasecmp(buf, "+OK", 3)) goto bail;
if (CtdlThreadCheckStop())
/* Get the list of messages */
snprintf(buf, sizeof buf, "LIST\r");
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
if (strncasecmp(buf, "+OK", 3)) goto bail;
if (CtdlThreadCheckStop())
goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
msg_to_fetch = atoi(buf);
if (msg_to_fetch > 0) {
if (alloc_msgs == 0) {
/* Find out the UIDL of the message, to determine whether we've already downloaded it */
snprintf(buf, sizeof buf, "UIDL %d\r", msglist[i]);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
if (strncasecmp(buf, "+OK", 3)) goto bail;
extract_token(this_uidl, buf, 2, ' ', sizeof this_uidl);
cdbut = cdb_fetch(CDB_USETABLE, utmsgid, strlen(utmsgid));
if (cdbut != NULL) {
/* message has already been seen */
- lprintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
+ CtdlLogPrintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
cdb_free(cdbut);
/* rewrite the record anyway, to update the timestamp */
else {
/* Message has not been seen. Tell the server to fetch the message... */
snprintf(buf, sizeof buf, "RETR %d\r", msglist[i]);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
if (strncasecmp(buf, "+OK", 3)) goto bail;
if (CtdlThreadCheckStop())
body = CtdlReadMessageBody(".", config.c_maxmsglen, NULL, 1, sock);
if (body == NULL) goto bail;
- lprintf(CTDL_DEBUG, "Converting message...\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Converting message...\n");
msg = convert_internet_message(body);
body = NULL; /* yes, this should be dereferenced, NOT freed */
if (!keep) {
snprintf(buf, sizeof buf, "DELE %d\r", msglist[i]);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf); /* errors here are non-fatal */
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf); /* errors here are non-fatal */
}
/* write the uidl to the use table so we don't fetch this message again */
/* Log out */
snprintf(buf, sizeof buf, "QUIT\r");
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (sock_puts(sock, buf) <0) goto bail;
if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
bail: sock_close(sock);
if (msglist) free(msglist);
}
if (doing_pop3client) return;
doing_pop3client = 1;
- lprintf(CTDL_DEBUG, "pop3client started\n");
+ CtdlLogPrintf(CTDL_DEBUG, "pop3client started\n");
ForEachRoom(pop3client_scan_room, NULL);
while (palist != NULL && !CtdlThreadCheckStop()) {
free(pptr);
}
- lprintf(CTDL_DEBUG, "pop3client ended\n");
+ CtdlLogPrintf(CTDL_DEBUG, "pop3client ended\n");
last_run = time(NULL);
doing_pop3client = 0;
}
cdbut = cdb_fetch(CDB_USETABLE, utmsgid, strlen(utmsgid));
if (cdbut != NULL) {
/* Item has already been seen */
- lprintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
+ CtdlLogPrintf(CTDL_DEBUG, "%s has already been seen\n", utmsgid);
cdb_free(cdbut);
/* rewrite the record anyway, to update the timestamp */
}
if ( (!strcasecmp(el, "rss")) || (!strcasecmp(el, "rdf")) ) {
- lprintf(CTDL_DEBUG, "End of feed detected. Closing parser.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "End of feed detected. Closing parser.\n");
ri->done_parsing = 1;
}
/* Parse the URL */
if (parse_url(url, rsshost, &rssport, rssurl) != 0) {
- lprintf(CTDL_ALERT, "Invalid URL: %s\n", url);
+ CtdlLogPrintf(CTDL_ALERT, "Invalid URL: %s\n", url);
}
if (CtdlThreadCheckStop())
xp = XML_ParserCreateNS("UTF-8", ':');
if (!xp) {
- lprintf(CTDL_ALERT, "Cannot create XML parser!\n");
+ CtdlLogPrintf(CTDL_ALERT, "Cannot create XML parser!\n");
return;
}
return;
}
-retry: lprintf(CTDL_NOTICE, "Connecting to <%s>\n", rsshost);
+retry: CtdlLogPrintf(CTDL_NOTICE, "Connecting to <%s>\n", rsshost);
sprintf(buf, "%d", rssport);
sock = sock_connect(rsshost, buf, "tcp");
if (sock >= 0) {
- lprintf(CTDL_DEBUG, "Connected!\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
if (CtdlThreadCheckStop())
goto shutdown ;
snprintf(buf, sizeof buf, "GET %s HTTP/1.0", rssurl);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
sock_puts(sock, buf);
if (CtdlThreadCheckStop())
goto shutdown ;
snprintf(buf, sizeof buf, "Host: %s", rsshost);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
sock_puts(sock, buf);
if (CtdlThreadCheckStop())
goto shutdown ;
snprintf(buf, sizeof buf, "User-Agent: %s", CITADEL);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
sock_puts(sock, buf);
if (CtdlThreadCheckStop())
goto shutdown ;
snprintf(buf, sizeof buf, "Accept: */*");
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
sock_puts(sock, buf);
if (CtdlThreadCheckStop())
goto shutdown ;
if (sock_getln(sock, buf, sizeof buf) >= 0) {
- lprintf(CTDL_DEBUG, ">%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf);
remove_token(buf, 0, ' ');
/* 200 OK */
goto retry;
}
else {
- lprintf(CTDL_ALERT, "Invalid URL: %s\n", buf);
+ CtdlLogPrintf(CTDL_ALERT, "Invalid URL: %s\n", buf);
}
}
}
sock_close(sock);
}
else {
- lprintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
+ CtdlLogPrintf(CTDL_ERR, "Could not connect: %s\n", strerror(errno));
}
XML_ParserFree(xp);
if (doing_rssclient) return NULL;
doing_rssclient = 1;
- lprintf(CTDL_DEBUG, "rssclient started\n");
+ CtdlLogPrintf(CTDL_DEBUG, "rssclient started\n");
ForEachRoom(rssclient_scan_room, NULL);
while (rnclist != NULL && !CtdlThreadCheckStop()) {
free(rptr);
}
- lprintf(CTDL_DEBUG, "rssclient ended\n");
+ CtdlLogPrintf(CTDL_DEBUG, "rssclient ended\n");
last_run = time(NULL);
doing_rssclient = 0;
if (!CtdlThreadCheckStop())
* display who's online
*/
void cmd_rwho(char *argbuf) {
- struct CitContext *cptr;
struct CitContext *nptr;
int nContexts, i;
int spoofed = 0;
*/
int ctdl_debug(sieve2_context_t *s, void *my)
{
- lprintf(CTDL_DEBUG, "Sieve: %s\n", sieve2_getvalue_string(s, "message"));
+ CtdlLogPrintf(CTDL_DEBUG, "Sieve: %s\n", sieve2_getvalue_string(s, "message"));
return SIEVE2_OK;
}
*/
int ctdl_errparse(sieve2_context_t *s, void *my)
{
- lprintf(CTDL_WARNING, "Error in script, line %d: %s\n",
+ CtdlLogPrintf(CTDL_WARNING, "Error in script, line %d: %s\n",
sieve2_getvalue_int(s, "lineno"),
sieve2_getvalue_string(s, "message")
);
*/
int ctdl_errexec(sieve2_context_t *s, void *my)
{
- lprintf(CTDL_WARNING, "Error executing script: %s\n",
+ CtdlLogPrintf(CTDL_WARNING, "Error executing script: %s\n",
sieve2_getvalue_string(s, "message")
);
return SIEVE2_OK;
safestrncpy(recp, sieve2_getvalue_string(s, "address"), sizeof recp);
- lprintf(CTDL_DEBUG, "Action is REDIRECT, recipient <%s>\n", recp);
+ CtdlLogPrintf(CTDL_DEBUG, "Action is REDIRECT, recipient <%s>\n", recp);
valid = validate_recipients(recp, NULL, 0);
if (valid == NULL) {
- lprintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
+ CtdlLogPrintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
return SIEVE2_ERROR_BADARGS;
}
if (valid->num_error > 0) {
- lprintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
+ CtdlLogPrintf(CTDL_WARNING, "REDIRECT failed: bad recipient <%s>\n", recp);
free_recipients(valid);
return SIEVE2_ERROR_BADARGS;
}
msg = CtdlFetchMessage(cs->msgnum, 1);
if (msg == NULL) {
- lprintf(CTDL_WARNING, "REDIRECT failed: unable to fetch msg %ld\n", cs->msgnum);
+ CtdlLogPrintf(CTDL_WARNING, "REDIRECT failed: unable to fetch msg %ld\n", cs->msgnum);
free_recipients(valid);
return SIEVE2_ERROR_BADARGS;
}
{
struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
- lprintf(CTDL_DEBUG, "Action is KEEP\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Action is KEEP\n");
cs->keep = 1;
cs->cancel_implicit_keep = 1;
char foldername[256];
char original_room_name[ROOMNAMELEN];
- lprintf(CTDL_DEBUG, "Action is FILEINTO, destination is <%s>\n", dest_folder);
+ CtdlLogPrintf(CTDL_DEBUG, "Action is FILEINTO, destination is <%s>\n", dest_folder);
/* FILEINTO 'INBOX' is the same thing as KEEP */
if ( (!strcasecmp(dest_folder, "INBOX")) || (!strcasecmp(dest_folder, MAILROOM)) ) {
}
if (c != 0) {
- lprintf(CTDL_WARNING, "FILEINTO failed: target <%s> does not exist\n", dest_folder);
+ CtdlLogPrintf(CTDL_WARNING, "FILEINTO failed: target <%s> does not exist\n", dest_folder);
return SIEVE2_ERROR_BADARGS;
}
{
struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
- lprintf(CTDL_DEBUG, "Action is DISCARD\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Action is DISCARD\n");
/* Cancel the implicit keep. That's all there is to it. */
cs->cancel_implicit_keep = 1;
struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
char *reject_text = NULL;
- lprintf(CTDL_DEBUG, "Action is REJECT\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Action is REJECT\n");
/* If we don't know who sent the message, do a DISCARD instead. */
if (IsEmptyStr(cs->sender)) {
- lprintf(CTDL_INFO, "Unknown sender. Doing DISCARD instead of REJECT.\n");
+ CtdlLogPrintf(CTDL_INFO, "Unknown sender. Doing DISCARD instead of REJECT.\n");
return ctdl_discard(s, my);
}
char *vacamsg_text = NULL;
char vacamsg_subject[1024];
- lprintf(CTDL_DEBUG, "Action is VACATION\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Action is VACATION\n");
message = sieve2_getvalue_string(s, "message");
if (message == NULL) return SIEVE2_ERROR_BADARGS;
for (vptr = cs->u->first_vacation; vptr != NULL; vptr = vptr->next) {
if (!strcasecmp(vptr->fromaddr, cs->sender)) {
if ( (time(NULL) - vptr->timestamp) < (days * 86400) ) {
- lprintf(CTDL_DEBUG, "Already alerted <%s> recently.\n", cs->sender);
+ CtdlLogPrintf(CTDL_DEBUG, "Already alerted <%s> recently.\n", cs->sender);
return SIEVE2_OK;
}
}
{
struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
- lprintf(CTDL_DEBUG, "Action is GETENVELOPE\nEnvFrom: %s\n EnvTo: %s\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Action is GETENVELOPE\nEnvFrom: %s\n EnvTo: %s\n",
cs->envelope_from, cs->envelope_to);
if (cs->envelope_from != NULL) {
for (sptr=cs->u->first_script; sptr!=NULL; sptr=sptr->next) {
if (sptr->script_active > 0) {
- lprintf(CTDL_DEBUG, "ctdl_getscript() is using script '%s'\n", sptr->script_name);
+ CtdlLogPrintf(CTDL_DEBUG, "ctdl_getscript() is using script '%s'\n", sptr->script_name);
sieve2_setvalue_string(s, "script", sptr->script_content);
return SIEVE2_OK;
}
}
- lprintf(CTDL_DEBUG, "ctdl_getscript() found no active script\n");
+ CtdlLogPrintf(CTDL_DEBUG, "ctdl_getscript() found no active script\n");
return SIEVE2_ERROR_GETSCRIPT;
}
struct ctdl_sieve *cs = (struct ctdl_sieve *)my;
- lprintf(CTDL_DEBUG, "ctdl_getheaders() was called\n");
+ CtdlLogPrintf(CTDL_DEBUG, "ctdl_getheaders() was called\n");
sieve2_setvalue_string(s, "allheaders", cs->rfc822headers);
return SIEVE2_OK;
}
ptr->next = sieve_list;
sieve_list = ptr;
end_critical_section(S_SIEVELIST);
- lprintf(CTDL_DEBUG, "<%s> queued for Sieve processing\n", which_room->QRname);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s> queued for Sieve processing\n", which_room->QRname);
}
if (userdata == NULL)
{
- lprintf(CTDL_EMERG, "Cant process Message <%ld>without Userdata!\n", msgnum);
+ CtdlLogPrintf(CTDL_EMERG, "Cant process Message <%ld>without Userdata!\n", msgnum);
return;
}
sieve2_context = u->sieve2_context;
- lprintf(CTDL_DEBUG, "Performing sieve processing on msg <%ld>\n", msgnum);
+ CtdlLogPrintf(CTDL_DEBUG, "Performing sieve processing on msg <%ld>\n", msgnum);
msg = CtdlFetchMessage(msgnum, 0);
if (msg == NULL) return;
sieve2_setvalue_string(sieve2_context, "allheaders", my.rfc822headers);
- lprintf(CTDL_DEBUG, "Calling sieve2_execute()\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Calling sieve2_execute()\n");
res = sieve2_execute(sieve2_context, &my);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_execute() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_execute() returned %d: %s\n", res, sieve2_errstr(res));
}
free(my.rfc822headers);
* if no other action was successfully taken.
*/
if ( (!my.keep) && (my.cancel_implicit_keep) ) {
- lprintf(CTDL_DEBUG, "keep is 0 -- deleting message from inbox\n");
+ CtdlLogPrintf(CTDL_DEBUG, "keep is 0 -- deleting message from inbox\n");
CtdlDeleteMessages(CC->room.QRname, &msgnum, 1, "");
}
- lprintf(CTDL_DEBUG, "Completed sieve processing on msg <%ld>\n", msgnum);
+ CtdlLogPrintf(CTDL_DEBUG, "Completed sieve processing on msg <%ld>\n", msgnum);
u->lastproc = msgnum;
return;
*/
snprintf(u.config_roomname, sizeof u.config_roomname, "%010ld.%s", atol(roomname), USERCONFIGROOM);
if (getroom(&CC->room, u.config_roomname) != 0) {
- lprintf(CTDL_DEBUG, "<%s> does not exist. No processing is required.\n", u.config_roomname);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s> does not exist. No processing is required.\n", u.config_roomname);
return;
}
get_sieve_config_backend, (void *)&u );
if (u.config_msgnum < 0) {
- lprintf(CTDL_DEBUG, "No Sieve rules exist. No processing is required.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "No Sieve rules exist. No processing is required.\n");
return;
}
- lprintf(CTDL_DEBUG, "Rules found. Performing Sieve processing for <%s>\n", roomname);
+ CtdlLogPrintf(CTDL_DEBUG, "Rules found. Performing Sieve processing for <%s>\n", roomname);
if (getroom(&CC->room, roomname) != 0) {
- lprintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", roomname);
+ CtdlLogPrintf(CTDL_CRIT, "ERROR: cannot load <%s>\n", roomname);
return;
}
res = sieve2_alloc(&sieve2_context);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
return;
}
res = sieve2_callbacks(sieve2_context, ctdl_sieve_callbacks);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
goto BAIL;
}
my.u = &u;
res = sieve2_validate(sieve2_context, &my);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_validate() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_validate() returned %d: %s\n", res, sieve2_errstr(res));
goto BAIL;
}
BAIL:
res = sieve2_free(&sieve2_context);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
}
/* Rewrite the config if we have to */
struct RoomProcList *ptr = NULL;
if (sieve_list != NULL) {
- lprintf(CTDL_DEBUG, "Begin Sieve processing\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Begin Sieve processing\n");
while (sieve_list != NULL) {
char spoolroomname[ROOMNAMELEN];
safestrncpy(spoolroomname, sieve_list->name, sizeof spoolroomname);
strcpy(&cred[55], "...");
}
- lprintf(CTDL_INFO, "%s\n",cred);
+ CtdlLogPrintf(CTDL_INFO, "%s\n",cred);
free(cred);
/* Briefly initialize a Sieve parser instance just so we can list the
*/
res = sieve2_alloc(&sieve2_context);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_alloc() returned %d: %s\n", res, sieve2_errstr(res));
return;
}
res = sieve2_callbacks(sieve2_context, ctdl_sieve_callbacks);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_callbacks() returned %d: %s\n", res, sieve2_errstr(res));
goto BAIL;
}
msiv_extensions = strdup(sieve2_listextensions(sieve2_context));
- lprintf(CTDL_INFO, "Extensions: %s\n", msiv_extensions);
+ CtdlLogPrintf(CTDL_INFO, "Extensions: %s\n", msiv_extensions);
BAIL: res = sieve2_free(&sieve2_context);
if (res != SIEVE2_OK) {
- lprintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
+ CtdlLogPrintf(CTDL_CRIT, "sieve2_free() returned %d: %s\n", res, sieve2_errstr(res));
}
}
*/
void smtp_auth_greeting(void) {
cprintf("235 Hello, %s\r\n", CC->user.fullname);
- lprintf(CTDL_NOTICE, "SMTP authenticated %s\n", CC->user.fullname);
+ CtdlLogPrintf(CTDL_NOTICE, "SMTP authenticated %s\n", CC->user.fullname);
CC->internal_pgm = 0;
CC->cs_flags &= ~CS_STEALTH;
}
char username[SIZ];
CtdlDecodeBase64(username, argbuf, SIZ);
- /* lprintf(CTDL_DEBUG, "Trying <%s>\n", username); */
+ /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", username); */
if (CtdlLoginExistingUser(NULL, username) == login_ok) {
CtdlEncodeBase64(buf, "Password:", 9, 0);
cprintf("334 %s\r\n", buf);
char password[SIZ];
CtdlDecodeBase64(password, argbuf, SIZ);
- /* lprintf(CTDL_DEBUG, "Trying <%s>\n", password); */
+ /* CtdlLogPrintf(CTDL_DEBUG, "Trying <%s>\n", password); */
if (CtdlTryPassword(password) == pass_ok) {
smtp_auth_greeting();
}
return;
}
- lprintf(CTDL_DEBUG, "Converting message...\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Converting message...\n");
msg = convert_internet_message(body);
/* If the user is locally authenticated, FORCE the From: header to
time(&CC->lastcmd);
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
- lprintf(CTDL_CRIT, "Client disconnected: ending session.\n");
+ CtdlLogPrintf(CTDL_CRIT, "Client disconnected: ending session.\n");
CC->kill_me = 1;
return;
}
- lprintf(CTDL_INFO, "SMTP: %s\n", cmdbuf);
+ CtdlLogPrintf(CTDL_INFO, "SMTP: %s\n", cmdbuf);
while (strlen(cmdbuf) < 5) strcat(cmdbuf, " ");
if (SMTP->command_state == smtp_user) {
/* Parse out the host portion of the recipient address */
process_rfc822_addr(addr, user, node, name);
- lprintf(CTDL_DEBUG, "Attempting SMTP delivery to <%s> @ <%s> (%s)\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Attempting SMTP delivery to <%s> @ <%s> (%s)\n",
user, node, name);
/* Load the message out of the database */
/* Figure out what mail exchanger host we have to connect to */
num_mxhosts = getmx(mxhosts, node);
- lprintf(CTDL_DEBUG, "Number of MX hosts for <%s> is %d\n", node, num_mxhosts);
+ CtdlLogPrintf(CTDL_DEBUG, "Number of MX hosts for <%s> is %d\n", node, num_mxhosts);
if (num_mxhosts < 1) {
*status = 5;
snprintf(dsn, SIZ, "No MX hosts found for <%s>", node);
else {
strcpy(mx_port, "25");
}
- lprintf(CTDL_DEBUG, "Trying %s : %s ...\n", mx_host, mx_port);
+ CtdlLogPrintf(CTDL_DEBUG, "Trying %s : %s ...\n", mx_host, mx_port);
sock = sock_connect(mx_host, mx_port, "tcp");
snprintf(dsn, SIZ, "Could not connect: %s", strerror(errno));
- if (sock >= 0) lprintf(CTDL_DEBUG, "Connected!\n");
+ if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
if (sock < 0) {
if (errno > 0) {
snprintf(dsn, SIZ, "%s", strerror(errno));
strcpy(dsn, "Connection broken during SMTP conversation");
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
if (buf[0] == '4') {
*status = 4;
/* Do a EHLO command. If it fails, try the HELO command. */
snprintf(buf, sizeof buf, "EHLO %s\r\n", config.c_fqdn);
- lprintf(CTDL_DEBUG, ">%s", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
sock_write(sock, buf, strlen(buf));
if (ml_sock_gets(sock, buf) < 0) {
*status = 4;
strcpy(dsn, "Connection broken during SMTP HELO");
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
snprintf(buf, sizeof buf, "HELO %s\r\n", config.c_fqdn);
- lprintf(CTDL_DEBUG, ">%s", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
sock_write(sock, buf, strlen(buf));
if (ml_sock_gets(sock, buf) < 0) {
*status = 4;
sprintf(buf, "%s%c%s%c%s", mx_user, '\0', mx_user, '\0', mx_pass);
CtdlEncodeBase64(encoded, buf, strlen(mx_user) + strlen(mx_user) + strlen(mx_pass) + 2, 0);
snprintf(buf, sizeof buf, "AUTH PLAIN %s\r\n", encoded);
- lprintf(CTDL_DEBUG, ">%s", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
sock_write(sock, buf, strlen(buf));
if (ml_sock_gets(sock, buf) < 0) {
*status = 4;
strcpy(dsn, "Connection broken during SMTP AUTH");
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
if (buf[0] == '4') {
*status = 4;
/* previous command succeeded, now try the MAIL From: command */
snprintf(buf, sizeof buf, "MAIL From: <%s>\r\n", mailfrom);
- lprintf(CTDL_DEBUG, ">%s", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
sock_write(sock, buf, strlen(buf));
if (ml_sock_gets(sock, buf) < 0) {
*status = 4;
strcpy(dsn, "Connection broken during SMTP MAIL");
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
if (buf[0] == '4') {
*status = 4;
/* MAIL succeeded, now try the RCPT To: command */
snprintf(buf, sizeof buf, "RCPT To: <%s@%s>\r\n", user, node);
- lprintf(CTDL_DEBUG, ">%s", buf);
+ CtdlLogPrintf(CTDL_DEBUG, ">%s", buf);
sock_write(sock, buf, strlen(buf));
if (ml_sock_gets(sock, buf) < 0) {
*status = 4;
strcpy(dsn, "Connection broken during SMTP RCPT");
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '2') {
if (buf[0] == '4') {
*status = 4;
}
/* RCPT succeeded, now try the DATA command */
- lprintf(CTDL_DEBUG, ">DATA\n");
+ CtdlLogPrintf(CTDL_DEBUG, ">DATA\n");
sock_write(sock, "DATA\r\n", 6);
if (ml_sock_gets(sock, buf) < 0) {
*status = 4;
strcpy(dsn, "Connection broken during SMTP DATA");
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (buf[0] != '3') {
if (buf[0] == '4') {
*status = 3;
/* If we reach this point, the server is expecting data */
sock_write(sock, msgtext, msg_size);
if (msgtext[msg_size-1] != 10) {
- lprintf(CTDL_WARNING, "Possible problem: message did not "
+ CtdlLogPrintf(CTDL_WARNING, "Possible problem: message did not "
"correctly terminate. (expecting 0x10, got 0x%02x)\n",
buf[msg_size-1]);
}
strcpy(dsn, "Connection broken during SMTP message transmit");
goto bail;
}
- lprintf(CTDL_DEBUG, "%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "%s\n", buf);
if (buf[0] != '2') {
if (buf[0] == '4') {
*status = 4;
safestrncpy(dsn, &buf[4], 1023);
*status = 2;
- lprintf(CTDL_DEBUG, ">QUIT\n");
+ CtdlLogPrintf(CTDL_DEBUG, ">QUIT\n");
sock_write(sock, "QUIT\r\n", 6);
ml_sock_gets(sock, buf);
- lprintf(CTDL_DEBUG, "<%s\n", buf);
- lprintf(CTDL_INFO, "SMTP delivery to <%s> @ <%s> (%s) succeeded\n",
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_INFO, "SMTP delivery to <%s> @ <%s> (%s) succeeded\n",
user, node, name);
bail: free(msgtext);
size_t omsgsize;
long omsgid = (-1);
- lprintf(CTDL_DEBUG, "smtp_do_bounce() called\n");
+ CtdlLogPrintf(CTDL_DEBUG, "smtp_do_bounce() called\n");
strcpy(bounceto, "");
sprintf(boundary, "=_Citadel_Multipart_%s_%04x%04x", config.c_fqdn, getpid(), ++seq);
lines = num_tokens(instr, '\n');
extract_token(dsn, buf, 3, '|', sizeof dsn);
bounce_this = 0;
- lprintf(CTDL_DEBUG, "key=<%s> addr=<%s> status=%d dsn=<%s>\n",
+ CtdlLogPrintf(CTDL_DEBUG, "key=<%s> addr=<%s> status=%d dsn=<%s>\n",
key, addr, status, dsn);
if (!strcasecmp(key, "bounceto")) {
++num_bounces;
if (bmsg->cm_fields['M'] == NULL) {
- lprintf(CTDL_ERR, "ERROR ... M field is null "
+ CtdlLogPrintf(CTDL_ERR, "ERROR ... M field is null "
"(%s:%d)\n", __FILE__, __LINE__);
}
strcat(bmsg->cm_fields['M'], "--\r\n");
/* Deliver the bounce if there's anything worth mentioning */
- lprintf(CTDL_DEBUG, "num_bounces = %d\n", num_bounces);
+ CtdlLogPrintf(CTDL_DEBUG, "num_bounces = %d\n", num_bounces);
if (num_bounces > 0) {
/* First try the user who sent the message */
- lprintf(CTDL_DEBUG, "bounce to user? <%s>\n", bounceto);
+ CtdlLogPrintf(CTDL_DEBUG, "bounce to user? <%s>\n", bounceto);
if (IsEmptyStr(bounceto)) {
- lprintf(CTDL_ERR, "No bounce address specified\n");
+ CtdlLogPrintf(CTDL_ERR, "No bounce address specified\n");
bounce_msgid = (-1L);
}
}
CtdlFreeMessage(bmsg);
- lprintf(CTDL_DEBUG, "Done processing bounces\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Done processing bounces\n");
}
time_t last_attempted = 0L;
time_t retry = SMTP_RETRY_INTERVAL;
- lprintf(CTDL_DEBUG, "smtp_do_procmsg(%ld)\n", msgnum);
+ CtdlLogPrintf(CTDL_DEBUG, "smtp_do_procmsg(%ld)\n", msgnum);
msg = CtdlFetchMessage(msgnum, 1);
if (msg == NULL) {
- lprintf(CTDL_ERR, "SMTP: tried %ld but no such message!\n", msgnum);
+ CtdlLogPrintf(CTDL_ERR, "SMTP: tried %ld but no such message!\n", msgnum);
return;
}
* Postpone delivery if we've already tried recently.
*/
if (((time(NULL) - last_attempted) < retry) && (run_queue_now == 0)) {
- lprintf(CTDL_DEBUG, "Retry time not yet reached.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Retry time not yet reached.\n");
free(instr);
return;
}
* Bail out if there's no actual message associated with this
*/
if (text_msgid < 0L) {
- lprintf(CTDL_ERR, "SMTP: no 'msgid' directive found!\n");
+ CtdlLogPrintf(CTDL_ERR, "SMTP: no 'msgid' directive found!\n");
free(instr);
return;
}
--i;
--lines;
- lprintf(CTDL_DEBUG, "SMTP: Trying <%s>\n", addr);
+ CtdlLogPrintf(CTDL_DEBUG, "SMTP: Trying <%s>\n", addr);
smtp_try(key, addr, &status, dsn, sizeof dsn, text_msgid);
if (status != 2) {
if (results == NULL) {
/*
* Go ahead and run the queue
*/
- lprintf(CTDL_INFO, "SMTP: processing outbound queue\n");
+ CtdlLogPrintf(CTDL_INFO, "SMTP: processing outbound queue\n");
if (getroom(&CC->room, SMTP_SPOOLOUT_ROOM) != 0) {
- lprintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
+ CtdlLogPrintf(CTDL_ERR, "Cannot find room <%s>\n", SMTP_SPOOLOUT_ROOM);
return;
}
CtdlForEachMessage(MSGS_ALL, 0L, NULL,
SPOOLMIME, NULL, smtp_do_procmsg, NULL);
- lprintf(CTDL_INFO, "SMTP: queue run completed\n");
+ CtdlLogPrintf(CTDL_INFO, "SMTP: queue run completed\n");
run_queue_now = 0;
doing_queue = 0;
}
/* Don't do this stuff if this is not an SMTP session! */
if (CC->h_command_function != smtp_command_loop) return;
- lprintf(CTDL_DEBUG, "Performing SMTP cleanup hook\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Performing SMTP cleanup hook\n");
free(SMTP);
}
/* Try them one by one until we get a working one */
for (sa=0; sa<num_sahosts; ++sa) {
extract_token(buf, sahosts, sa, '|', sizeof buf);
- lprintf(CTDL_INFO, "Connecting to SpamAssassin at <%s>\n", buf);
+ CtdlLogPrintf(CTDL_INFO, "Connecting to SpamAssassin at <%s>\n", buf);
sock = sock_connect(buf, SPAMASSASSIN_PORT, "tcp");
- if (sock >= 0) lprintf(CTDL_DEBUG, "Connected!\n");
+ if (sock >= 0) CtdlLogPrintf(CTDL_DEBUG, "Connected!\n");
}
if (sock < 0) {
}
/* Command */
- lprintf(CTDL_DEBUG, "Transmitting command\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Transmitting command\n");
sprintf(buf, "CHECK SPAMC/1.2\r\n\r\n");
sock_write(sock, buf, strlen(buf));
sock_shutdown(sock, SHUT_WR);
/* Response */
- lprintf(CTDL_DEBUG, "Awaiting response\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Awaiting response\n");
if (sock_getln(sock, buf, sizeof buf) < 0) {
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (strncasecmp(buf, "SPAMD", 5)) {
goto bail;
}
if (sock_getln(sock, buf, sizeof buf) < 0) {
goto bail;
}
- lprintf(CTDL_DEBUG, "<%s\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
if (!strncasecmp(buf, "Spam: True", 10)) {
is_spam = 1;
}
extern struct CitContext *ContextList;
void CleanupTest(void) {
- lprintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n");
+ CtdlLogPrintf(CTDL_DEBUG, "--- test of adding an unload hook --- \n");
}
void NewRoomTest(void) {
- lprintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n");
+ CtdlLogPrintf(CTDL_DEBUG, "--- test module was told we're now in a new room ---\n");
}
void SessionStartTest(void) {
- lprintf(CTDL_DEBUG, "--- starting up session %d ---\n",
+ CtdlLogPrintf(CTDL_DEBUG, "--- starting up session %d ---\n",
CC->cs_pid);
}
void SessionStopTest(void) {
- lprintf(CTDL_DEBUG, "--- ending session %d ---\n",
+ CtdlLogPrintf(CTDL_DEBUG, "--- ending session %d ---\n",
CC->cs_pid);
}
void LoginTest(void) {
- lprintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
+ CtdlLogPrintf(CTDL_DEBUG, "--- Hello, %s ---\n", CC->curr_user);
}
/* To insert this module into the server activate the next block by changing the #if 0 to #if 1 */
while (rplist != NULL) {
if (lgetroom(&qr, rplist->name) == 0) {
- lprintf(CTDL_DEBUG, "Processing <%s>...\n", rplist->name);
+ CtdlLogPrintf(CTDL_DEBUG, "Processing <%s>...\n", rplist->name);
if ( (qr.QRflags & QR_MAILBOX) == 0) {
- lprintf(CTDL_DEBUG, " -- not a mailbox\n");
+ CtdlLogPrintf(CTDL_DEBUG, " -- not a mailbox\n");
}
else {
qr.QRgen = time(NULL);
- lprintf(CTDL_DEBUG, " -- fixed!\n");
+ CtdlLogPrintf(CTDL_DEBUG, " -- fixed!\n");
}
lputroom(&qr);
}
* quick fix to bump mailbox generation numbers
*/
void bump_mailbox_generation_numbers(void) {
- lprintf(CTDL_WARNING, "Applying security fix to mailbox rooms\n");
+ CtdlLogPrintf(CTDL_WARNING, "Applying security fix to mailbox rooms\n");
ForEachRoom(cmd_bmbx_backend, NULL);
cmd_bmbx_backend(NULL, NULL);
return;
while (uplist != NULL) {
if (lgetuser(&us, uplist->user) == 0) {
- lprintf(CTDL_DEBUG, "Processing <%s>...\n", uplist->user);
+ CtdlLogPrintf(CTDL_DEBUG, "Processing <%s>...\n", uplist->user);
if (us.uid == CTDLUID) {
us.uid = (-1);
}
* quick fix to change all CTDLUID users to (-1)
*/
void convert_ctdluid_to_minusone(void) {
- lprintf(CTDL_WARNING, "Applying uid changes\n");
+ CtdlLogPrintf(CTDL_WARNING, "Applying uid changes\n");
ForEachUser(cbtm_backend, NULL);
cbtm_backend(NULL, NULL);
return;
void check_server_upgrades(void) {
get_control();
- lprintf(CTDL_INFO, "Server-hosted upgrade level is %d.%02d\n",
+ CtdlLogPrintf(CTDL_INFO, "Server-hosted upgrade level is %d.%02d\n",
(CitControl.version / 100),
(CitControl.version % 100) );
if (CitControl.version < REV_LEVEL) {
- lprintf(CTDL_WARNING,
+ CtdlLogPrintf(CTDL_WARNING,
"Server hosted updates need to be processed at "
"this time. Please wait...\n");
}
update_config();
if ((CitControl.version > 000) && (CitControl.version < 555)) {
- lprintf(CTDL_EMERG,
+ CtdlLogPrintf(CTDL_EMERG,
"Your data files are from a version of Citadel\n"
"that is too old to be upgraded. Sorry.\n");
exit(EXIT_FAILURE);
Ctx = CC;
artv_global_message_list = fopen(artv_tempfilename1, "r");
if (artv_global_message_list != NULL) {
- lprintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
+ CtdlLogPrintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
while ((Ctx->kill_me != 1) &&
(fgets(buf, sizeof(buf), artv_global_message_list) != NULL)) {
msgnum = atol(buf);
fclose(artv_global_message_list);
}
if (Ctx->kill_me != 1)
- lprintf(CTDL_INFO, "Exported %d messages.\n", count);
+ CtdlLogPrintf(CTDL_INFO, "Exported %d messages.\n", count);
else
- lprintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
+ CtdlLogPrintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
}
void artv_dump_messages(void) {
Ctx = CC;
artv_global_message_list = fopen(artv_tempfilename1, "r");
if (artv_global_message_list != NULL) {
- lprintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
+ CtdlLogPrintf(CTDL_INFO, "Opened %s\n", artv_tempfilename1);
while ((Ctx->kill_me != 1) &&
(fgets(buf, sizeof(buf), artv_global_message_list) != NULL)) {
msgnum = atol(buf);
fclose(artv_global_message_list);
}
if (Ctx->kill_me != 1)
- lprintf(CTDL_INFO, "Exported %d messages.\n", count);
+ CtdlLogPrintf(CTDL_INFO, "Exported %d messages.\n", count);
else
- lprintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
+ CtdlLogPrintf(CTDL_ERR, "Export aborted due to client disconnect! \n");
}
struct config *buf;
buf = &config;
- lprintf(CTDL_DEBUG, "Importing config file\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Importing config file\n");
#include "artv_deserialize.h"
#include "dtds/config-defs.h"
config.c_enable_fulltext = 0; /* always disable */
put_config();
- lprintf(CTDL_INFO, "Imported config file\n");
+ CtdlLogPrintf(CTDL_INFO, "Imported config file\n");
}
void artv_import_control(void) {
char buf[SIZ];
- lprintf(CTDL_DEBUG, "Importing control file\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Importing control file\n");
client_getln(buf, sizeof buf); CitControl.MMhighest = atol(buf);
client_getln(buf, sizeof buf); CitControl.MMflags = atoi(buf);
client_getln(buf, sizeof buf); CitControl.MMnextuser = atol(buf);
client_getln(buf, sizeof buf); CitControl.version = atoi(buf);
CitControl.MMfulltext = (-1L); /* always flush */
put_control();
- lprintf(CTDL_INFO, "Imported control file\n");
+ CtdlLogPrintf(CTDL_INFO, "Imported control file\n");
}
client_getln(cbuf, sizeof cbuf); buf->QRdefaultview = atoi(cbuf);
//*/
putroom(buf);
- lprintf(CTDL_INFO, "Imported room <%s>\n", qrbuf.QRname);
+ CtdlLogPrintf(CTDL_INFO, "Imported room <%s>\n", qrbuf.QRname);
/* format of message list export is all message numbers output
* one per line terminated by a 0.
*/
CtdlSaveMsgPointerInRoom(qrbuf.QRname, msgnum, 0, NULL);
++msgcount;
}
- lprintf(CTDL_INFO, "(%d messages)\n", msgcount);
+ CtdlLogPrintf(CTDL_INFO, "(%d messages)\n", msgcount);
}
client_getln(cbuf, sizeof cbuf); buf->f_ep.expire_value = atoi(cbuf);
//*/
putfloor(buf, i);
- lprintf(CTDL_INFO, "Imported floor #%d (%s)\n", i, flbuf.f_name);
+ CtdlLogPrintf(CTDL_INFO, "Imported floor #%d (%s)\n", i, flbuf.f_name);
}
client_getln(buf, sizeof buf); vbuf.v_flags = atoi(buf);
client_getln(buf, sizeof buf); vbuf.v_view = atoi(buf);
put_visit(&vbuf);
- lprintf(CTDL_INFO, "Imported visit %ld/%ld/%ld\n",
+ CtdlLogPrintf(CTDL_INFO, "Imported visit %ld/%ld/%ld\n",
vbuf.v_roomnum, vbuf.v_roomgen, vbuf.v_usernum);
}
client_getln(buf, sizeof buf); smi.meta_refcount = atoi(buf);
client_getln(smi.meta_content_type, sizeof smi.meta_content_type);
- lprintf(CTDL_INFO, "message #%ld\n", msgnum);
+ CtdlLogPrintf(CTDL_INFO, "message #%ld\n", msgnum);
/* decode base64 message text */
CtdlMakeTempFileName(tempfile, sizeof tempfile);
fseek(fp, 0L, SEEK_END);
msglen = ftell(fp);
fclose(fp);
- lprintf(CTDL_DEBUG, "msglen = %ld\n", msglen);
+ CtdlLogPrintf(CTDL_DEBUG, "msglen = %ld\n", msglen);
mbuf = malloc(msglen);
fp = fopen(tempfile, "rb");
unlink(tempfile);
PutMetaData(&smi);
- lprintf(CTDL_INFO, "Imported message %ld\n", msgnum);
+ CtdlLogPrintf(CTDL_INFO, "Imported message %ld\n", msgnum);
}
iterations = 0;
while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
- lprintf(CTDL_DEBUG, "import keyword: <%s>\n", buf);
+ CtdlLogPrintf(CTDL_DEBUG, "import keyword: <%s>\n", buf);
if ((abuf[0] == '\0') || (strcasecmp(buf, abuf))) {
cprintf ("\n\nImporting datatype %s\n", buf);
strncpy (abuf, buf, SIZ);
client_getln(s_version, sizeof s_version);
version = atoi(s_version);
if ((version<EXPORT_REV_MIN) || (version>REV_LEVEL)) {
- lprintf(CTDL_ERR, "Version mismatch in ARTV import; aborting\n");
+ CtdlLogPrintf(CTDL_ERR, "Version mismatch in ARTV import; aborting\n");
break;
}
}
else break;
iterations ++;
}
- lprintf(CTDL_INFO, "Invalid keyword <%s>. Flushing input.\n", buf);
+ CtdlLogPrintf(CTDL_INFO, "Invalid keyword <%s>. Flushing input.\n", buf);
while (client_getln(buf, sizeof buf), strcmp(buf, "000")) ;;
rebuild_euid_index();
}
(void) CtdlDoDirectoryServiceFunc(ldap_dn, NULL, &objectlist, "ldap", DIRECTORY_SAVE_OBJECT);
(void) CtdlDoDirectoryServiceFunc(NULL, NULL, &objectlist, "ldap", DIRECTORY_FREE_OBJECT);
- lprintf(CTDL_DEBUG, "Directory Services write operation complete.\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Directory Services write operation complete.\n");
}
* probably just the networker or something.
*/
if (CC->logged_in) {
- lprintf(CTDL_DEBUG, "Checking for <%s>...\n", internet_addr);
+ CtdlLogPrintf(CTDL_DEBUG, "Checking for <%s>...\n", internet_addr);
if (CtdlDirectoryLookup(buf, internet_addr, sizeof buf) == 0) {
if (strcasecmp(buf, citadel_addr)) {
/* This address belongs to someone else.
* Bail out silently without saving.
*/
- lprintf(CTDL_DEBUG, "DOOP!\n");
+ CtdlLogPrintf(CTDL_DEBUG, "DOOP!\n");
return;
}
}
}
- lprintf(CTDL_INFO, "Adding %s (%s) to directory\n",
+ CtdlLogPrintf(CTDL_INFO, "Adding %s (%s) to directory\n",
citadel_addr, internet_addr);
CtdlDirectoryAddUser(internet_addr, citadel_addr);
}
if ( (!strcasecmp(cbtype, "text/x-vcard"))
|| (!strcasecmp(cbtype, "text/vcard")) ) {
- lprintf(CTDL_DEBUG, "Part %s contains a vCard! Loading...\n", partnum);
+ CtdlLogPrintf(CTDL_DEBUG, "Part %s contains a vCard! Loading...\n", partnum);
if (*v != NULL) {
vcard_free(*v);
}
}
s = vcard_get_prop(v, "FN", 0, 0, 0);
- if (s) lprintf(CTDL_DEBUG, "vCard beforesave hook running for <%s>\n", s);
+ if (s) CtdlLogPrintf(CTDL_DEBUG, "vCard beforesave hook running for <%s>\n", s);
if (yes_my_citadel_config) {
/* Bingo! The user is uploading a new vCard, so
struct vCard *v;
vcard_fn_to_n(vname, usbuf->fullname, sizeof vname);
- lprintf(CTDL_DEBUG, "Converted <%s> to <%s>\n", usbuf->fullname, vname);
+ CtdlLogPrintf(CTDL_DEBUG, "Converted <%s> to <%s>\n", usbuf->fullname, vname);
/* Create and save the vCard */
v = vcard_new();
time(&CC->lastcmd);
memset(cmdbuf, 0, sizeof cmdbuf); /* Clear it, just in case */
if (client_getln(cmdbuf, sizeof cmdbuf) < 1) {
- lprintf(CTDL_CRIT, "Client disconnected: ending session.\n");
+ CtdlLogPrintf(CTDL_CRIT, "Client disconnected: ending session.\n");
CC->kill_me = 1;
return;
}
- lprintf(CTDL_INFO, ": %s\n", cmdbuf);
+ CtdlLogPrintf(CTDL_INFO, ": %s\n", cmdbuf);
while (strlen(cmdbuf) < 3) strcat(cmdbuf, " ");
if (strcasecmp(cmdbuf, "GET "));
{
cprintf("200 OK %s\n", internet_addr);
- lprintf(CTDL_INFO, "sending 200 OK for the room %s\n", rcpt->display_recp);
+ CtdlLogPrintf(CTDL_INFO, "sending 200 OK for the room %s\n", rcpt->display_recp);
}
else
{
cprintf("500 REJECT noone here by that name.\n");
- lprintf(CTDL_INFO, "sending 500 REJECT noone here by that name: %s\n", internet_addr);
+ CtdlLogPrintf(CTDL_INFO, "sending 500 REJECT noone here by that name: %s\n", internet_addr);
}
if (rcpt != NULL) free_recipients(rcpt);
}
/* Set expiration policy to manual; otherwise objects will be lost! */
if (lgetroom(&qr, USERCONTACTSROOM)) {
- lprintf(CTDL_ERR, "Couldn't get the user CONTACTS room!\n");
+ CtdlLogPrintf(CTDL_ERR, "Couldn't get the user CONTACTS room!\n");
return;
}
qr.QRep.expire_mode = EXPIRE_MANUAL;
}
vcard_free(v);
- lprintf(CTDL_DEBUG, "Adding contact: %s\n", recipient);
+ CtdlLogPrintf(CTDL_DEBUG, "Adding contact: %s\n", recipient);
vmsgnum = CtdlSubmitMsg(vmsg, NULL, aptr->roomname);
CtdlFreeMessage(vmsg);
}
}
if (strcasecmp(original_name, name)) {
- lprintf(CTDL_INFO, "%s is being forwarded to %s\n", original_name, name);
+ CtdlLogPrintf(CTDL_INFO, "%s is being forwarded to %s\n", original_name, name);
}
/* Change "user @ xxx" to "user" if xxx is an alias for this host */
if (name[a] == '@') {
if (CtdlHostAlias(&name[a+1]) == hostalias_localhost) {
name[a] = 0;
- lprintf(CTDL_INFO, "Changed to <%s>\n", name);
+ CtdlLogPrintf(CTDL_INFO, "Changed to <%s>\n", name);
}
}
}
return;
}
- lprintf(CTDL_DEBUG, "CtdlSetSeen(%d msgs starting with %ld, %d, %d)\n",
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlSetSeen(%d msgs starting with %ld, %d, %d)\n",
num_target_msgnums, target_msgnums[0],
target_setting, which_set);
break;
}
- /* lprintf(CTDL_DEBUG, "before optimize: %s\n", vset); */
+ /* CtdlLogPrintf(CTDL_DEBUG, "before optimize: %s\n", vset); */
/* Translate the existing sequence set into an array of booleans */
num_sets = num_tokens(vset, ',');
}
free(is_set);
- /* lprintf(CTDL_DEBUG, " after optimize: %s\n", vset); */
+ /* CtdlLogPrintf(CTDL_DEBUG, " after optimize: %s\n", vset); */
free(msglist);
CtdlSetRelationship(&vbuf,
((which_user != NULL) ? which_user : &CC->user),
cit_uint8_t ch;
cit_uint8_t field_header;
- lprintf(CTDL_DEBUG, "CtdlFetchMessage(%ld, %d)\n", msgnum, with_body);
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlFetchMessage(%ld, %d)\n", msgnum, with_body);
dmsgtext = cdb_fetch(CDB_MSGMAIN, &msgnum, sizeof(long));
if (dmsgtext == NULL) {
*/
ch = *mptr++;
if (ch != 255) {
- lprintf(CTDL_ERR, "Message %ld appears to be corrupted.\n", msgnum);
+ CtdlLogPrintf(CTDL_ERR, "Message %ld appears to be corrupted.\n", msgnum);
cdb_free(dmsgtext);
return NULL;
}
if (msg == NULL)
return 0;
if ((msg->cm_magic) != CTDLMESSAGE_MAGIC) {
- lprintf(CTDL_WARNING, "is_valid_message() -- self-check failed\n");
+ CtdlLogPrintf(CTDL_WARNING, "is_valid_message() -- self-check failed\n");
return 0;
}
return 1;
struct ma_info *ma;
ma = (struct ma_info *)cbuserdata;
- lprintf(CTDL_DEBUG, "fixed_output_pre() type=<%s>\n", cbtype);
+ CtdlLogPrintf(CTDL_DEBUG, "fixed_output_pre() type=<%s>\n", cbtype);
if (!strcasecmp(cbtype, "multipart/alternative")) {
++ma->is_ma;
ma->did_print = 0;
struct ma_info *ma;
ma = (struct ma_info *)cbuserdata;
- lprintf(CTDL_DEBUG, "fixed_output_post() type=<%s>\n", cbtype);
+ CtdlLogPrintf(CTDL_DEBUG, "fixed_output_post() type=<%s>\n", cbtype);
if (!strcasecmp(cbtype, "multipart/alternative")) {
--ma->is_ma;
ma->did_print = 0;
ma = (struct ma_info *)cbuserdata;
- lprintf(CTDL_DEBUG,
+ CtdlLogPrintf(CTDL_DEBUG,
"fixed_output() part %s: %s (%s) (%ld bytes)\n",
partnum, filename, cbtype, (long)length);
* we've already printed another section, skip this one.
*/
if ( (ma->is_ma) && (ma->did_print) ) {
- lprintf(CTDL_DEBUG, "Skipping part %s (%s)\n", partnum, cbtype);
+ CtdlLogPrintf(CTDL_DEBUG, "Skipping part %s (%s)\n", partnum, cbtype);
return;
}
ma->did_print = 1;
extract_token(buf, CC->preferred_formats, i, '|', sizeof buf);
if ( (!strcasecmp(buf, cbtype)) && (!ma->freeze) ) {
if (i < ma->chosen_pref) {
- lprintf(CTDL_DEBUG, "Setting chosen part: <%s>\n", partnum);
+ CtdlLogPrintf(CTDL_DEBUG, "Setting chosen part: <%s>\n", partnum);
safestrncpy(ma->chosen_part, partnum, sizeof ma->chosen_part);
ma->chosen_pref = i;
}
int retcode = om_no_such_msg;
struct encapmsg encap;
- lprintf(CTDL_DEBUG, "CtdlOutputMsg() msgnum=%ld, mode=%d, section=%s\n",
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlOutputMsg() msgnum=%ld, mode=%d, section=%s\n",
msg_num, mode,
(section ? section : "<>")
);
char mid[100];
char datestamp[100];
- lprintf(CTDL_DEBUG, "CtdlOutputPreLoadedMsg(TheMessage=%s, %d, %d, %d, %d\n",
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlOutputPreLoadedMsg(TheMessage=%s, %d, %d, %d, %d\n",
((TheMessage == NULL) ? "NULL" : "not null"),
mode, headers_only, do_proto, crlf);
nl = (crlf ? "\r\n" : "\n");
if (!is_valid_message(TheMessage)) {
- lprintf(CTDL_ERR,
+ CtdlLogPrintf(CTDL_ERR,
"ERROR: invalid preloaded message for output\n");
return(om_no_such_msg);
}
long *msgs_to_be_merged = NULL;
int num_msgs_to_be_merged = 0;
- lprintf(CTDL_DEBUG,
+ CtdlLogPrintf(CTDL_DEBUG,
"CtdlSaveMsgPointersInRoom(room=%s, num_msgs=%d, repl=%d)\n",
roomname, num_newmsgs, do_repl_check);
if (lgetroom(&CC->room,
((roomname != NULL) ? roomname : CC->room.QRname) )
!= 0) {
- lprintf(CTDL_ERR, "No such room <%s>\n", roomname);
+ CtdlLogPrintf(CTDL_ERR, "No such room <%s>\n", roomname);
return(ERROR + ROOM_NOT_FOUND);
}
}
}
- lprintf(9, "%d unique messages to be merged\n", num_msgs_to_be_merged);
+ CtdlLogPrintf(9, "%d unique messages to be merged\n", num_msgs_to_be_merged);
/*
* Now merge the new messages
*/
msglist = realloc(msglist, (sizeof(long) * (num_msgs + num_msgs_to_be_merged)) );
if (msglist == NULL) {
- lprintf(CTDL_ALERT, "ERROR: can't realloc message list!\n");
+ CtdlLogPrintf(CTDL_ALERT, "ERROR: can't realloc message list!\n");
}
memcpy(&msglist[num_msgs], msgs_to_be_merged, (sizeof(long) * num_msgs_to_be_merged) );
num_msgs += num_msgs_to_be_merged;
/* Perform replication checks if necessary */
if ( (DoesThisRoomNeedEuidIndexing(&CC->room)) && (do_repl_check) ) {
- lprintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() doing repl checks\n");
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() doing repl checks\n");
for (i=0; i<num_msgs_to_be_merged; ++i) {
msgid = msgs_to_be_merged[i];
}
else {
- lprintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() skips repl checks\n");
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlSaveMsgPointerInRoom() skips repl checks\n");
}
/* Submit this room for processing by hooks */
/* Write our little bundle of joy into the message base */
if (cdb_store(CDB_MSGMAIN, &newmsgid, (int)sizeof(long),
smr.ser, smr.len) < 0) {
- lprintf(CTDL_ERR, "Can't store message\n");
+ CtdlLogPrintf(CTDL_ERR, "Can't store message\n");
retval = 0L;
} else {
if (is_bigmsg) {
* Check for valid message format
*/
if (is_valid_message(msg) == 0) {
- lprintf(CTDL_ERR, "serialize_message() aborting due to invalid message\n");
+ CtdlLogPrintf(CTDL_ERR, "serialize_message() aborting due to invalid message\n");
ret->len = 0;
ret->ser = NULL;
return;
ret->ser = malloc(ret->len);
if (ret->ser == NULL) {
- lprintf(CTDL_ERR, "serialize_message() malloc(%ld) failed: %s\n",
+ CtdlLogPrintf(CTDL_ERR, "serialize_message() malloc(%ld) failed: %s\n",
(long)ret->len, strerror(errno));
ret->len = 0;
ret->ser = NULL;
safestrncpy((char *)&ret->ser[wlen], msg->cm_fields[(int)forder[i]], fieldlen+1);
wlen = wlen + fieldlen + 1;
}
- if (ret->len != wlen) lprintf(CTDL_ERR, "ERROR: len=%ld wlen=%ld\n",
+ if (ret->len != wlen) CtdlLogPrintf(CTDL_ERR, "ERROR: len=%ld wlen=%ld\n",
(long)ret->len, (long)wlen);
return;
* Check for valid message format
*/
if (is_valid_message(msg) == 0) {
- lprintf(CTDL_ERR, "dump_message() aborting due to invalid message\n");
+ CtdlLogPrintf(CTDL_ERR, "dump_message() aborting due to invalid message\n");
return;
}
if (DoesThisRoomNeedEuidIndexing(&CC->room) == 0) return;
- lprintf(CTDL_DEBUG, "Performing replication checks in <%s>\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Performing replication checks in <%s>\n",
CC->room.QRname);
/* No exclusive id? Don't do anything. */
if (msg == NULL) return;
if (msg->cm_fields['E'] == NULL) return;
if (IsEmptyStr(msg->cm_fields['E'])) return;
- /*lprintf(CTDL_DEBUG, "Exclusive ID: <%s> for room <%s>\n",
+ /*CtdlLogPrintf(CTDL_DEBUG, "Exclusive ID: <%s> for room <%s>\n",
msg->cm_fields['E'], CC->room.QRname);*/
old_msgnum = locate_message_by_euid(msg->cm_fields['E'], &CC->room);
if (old_msgnum > 0L) {
- lprintf(CTDL_DEBUG, "ReplicationChecks() replacing message %ld\n", old_msgnum);
+ CtdlLogPrintf(CTDL_DEBUG, "ReplicationChecks() replacing message %ld\n", old_msgnum);
CtdlDeleteMessages(CC->room.QRname, &old_msgnum, 1, "");
}
}
int qualified_for_journaling = 0;
struct CitContext *CCC = CC; /* CachedCitContext - performance boost */
- lprintf(CTDL_DEBUG, "CtdlSubmitMsg() called\n");
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlSubmitMsg() called\n");
if (is_valid_message(msg) == 0) return(-1); /* self check */
/* If this message has no timestamp, we take the liberty of
/* Learn about what's inside, because it's what's inside that counts */
if (msg->cm_fields['M'] == NULL) {
- lprintf(CTDL_ERR, "ERROR: attempt to save message with NULL body\n");
+ CtdlLogPrintf(CTDL_ERR, "ERROR: attempt to save message with NULL body\n");
return(-2);
}
}
/* Goto the correct room */
- lprintf(CTDL_DEBUG, "Selected room %s\n", (recps) ? CCC->room.QRname : SENTITEMS);
+ CtdlLogPrintf(CTDL_DEBUG, "Selected room %s\n", (recps) ? CCC->room.QRname : SENTITEMS);
strcpy(hold_rm, CCC->room.QRname);
strcpy(actual_rm, CCC->room.QRname);
if (recps != NULL) {
if (CCC->user.axlevel == 2) {
strcpy(hold_rm, actual_rm);
strcpy(actual_rm, config.c_twitroom);
- lprintf(CTDL_DEBUG, "Diverting to twit room\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Diverting to twit room\n");
}
}
strcpy(actual_rm, force_room);
}
- lprintf(CTDL_DEBUG, "Final selection: %s\n", actual_rm);
+ CtdlLogPrintf(CTDL_DEBUG, "Final selection: %s\n", actual_rm);
if (strcasecmp(actual_rm, CCC->room.QRname)) {
/* getroom(&CCC->room, actual_rm); */
usergoto(actual_rm, 0, 1, NULL, NULL);
}
/* Perform "before save" hooks (aborting if any return nonzero) */
- lprintf(CTDL_DEBUG, "Performing before-save hooks\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Performing before-save hooks\n");
if (PerformMessageHooks(msg, EVT_BEFORESAVE) > 0) return(-3);
/*
}
/* Save it to disk */
- lprintf(CTDL_DEBUG, "Saving to disk\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Saving to disk\n");
newmsgid = send_message(msg);
if (newmsgid <= 0L) return(-5);
* be a critical section because nobody else knows about this message
* yet.
*/
- lprintf(CTDL_DEBUG, "Creating MetaData record\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Creating MetaData record\n");
memset(&smi, 0, sizeof(struct MetaData));
smi.meta_msgnum = newmsgid;
smi.meta_refcount = 0;
* message to attach to the journalized copy.
*/
if (CCC->redirect_buffer != NULL) {
- lprintf(CTDL_ALERT, "CCC->redirect_buffer is not NULL during message submission!\n");
+ CtdlLogPrintf(CTDL_ALERT, "CCC->redirect_buffer is not NULL during message submission!\n");
abort();
}
CCC->redirect_buffer = malloc(SIZ);
PutMetaData(&smi);
/* Now figure out where to store the pointers */
- lprintf(CTDL_DEBUG, "Storing pointers\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Storing pointers\n");
/* If this is being done by the networker delivering a private
* message, we want to BYPASS saving the sender's copy (because there
*/
if ((!CCC->internal_pgm) || (recps == NULL)) {
if (CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 1, msg) != 0) {
- lprintf(CTDL_ERR, "ERROR saving message pointer!\n");
+ CtdlLogPrintf(CTDL_ERR, "ERROR saving message pointer!\n");
CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
}
}
for (i=0; i<num_tokens(recps->recp_room, '|'); ++i) {
extract_token(recipient, recps->recp_room, i,
'|', sizeof recipient);
- lprintf(CTDL_DEBUG, "Delivering to room <%s>\n", recipient);
+ CtdlLogPrintf(CTDL_DEBUG, "Delivering to room <%s>\n", recipient);
CtdlSaveMsgPointerInRoom(recipient, newmsgid, 0, msg);
}
/* Bump this user's messages posted counter. */
- lprintf(CTDL_DEBUG, "Updating user\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Updating user\n");
lgetuser(&CCC->user, CCC->curr_user);
CCC->user.posted = CCC->user.posted + 1;
lputuser(&CCC->user);
for (i=0; i<num_tokens(recps->recp_local, '|'); ++i) {
extract_token(recipient, recps->recp_local, i,
'|', sizeof recipient);
- lprintf(CTDL_DEBUG, "Delivering private local mail to <%s>\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Delivering private local mail to <%s>\n",
recipient);
if (getuser(&userbuf, recipient) == 0) {
// Add a flag so the Funambol module knows its mail
}
}
else {
- lprintf(CTDL_DEBUG, "No user <%s>\n", recipient);
+ CtdlLogPrintf(CTDL_DEBUG, "No user <%s>\n", recipient);
CtdlSaveMsgPointerInRoom(config.c_aideroom,
newmsgid, 0, msg);
}
}
/* Perform "after save" hooks */
- lprintf(CTDL_DEBUG, "Performing after-save hooks\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Performing after-save hooks\n");
PerformMessageHooks(msg, EVT_AFTERSAVE);
/* For IGnet mail, we have to save a new copy into the spooler for
}
/* Go back to the room we started from */
- lprintf(CTDL_DEBUG, "Returning to original room %s\n", hold_rm);
+ CtdlLogPrintf(CTDL_DEBUG, "Returning to original room %s\n", hold_rm);
if (strcasecmp(hold_rm, CCC->room.QRname))
usergoto(hold_rm, 0, 1, NULL, NULL);
*/
if (recps != NULL)
if (recps->num_internet > 0) {
- lprintf(CTDL_DEBUG, "Generating delivery instructions\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Generating delivery instructions\n");
instr_alloc = 1024;
instr = malloc(instr_alloc);
snprintf(instr, instr_alloc,
} else {
buffer_len = (buffer_len * 2);
m = ptr;
- lprintf(CTDL_DEBUG, "buffer_len is now %ld\n", (long)buffer_len);
+ CtdlLogPrintf(CTDL_DEBUG, "buffer_len is now %ld\n", (long)buffer_len);
}
}
striplt(this_recp);
if (IsEmptyStr(this_recp))
break;
- lprintf(CTDL_DEBUG, "Evaluating recipient #%d: %s\n", num_recps, this_recp);
+ CtdlLogPrintf(CTDL_DEBUG, "Evaluating recipient #%d: %s\n", num_recps, this_recp);
++num_recps;
mailtype = alias(this_recp);
mailtype = alias(this_recp);
strcpy(ret->errormsg, "No recipients specified.");
}
- lprintf(CTDL_DEBUG, "validate_recipients()\n");
- lprintf(CTDL_DEBUG, " local: %d <%s>\n", ret->num_local, ret->recp_local);
- lprintf(CTDL_DEBUG, " room: %d <%s>\n", ret->num_room, ret->recp_room);
- lprintf(CTDL_DEBUG, " inet: %d <%s>\n", ret->num_internet, ret->recp_internet);
- lprintf(CTDL_DEBUG, " ignet: %d <%s>\n", ret->num_ignet, ret->recp_ignet);
- lprintf(CTDL_DEBUG, " error: %d <%s>\n", ret->num_error, ret->errormsg);
+ CtdlLogPrintf(CTDL_DEBUG, "validate_recipients()\n");
+ CtdlLogPrintf(CTDL_DEBUG, " local: %d <%s>\n", ret->num_local, ret->recp_local);
+ CtdlLogPrintf(CTDL_DEBUG, " room: %d <%s>\n", ret->num_room, ret->recp_room);
+ CtdlLogPrintf(CTDL_DEBUG, " inet: %d <%s>\n", ret->num_internet, ret->recp_internet);
+ CtdlLogPrintf(CTDL_DEBUG, " ignet: %d <%s>\n", ret->num_ignet, ret->recp_ignet);
+ CtdlLogPrintf(CTDL_DEBUG, " error: %d <%s>\n", ret->num_error, ret->errormsg);
free(recipients);
return(ret);
}
if (valid->recptypes_magic != RECPTYPES_MAGIC) {
- lprintf(CTDL_EMERG, "Attempt to call free_recipients() on some other data type!\n");
+ CtdlLogPrintf(CTDL_EMERG, "Attempt to call free_recipients() on some other data type!\n");
abort();
}
regcomp(&re, content_type, 0);
need_to_free_re = 1;
}
- lprintf(CTDL_DEBUG, "CtdlDeleteMessages(%s, %d msgs, %s)\n",
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlDeleteMessages(%s, %d msgs, %s)\n",
room_name, num_dmsgnums, content_type);
/* get room record, obtaining a lock... */
if (lgetroom(&qrbuf, room_name) != 0) {
- lprintf(CTDL_ERR, "CtdlDeleteMessages(): Room <%s> not found\n",
+ CtdlLogPrintf(CTDL_ERR, "CtdlDeleteMessages(): Room <%s> not found\n",
room_name);
if (need_to_free_re) regfree(&re);
return (0); /* room not found */
/* Now free the memory we used, and go away. */
if (msglist != NULL) free(msglist);
if (dellist != NULL) free(dellist);
- lprintf(CTDL_DEBUG, "%d message(s) deleted.\n", num_deleted);
+ CtdlLogPrintf(CTDL_DEBUG, "%d message(s) deleted.\n", num_deleted);
if (need_to_free_re) regfree(&re);
return (num_deleted);
}
/* msgnum < 0 means that we're trying to close the file */
if (msgnum < 0) {
- lprintf(CTDL_DEBUG, "Closing the AdjRefCount queue file\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Closing the AdjRefCount queue file\n");
begin_critical_section(S_SUPPMSGMAIN);
if (arcfp != NULL) {
fclose(arcfp);
r = link(file_arcq, file_arcq_temp);
if (r != 0) {
- lprintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
+ CtdlLogPrintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
end_critical_section(S_SUPPMSGMAIN);
return(num_records_processed);
}
fp = fopen(file_arcq_temp, "rb");
if (fp == NULL) {
- lprintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
+ CtdlLogPrintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
return(num_records_processed);
}
fclose(fp);
r = unlink(file_arcq_temp);
if (r != 0) {
- lprintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
+ CtdlLogPrintf(CTDL_CRIT, "%s: %s\n", file_arcq_temp, strerror(errno));
}
return(num_records_processed);
smi.meta_refcount += incr;
PutMetaData(&smi);
end_critical_section(S_SUPPMSGMAIN);
- lprintf(CTDL_DEBUG, "msg %ld ref count delta %d, is now %d\n",
+ CtdlLogPrintf(CTDL_DEBUG, "msg %ld ref count delta %d, is now %d\n",
msgnum, incr, smi.meta_refcount);
/* If the reference count is now zero, delete the message
* (and its supplementary record as well).
*/
if (smi.meta_refcount == 0) {
- lprintf(CTDL_DEBUG, "Deleting message <%ld>\n", msgnum);
+ CtdlLogPrintf(CTDL_DEBUG, "Deleting message <%ld>\n", msgnum);
/* Call delete hooks with NULL room to show it has gone altogether */
PerformDeleteHooks(NULL, msgnum);
fp = fopen(tempfilename, "rb");
if (fp == NULL) {
- lprintf(CTDL_CRIT, "Cannot open %s: %s\n",
+ CtdlLogPrintf(CTDL_CRIT, "Cannot open %s: %s\n",
tempfilename, strerror(errno));
return;
}
fseek(fp, 0L, SEEK_END);
raw_length = ftell(fp);
rewind(fp);
- lprintf(CTDL_DEBUG, "Raw length is %ld\n", (long)raw_length);
+ CtdlLogPrintf(CTDL_DEBUG, "Raw length is %ld\n", (long)raw_length);
raw_message = malloc((size_t)raw_length + 2);
fread(raw_message, (size_t)raw_length, 1, fp);
free(raw_message);
- lprintf(CTDL_DEBUG, "Allocating\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Allocating\n");
msg = malloc(sizeof(struct CtdlMessage));
memset(msg, 0, sizeof(struct CtdlMessage));
msg->cm_magic = CTDLMESSAGE_MAGIC;
* other objects of this type that are currently in the room.
*/
if (is_unique) {
- lprintf(CTDL_DEBUG, "Deleted %d other msgs of this type\n",
+ CtdlLogPrintf(CTDL_DEBUG, "Deleted %d other msgs of this type\n",
CtdlDeleteMessages(roomname, NULL, 0, content_type)
);
}
if (retmsgs != NULL) *retmsgs = total_messages;
if (retnew != NULL) *retnew = new_messages;
- lprintf(CTDL_DEBUG, "<%s> %d new of %d total messages\n",
+ CtdlLogPrintf(CTDL_DEBUG, "<%s> %d new of %d total messages\n",
CC->room.QRname,
new_messages, total_messages
);
((ra & UA_KNOWN) == 0) &&
(CC->user.axlevel < 6)
) {
- lprintf(CTDL_DEBUG, "Failed to acquire private room\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Failed to acquire private room\n");
} else {
memcpy(&CC->room, &QRscratch,
sizeof(struct ctdlroom));
long owner = 0L;
char actual_old_name[ROOMNAMELEN];
- lprintf(CTDL_DEBUG, "CtdlRenameRoom(%s, %s, %d)\n",
+ CtdlLogPrintf(CTDL_DEBUG, "CtdlRenameRoom(%s, %s, %d)\n",
old_name, new_name, new_floor);
if (new_floor >= 0) {
lgetfloor(&flbuf, old_floor);
--flbuf.f_ref_count;
lputfloor(&flbuf, old_floor);
- lprintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", old_floor, flbuf.f_ref_count);
+ CtdlLogPrintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", old_floor, flbuf.f_ref_count);
lgetfloor(&flbuf, new_floor);
++flbuf.f_ref_count;
lputfloor(&flbuf, new_floor);
- lprintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", new_floor, flbuf.f_ref_count);
+ CtdlLogPrintf(CTDL_DEBUG, "Reference count for floor %d is now %d\n", new_floor, flbuf.f_ref_count);
}
/* ...and everybody say "YATTA!" */
char old_name[ROOMNAMELEN];
static int seq = 0;
- lprintf(CTDL_NOTICE, "Scheduling room <%s> for deletion\n",
+ CtdlLogPrintf(CTDL_NOTICE, "Scheduling room <%s> for deletion\n",
qrbuf->QRname);
safestrncpy(old_name, qrbuf->QRname, sizeof old_name);
char filename[100];
/* TODO: filename magic? does this realy work? */
- lprintf(CTDL_NOTICE, "Deleting room <%s>\n", qrbuf->QRname);
+ CtdlLogPrintf(CTDL_NOTICE, "Deleting room <%s>\n", qrbuf->QRname);
/* Delete the info file */
assoc_file_name(filename, sizeof filename, qrbuf, ctdl_info_dir);
struct floor flbuf;
struct visit vbuf;
- lprintf(CTDL_DEBUG, "create_room(name=%s, type=%d, view=%d)\n",
+ CtdlLogPrintf(CTDL_DEBUG, "create_room(name=%s, type=%d, view=%d)\n",
new_room_name, new_room_type, new_room_view);
if (getroom(&qrbuf, new_room_name) == 0) {
- lprintf(CTDL_DEBUG, "%s already exists.\n", new_room_name);
+ CtdlLogPrintf(CTDL_DEBUG, "%s already exists.\n", new_room_name);
return(0);
}
return;
}
assoc_file_name(infofilename, sizeof infofilename, &CC->room, ctdl_info_dir);
- lprintf(CTDL_DEBUG, "opening\n");
+ CtdlLogPrintf(CTDL_DEBUG, "opening\n");
fp = fopen(infofilename, "w");
- lprintf(CTDL_DEBUG, "checking\n");
+ CtdlLogPrintf(CTDL_DEBUG, "checking\n");
if (fp == NULL) {
cprintf("%d Cannot open %s: %s\n",
ERROR + INTERNAL_ERROR, infofilename, strerror(errno));
snprintf(Message, n * SIZ, ErrGeneral, Short, Where, List, Hint, DetailList);
- lprintf(0,Message);
- lprintf(0,ErrSubject);
+ CtdlLogPrintf(0,Message);
+ CtdlLogPrintf(0,ErrSubject);
quickie_message("Citadel", NULL, NULL, AIDEROOM, Message, FMT_FIXED, ErrSubject);
if (errormessages!=NULL) free (errormessages);
errormessages = NULL;
p->desc = desc;
p->next = ProtoHookList;
ProtoHookList = p;
- lprintf(CTDL_INFO, "Registered server command %s (%s)\n", cmd, desc);
+ CtdlLogPrintf(CTDL_INFO, "Registered server command %s (%s)\n", cmd, desc);
}
while (cur != NULL &&
handler == cur->handler &&
!strcmp(cmd, cur->cmd)) {
- lprintf(CTDL_INFO, "Unregistered server command %s (%s)\n",
+ CtdlLogPrintf(CTDL_INFO, "Unregistered server command %s (%s)\n",
cmd, cur->desc);
p = cur->next;
if (cur == ProtoHookList) {
cur = ProtoHookList;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed server command %s (%s)\n",
+ CtdlLogPrintf(CTDL_INFO, "Destroyed server command %s (%s)\n",
cur->cmd, cur->desc);
p = cur->next;
free(cur);
newfcn->h_function_pointer = fcn_ptr;
CleanupHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new cleanup function\n");
+ CtdlLogPrintf(CTDL_INFO, "Registered a new cleanup function\n");
}
/* This will also remove duplicates if any */
while (cur != NULL &&
fcn_ptr == cur->h_function_pointer) {
- lprintf(CTDL_INFO, "Unregistered cleanup function\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered cleanup function\n");
p = cur->next;
if (cur == CleanupHookTable) {
CleanupHookTable = p;
cur = CleanupHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed cleanup function\n");
+ CtdlLogPrintf(CTDL_INFO, "Destroyed cleanup function\n");
p = cur->next;
free(cur);
cur = p;
newfcn->eventtype = EventType;
SessionHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new session function (type %d)\n",
+ CtdlLogPrintf(CTDL_INFO, "Registered a new session function (type %d)\n",
EventType);
}
while (cur != NULL &&
fcn_ptr == cur->h_function_pointer &&
EventType == cur->eventtype) {
- lprintf(CTDL_INFO, "Unregistered session function (type %d)\n",
+ CtdlLogPrintf(CTDL_INFO, "Unregistered session function (type %d)\n",
EventType);
p = cur->next;
if (cur == SessionHookTable) {
cur = SessionHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed session function\n");
+ CtdlLogPrintf(CTDL_INFO, "Destroyed session function\n");
p = cur->next;
free(cur);
cur = p;
newfcn->eventtype = EventType;
UserHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new user function (type %d)\n",
+ CtdlLogPrintf(CTDL_INFO, "Registered a new user function (type %d)\n",
EventType);
}
while (cur != NULL &&
fcn_ptr == cur->h_function_pointer &&
EventType == cur->eventtype) {
- lprintf(CTDL_INFO, "Unregistered user function (type %d)\n",
+ CtdlLogPrintf(CTDL_INFO, "Unregistered user function (type %d)\n",
EventType);
p = cur->next;
if (cur == UserHookTable) {
cur = UserHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed user function \n");
+ CtdlLogPrintf(CTDL_INFO, "Destroyed user function \n");
p = cur->next;
free(cur);
cur = p;
newfcn->eventtype = EventType;
MessageHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new message function (type %d)\n",
+ CtdlLogPrintf(CTDL_INFO, "Registered a new message function (type %d)\n",
EventType);
}
while (cur != NULL &&
handler == cur->h_function_pointer &&
EventType == cur->eventtype) {
- lprintf(CTDL_INFO, "Unregistered message function (type %d)\n",
+ CtdlLogPrintf(CTDL_INFO, "Unregistered message function (type %d)\n",
EventType);
p = cur->next;
if (cur == MessageHookTable) {
cur = MessageHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed message function \n");
+ CtdlLogPrintf(CTDL_INFO, "Destroyed message function \n");
p = cur->next;
free(cur);
cur = p;
newfcn->fcn_ptr = fcn_ptr;
RoomHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new room function\n");
+ CtdlLogPrintf(CTDL_INFO, "Registered a new room function\n");
}
for (cur = RoomHookTable; cur != NULL; cur = cur->next) {
while (cur != NULL && fcn_ptr == cur->fcn_ptr) {
- lprintf(CTDL_INFO, "Unregistered room function\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered room function\n");
p = cur->next;
if (cur == RoomHookTable) {
RoomHookTable = p;
cur = RoomHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Unregistered room function\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered room function\n");
p = cur->next;
free(cur);
cur = p;
newfcn->h_function_pointer = handler;
NetprocHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new netproc function\n");
+ CtdlLogPrintf(CTDL_INFO, "Registered a new netproc function\n");
}
/* This will also remove duplicates if any */
while (cur != NULL &&
handler == cur->h_function_pointer ) {
- lprintf(CTDL_INFO, "Unregistered netproc function\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered netproc function\n");
p = cur->next;
if (cur == NetprocHookTable) {
NetprocHookTable = p;
cur = NetprocHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Unregistered netproc function\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered netproc function\n");
p = cur->next;
free(cur);
cur = p;
newfcn->h_function_pointer = handler;
DeleteHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new netproc function\n");
+ CtdlLogPrintf(CTDL_INFO, "Registered a new netproc function\n");
}
/* This will also remove duplicates if any */
while (cur != NULL &&
handler == cur->h_function_pointer ) {
- lprintf(CTDL_INFO, "Unregistered netproc function\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered netproc function\n");
p = cur->next;
if (cur == DeleteHookTable) {
DeleteHookTable = p;
cur = DeleteHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed netproc function\n");
+ CtdlLogPrintf(CTDL_INFO, "Destroyed netproc function\n");
p = cur->next;
free(cur);
cur = p;
safestrncpy(newfcn->content_type, content_type, sizeof newfcn->content_type);
FixedOutputTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new fixed output function for %s\n", newfcn->content_type);
+ CtdlLogPrintf(CTDL_INFO, "Registered a new fixed output function for %s\n", newfcn->content_type);
}
for (cur = FixedOutputTable; cur != NULL; cur = cur->next) {
/* This will also remove duplicates if any */
while (cur != NULL && (!strcasecmp(content_type, cur->content_type))) {
- lprintf(CTDL_INFO, "Unregistered fixed output function for %s\n", content_type);
+ CtdlLogPrintf(CTDL_INFO, "Unregistered fixed output function for %s\n", content_type);
p = cur->next;
if (cur == FixedOutputTable) {
FixedOutputTable = p;
cur = FixedOutputTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed fixed output function for %s\n", cur->content_type);
+ CtdlLogPrintf(CTDL_INFO, "Destroyed fixed output function for %s\n", cur->content_type);
p = cur->next;
free(cur);
cur = p;
newfcn->order = order;
newfcn->h_function_pointer = fcn_ptr;
XmsgHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new x-msg function (priority %d)\n", order);
+ CtdlLogPrintf(CTDL_INFO, "Registered a new x-msg function (priority %d)\n", order);
}
while (cur != NULL &&
fcn_ptr == cur->h_function_pointer &&
order == cur->order) {
- lprintf(CTDL_INFO, "Unregistered x-msg function "
+ CtdlLogPrintf(CTDL_INFO, "Unregistered x-msg function "
"(priority %d)\n", order);
p = cur->next;
if (cur == XmsgHookTable) {
cur = XmsgHookTable;
while (cur != NULL)
{
- lprintf(CTDL_INFO, "Destroyed x-msg function "
+ CtdlLogPrintf(CTDL_INFO, "Destroyed x-msg function "
"(priority %d)\n", cur->order);
p = cur->next;
snprintf(message, SIZ, "Unix domain socket '%s': ", sockpath);
}
else if (tcp_port <= 0) { /* port -1 to disable */
- lprintf(CTDL_INFO, "Service %s has been manually disabled, skipping\n", ServiceName);
+ CtdlLogPrintf(CTDL_INFO, "Service %s has been manually disabled, skipping\n", ServiceName);
free (message);
free(newfcn);
return;
if (newfcn->msock > 0) {
ServiceHookTable = newfcn;
strcat(message, "registered.");
- lprintf(CTDL_INFO, "%s\n", message);
+ CtdlLogPrintf(CTDL_INFO, "%s\n", message);
}
else {
AddPortError(message, error);
strcat(message, "FAILED.");
- lprintf(CTDL_CRIT, "%s\n", message);
+ CtdlLogPrintf(CTDL_CRIT, "%s\n", message);
free(error);
free(newfcn);
}
tcp_port == cur->tcp_port) {
close(cur->msock);
if (sockpath) {
- lprintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
+ CtdlLogPrintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
sockpath);
} else if (tcp_port) {
- lprintf(CTDL_INFO, "Closed TCP port %d\n", tcp_port);
+ CtdlLogPrintf(CTDL_INFO, "Closed TCP port %d\n", tcp_port);
} else {
- lprintf(CTDL_INFO, "Unregistered unknown service\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered unknown service\n");
}
p = cur->next;
if (cur == ServiceHookTable) {
{
close(cur->msock);
if (cur->sockpath) {
- lprintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
+ CtdlLogPrintf(CTDL_INFO, "Closed UNIX domain socket %s\n",
cur->sockpath);
} else if (cur->tcp_port) {
- lprintf(CTDL_INFO, "Closed TCP port %d\n", cur->tcp_port);
+ CtdlLogPrintf(CTDL_INFO, "Closed TCP port %d\n", cur->tcp_port);
} else {
- lprintf(CTDL_INFO, "Unregistered unknown service\n");
+ CtdlLogPrintf(CTDL_INFO, "Unregistered unknown service\n");
}
p = cur->next;
free(cur);
newfcn->fcn_ptr = fcn_ptr;
SearchFunctionHookTable = newfcn;
- lprintf(CTDL_INFO, "Registered a new search function (%s)\n", name);
+ CtdlLogPrintf(CTDL_INFO, "Registered a new search function (%s)\n", name);
}
void CtdlUnregisterSearchFuncHook(void (*fcn_ptr)(int *, long **, char *), char *name)
for (cur = SearchFunctionHookTable; cur != NULL; cur = cur->next) {
while (fcn_ptr && (cur->fcn_ptr == fcn_ptr) && name && !strcmp(name, cur->name)) {
- lprintf(CTDL_INFO, "Unregistered search function(%s)\n", name);
+ CtdlLogPrintf(CTDL_INFO, "Unregistered search function(%s)\n", name);
p = cur->next;
if (cur == SearchFunctionHookTable) {
SearchFunctionHookTable = p;
/* Other code may elect to protect this message from server-side
* handlers; if this is the case, don't do anything.
- lprintf(CTDL_DEBUG, "** Event type is %d, flags are %d\n",
+ CtdlLogPrintf(CTDL_DEBUG, "** Event type is %d, flags are %d\n",
EventType, msg->cm_flags);
*/
if (msg->cm_flags & CM_SKIP_HOOKS) {
- lprintf(CTDL_DEBUG, "Skipping hooks\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Skipping hooks\n");
return(0);
}
struct RoomFunctionHook *fcn;
int total_retval = 0;
- lprintf(CTDL_DEBUG, "Performing room hooks for <%s>\n", target_room->QRname);
+ CtdlLogPrintf(CTDL_DEBUG, "Performing room hooks for <%s>\n", target_room->QRname);
for (fcn = RoomHookTable; fcn != NULL; fcn = fcn->next) {
total_retval = total_retval + (*fcn->fcn_ptr) (target_room);
{
if (newfcn->cmd == cmd && !strcmp(newfcn->module, module))
{
- lprintf(CTDL_ERR, "Directory service function already handled by module %s\n", module);
+ CtdlLogPrintf(CTDL_ERR, "Directory service function already handled by module %s\n", module);
return -1;
}
newfcn = newfcn->next;
newfcn->next = DirectoryServiceHookList;
DirectoryServiceHookList = newfcn;
- lprintf(CTDL_INFO, "Registered a new directory service function from module %s\n", module);
+ CtdlLogPrintf(CTDL_INFO, "Registered a new directory service function from module %s\n", module);
return 0;
}
/*
- * Create an interface to lprintf that follows the coding convention.
- * This is here until such time as we have replaced all calls to lprintf with CtdlLogPrintf
+ * CtdlLogPrintf() ... Write logging information
*/
-
-void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...)
-{
- va_list arg_ptr;
- va_start(arg_ptr, format);
- vlprintf(loglevel, format, arg_ptr);
- va_end(arg_ptr);
-}
-
-
-/*
- * lprintf() ... Write logging information
- */
-void lprintf(enum LogLevel loglevel, const char *format, ...) {
+void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...) {
va_list arg_ptr;
va_start(arg_ptr, format);
- vlprintf(loglevel, format, arg_ptr);
+ vCtdlLogPrintf(loglevel, format, arg_ptr);
va_end(arg_ptr);
}
-void vlprintf(enum LogLevel loglevel, const char *format, va_list arg_ptr)
+void vCtdlLogPrintf(enum LogLevel loglevel, const char *format, va_list arg_ptr)
{
char buf[SIZ], buf2[SIZ];
rem = ptr->next;
--num_sessions;
- lprintf(CTDL_DEBUG, "Purging session %d\n", ptr->cs_pid);
+ CtdlLogPrintf(CTDL_DEBUG, "Purging session %d\n", ptr->cs_pid);
RemoveContext(ptr);
free (ptr);
ptr = rem;
};
#ifdef __GNUC__
-void lprintf (enum LogLevel loglevel, const char *format, ...) __attribute__((__format__(__printf__,2,3)));
void cprintf (const char *format, ...) __attribute__((__format__(__printf__,1,2)));
#else
-void lprintf (enum LogLevel loglevel, const char *format, ...);
void cprintf (const char *format, ...);
#endif
-void vlprintf (enum LogLevel loglevel, const char *format, va_list arg_ptr);
+void CtdlLogPrintf(enum LogLevel loglevel, const char *format, ...);
+void vCtdlLogPrintf (enum LogLevel loglevel, const char *format, va_list arg_ptr);
extern pthread_key_t MyConKey; /* TSD key for MyContext() */
int ret;
if ((ret = citthread_key_create(&ThreadKey, ctdl_thread_internal_dest_tsd))) {
- lprintf(CTDL_EMERG, "citthread_key_create: %s\n", strerror(ret));
+ CtdlLogPrintf(CTDL_EMERG, "citthread_key_create: %s\n", strerror(ret));
exit(CTDLEXIT_DB);
}
}
len = strlen(username);
if (len >= USERNAME_SIZE)
{
- lprintf (CTDL_EMERG, "Username to long: %s", username);
+ CtdlLogPrintf (CTDL_EMERG, "Username to long: %s", username);
cit_backtrace ();
len = USERNAME_SIZE - 1;
username[USERNAME_SIZE - 1]='\0';
else { /* Sanity checks succeeded. Now rename the user. */
- lprintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname);
+ CtdlLogPrintf(CTDL_DEBUG, "Renaming <%s> to <%s>\n", oldname, newname);
cdb_delete(CDB_USERS, oldnamekey, strlen(oldnamekey));
safestrncpy(usbuf.fullname, newname, sizeof usbuf.fullname);
putuser(&usbuf);
char username[SIZ];
int found_user;
- lprintf(9, "CtdlLoginExistingUser(%s, %s)\n", authname, trythisname);
+ CtdlLogPrintf(9, "CtdlLoginExistingUser(%s, %s)\n", authname, trythisname);
if ((CC->logged_in)) {
return login_already_logged_in;
struct passwd *tempPwdPtr;
char pwdbuffer[256];
- lprintf(CTDL_DEBUG, "asking host about <%s>\n", username);
+ CtdlLogPrintf(CTDL_DEBUG, "asking host about <%s>\n", username);
#ifdef HAVE_GETPWNAM_R
#ifdef SOLARIS_GETPWUID
- lprintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
tempPwdPtr = getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer);
#else // SOLARIS_GETPWUID
- lprintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Calling getpwnam_r()\n");
getpwnam_r(username, &pd, pwdbuffer, sizeof pwdbuffer, &tempPwdPtr);
#endif // SOLARIS_GETPWUID
#else // HAVE_GETPWNAM_R
- lprintf(CTDL_DEBUG, "SHOULD NEVER GET HERE!!!\n");
+ CtdlLogPrintf(CTDL_DEBUG, "SHOULD NEVER GET HERE!!!\n");
tempPwdPtr = NULL;
#endif // HAVE_GETPWNAM_R
if (tempPwdPtr == NULL) {
- lprintf(CTDL_DEBUG, "no such user <%s>\n", username);
+ CtdlLogPrintf(CTDL_DEBUG, "no such user <%s>\n", username);
return login_not_found;
}
* If not found, make one attempt to create it.
*/
found_user = getuserbyuid(&CC->user, pd.pw_uid);
- lprintf(CTDL_DEBUG, "found it: uid=%ld, gecos=%s here: %d\n",
+ CtdlLogPrintf(CTDL_DEBUG, "found it: uid=%ld, gecos=%s here: %d\n",
(long)pd.pw_uid, pd.pw_gecos, found_user);
if (found_user != 0) {
create_user(username, 0);
*/
void session_startup(void)
{
- lprintf(CTDL_NOTICE, "<%s> logged in\n", CC->curr_user);
+ CtdlLogPrintf(CTDL_NOTICE, "<%s> logged in\n", CC->curr_user);
lgetuser(&CC->user, CC->curr_user);
++(CC->user.timescalled);
char buf[256];
if (IsEmptyStr(pass)) {
- lprintf(CTDL_DEBUG, "refusing to check empty password for uid=%d using chkpwd...\n", uid);
+ CtdlLogPrintf(CTDL_DEBUG, "refusing to check empty password for uid=%d using chkpwd...\n", uid);
return 0;
}
- lprintf(CTDL_DEBUG, "Validating password for uid=%d using chkpwd...\n", uid);
+ CtdlLogPrintf(CTDL_DEBUG, "Validating password for uid=%d using chkpwd...\n", uid);
begin_critical_section(S_CHKPWD);
write(chkpwd_write_pipe[1], &uid, sizeof(uid_t));
end_critical_section(S_CHKPWD);
if (!strncmp(buf, "PASS", 4)) {
- lprintf(CTDL_DEBUG, "...pass\n");
+ CtdlLogPrintf(CTDL_DEBUG, "...pass\n");
return(1);
}
- lprintf(CTDL_DEBUG, "...fail\n");
+ CtdlLogPrintf(CTDL_DEBUG, "...fail\n");
return 0;
}
struct stat filestats;
int i;
- lprintf(CTDL_DEBUG, "Starting chkpwd daemon for host authentication mode\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Starting chkpwd daemon for host authentication mode\n");
if ((stat(file_chkpwd, &filestats)==-1) ||
(filestats.st_size==0)){
abort();
}
if (pipe(chkpwd_write_pipe) != 0) {
- lprintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
+ CtdlLogPrintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
abort();
}
if (pipe(chkpwd_read_pipe) != 0) {
- lprintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
+ CtdlLogPrintf(CTDL_EMERG, "Unable to create pipe for chkpwd daemon: %s\n", strerror(errno));
abort();
}
chkpwd_pid = fork();
if (chkpwd_pid < 0) {
- lprintf(CTDL_EMERG, "Unable to fork chkpwd daemon: %s\n", strerror(errno));
+ CtdlLogPrintf(CTDL_EMERG, "Unable to fork chkpwd daemon: %s\n", strerror(errno));
abort();
}
if (chkpwd_pid == 0) {
- lprintf(CTDL_DEBUG, "Now calling dup2() write\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Now calling dup2() write\n");
dup2(chkpwd_write_pipe[0], 0);
- lprintf(CTDL_DEBUG, "Now calling dup2() write\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Now calling dup2() write\n");
dup2(chkpwd_read_pipe[1], 1);
- lprintf(CTDL_DEBUG, "Now closing stuff\n");
+ CtdlLogPrintf(CTDL_DEBUG, "Now closing stuff\n");
for (i=2; i<256; ++i) close(i);
- lprintf(CTDL_DEBUG, "Now calling execl(%s)\n", file_chkpwd);
+ CtdlLogPrintf(CTDL_DEBUG, "Now calling execl(%s)\n", file_chkpwd);
execl(file_chkpwd, file_chkpwd, NULL);
- lprintf(CTDL_EMERG, "Unable to exec chkpwd daemon: %s\n", strerror(errno));
+ CtdlLogPrintf(CTDL_EMERG, "Unable to exec chkpwd daemon: %s\n", strerror(errno));
abort();
exit(errno);
}
int code;
if ((CC->logged_in)) {
- lprintf(CTDL_WARNING, "CtdlTryPassword: already logged in\n");
+ CtdlLogPrintf(CTDL_WARNING, "CtdlTryPassword: already logged in\n");
return pass_already_logged_in;
}
if (!strcmp(CC->curr_user, NLI)) {
- lprintf(CTDL_WARNING, "CtdlTryPassword: no user selected\n");
+ CtdlLogPrintf(CTDL_WARNING, "CtdlTryPassword: no user selected\n");
return pass_no_user;
}
if (getuser(&CC->user, CC->curr_user)) {
- lprintf(CTDL_ERR, "CtdlTryPassword: internal error\n");
+ CtdlLogPrintf(CTDL_ERR, "CtdlTryPassword: internal error\n");
return pass_internal_error;
}
if (password == NULL) {
- lprintf(CTDL_INFO, "CtdlTryPassword: NULL password string supplied\n");
+ CtdlLogPrintf(CTDL_INFO, "CtdlTryPassword: NULL password string supplied\n");
return pass_wrong_password;
}
code = (-1);
do_login();
return pass_ok;
} else {
- lprintf(CTDL_WARNING, "Bad password specified for <%s>\n", CC->curr_user);
+ CtdlLogPrintf(CTDL_WARNING, "Bad password specified for <%s>\n", CC->curr_user);
return pass_wrong_password;
}
}
return (ERROR + NO_SUCH_USER);
if (getuser(&usbuf, pname) != 0) {
- lprintf(CTDL_ERR, "Cannot purge user <%s> - not found\n", pname);
+ CtdlLogPrintf(CTDL_ERR, "Cannot purge user <%s> - not found\n", pname);
return (ERROR + NO_SUCH_USER);
}
/* Don't delete a user who is currently logged in. Instead, just
}
end_critical_section(S_SESSION_TABLE);
if (user_is_logged_in == 1) {
- lprintf(CTDL_WARNING, "User <%s> is logged in; not deleting.\n", pname);
+ CtdlLogPrintf(CTDL_WARNING, "User <%s> is logged in; not deleting.\n", pname);
usbuf.axlevel = 0;
putuser(&usbuf);
return (1);
}
- lprintf(CTDL_NOTICE, "Deleting user <%s>\n", pname);
+ CtdlLogPrintf(CTDL_NOTICE, "Deleting user <%s>\n", pname);
/* Perform any purge functions registered by server extensions */
PerformUserHooks(&usbuf, EVT_PURGEUSER);
uid = pd.pw_uid;
if (IsEmptyStr (username))
{
- lprintf (CTDL_EMERG,
+ CtdlLogPrintf (CTDL_EMERG,
"Can't find Realname for user %s [%d] in the Host Auth Database; giving up.\n",
newusername, pd.pw_uid);
snprintf(buf, SIZ,
CC->cs_addr
);
aide_message(buf, "User Creation Notice");
- lprintf(CTDL_NOTICE, "New user <%s> created\n", username);
+ CtdlLogPrintf(CTDL_NOTICE, "New user <%s> created\n", username);
return (0);
}
safestrncpy(CC->user.password, new_pw, sizeof(CC->user.password));
lputuser(&CC->user);
cprintf("%d Password changed.\n", CIT_OK);
- lprintf(CTDL_INFO, "Password changed for user <%s>\n", CC->curr_user);
+ CtdlLogPrintf(CTDL_INFO, "Password changed for user <%s>\n", CC->curr_user);
PerformSessionHooks(EVT_SETPASS);
}