citadel
About: Citadel is an advanced messaging and collaboration system for groupware and BBS applications (preferred OS: Linux).
  Fossies Dox: citadel.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

config.c
Go to the documentation of this file.
1//
2// Read and write the citadel.config file
3//
4// Copyright (c) 1987-2021 by the citadel.org team
5//
6// This program is open source software. Use, duplication, or disclosure
7// is subject to the terms of the GNU General Public License, version 3.
8// The program is distributed without any warranty, expressed or implied.
9
10#include "sysdep.h"
11#include <stdlib.h>
12#include <unistd.h>
13#include <stdio.h>
14#include <netdb.h>
15#include <sys/utsname.h>
16#include <libcitadel.h>
17#include <assert.h>
18#include "config.h"
19#include "ctdl_module.h"
20
22HashList *ctdlconfig = NULL; // new configuration
23
24
25void config_warn_if_port_unset(char *key, int default_port)
26{
27 int p = CtdlGetConfigInt(key);
28 if ((p < -1) || (p == 0) || (p > UINT16_MAX))
29 {
30 syslog(LOG_ERR, "config: setting %s is not -1 (disabled) or a valid TCP port - setting to default %d", key, default_port);
31 CtdlSetConfigInt(key, default_port);
32 }
33}
34
35
36void config_warn_if_empty(char *key)
37{
38 if (IsEmptyStr(CtdlGetConfigStr(key)))
39 {
40 syslog(LOG_ERR, "config: setting %s is empty, but must not - check your config!", key);
41 }
42}
43
44
45void validate_config(void) {
46
47 /*
48 * these shouldn't be empty
49 */
50 config_warn_if_empty("c_fqdn");
51 config_warn_if_empty("c_baseroom");
52 config_warn_if_empty("c_aideroom");
53 config_warn_if_empty("c_twitroom");
54 config_warn_if_empty("c_nodename");
55
56 /*
57 * Sanity check for port bindings
58 */
59 config_warn_if_port_unset("c_smtp_port", 25);
60 config_warn_if_port_unset("c_pop3_port", 110);
61 config_warn_if_port_unset("c_imap_port", 143);
62 config_warn_if_port_unset("c_msa_port", 587);
63 config_warn_if_port_unset("c_port_number", 504);
64 config_warn_if_port_unset("c_smtps_port", 465);
65 config_warn_if_port_unset("c_pop3s_port", 995);
66 config_warn_if_port_unset("c_imaps_port", 993);
67 config_warn_if_port_unset("c_pftcpdict_port", -1);
68 config_warn_if_port_unset("c_xmpp_c2s_port", 5222);
69 config_warn_if_port_unset("c_xmpp_s2s_port", 5269);
70 config_warn_if_port_unset("c_nntp_port", 119);
71 config_warn_if_port_unset("c_nntps_port", 563);
72
73 if (getpwuid(ctdluid) == NULL) {
74 syslog(LOG_ERR, "config: uid (%d) does not exist ... citserver will run as root", ctdluid);
75 }
76}
77
78
79/*
80 * Put some sane default values into our configuration. Some will be overridden when we run setup.
81 */
83
84 struct utsname my_utsname;
85 struct hostent *he;
86 char detected_hostname[256];
87
88 /* Determine our host name, in case we need to use it as a default */
89 uname(&my_utsname);
90
91 /* set some sample/default values in place of blanks... */
92 extract_token(detected_hostname, my_utsname.nodename, 0, '.', sizeof detected_hostname);
93 CtdlSetConfigStr("c_nodename", detected_hostname);
94
95 if ((he = gethostbyname(my_utsname.nodename)) != NULL) {
96 CtdlSetConfigStr("c_fqdn", he->h_name);
97 }
98 else {
99 CtdlSetConfigStr("c_fqdn", my_utsname.nodename);
100 }
101
102 CtdlSetConfigStr("c_humannode", "Citadel Server");
103 CtdlSetConfigInt("c_initax", 4);
104 CtdlSetConfigStr("c_moreprompt", "<more>");
105 CtdlSetConfigStr("c_twitroom", "Trashcan");
106 CtdlSetConfigStr("c_baseroom", BASEROOM);
107 CtdlSetConfigStr("c_aideroom", "Aide");
108 CtdlSetConfigInt("c_sleeping", 900);
109
110 if (CtdlGetConfigInt("c_createax") == 0) {
111 CtdlSetConfigInt("c_createax", 3);
112 }
113
114 /*
115 * Default port numbers for various services
116 */
117 CtdlSetConfigInt("c_port_number", 504);
118 CtdlSetConfigInt("c_smtp_port", 25);
119 CtdlSetConfigInt("c_pop3_port", 110);
120 CtdlSetConfigInt("c_imap_port", 143);
121 CtdlSetConfigInt("c_msa_port", 587);
122 CtdlSetConfigInt("c_smtps_port", 465);
123 CtdlSetConfigInt("c_pop3s_port", 995);
124 CtdlSetConfigInt("c_imaps_port", 993);
125 CtdlSetConfigInt("c_pftcpdict_port", -1);
126 CtdlSetConfigInt("c_xmpp_c2s_port", 5222);
127 CtdlSetConfigInt("c_xmpp_s2s_port", 5269);
128 CtdlSetConfigInt("c_nntp_port", 119);
129 CtdlSetConfigInt("c_nntps_port", 563);
130
131 /*
132 * Prevent the "new installation, set defaults" behavior from occurring again
133 */
134 CtdlSetConfigLong("c_config_created_or_migrated", (long)time(NULL));
135}
136
137
138/*
139 * Migrate a supplied legacy configuration to the new in-db format.
140 * No individual site should ever have to do this more than once.
141 */
143{
144 CtdlSetConfigStr( "c_nodename" , lconfig->c_nodename );
145 CtdlSetConfigStr( "c_fqdn" , lconfig->c_fqdn );
146 CtdlSetConfigStr( "c_humannode" , lconfig->c_humannode );
147 CtdlSetConfigInt( "c_creataide" , lconfig->c_creataide );
148 CtdlSetConfigInt( "c_sleeping" , lconfig->c_sleeping );
149 CtdlSetConfigInt( "c_initax" , lconfig->c_initax );
150 CtdlSetConfigInt( "c_regiscall" , lconfig->c_regiscall );
151 CtdlSetConfigInt( "c_twitdetect" , lconfig->c_twitdetect );
152 CtdlSetConfigStr( "c_twitroom" , lconfig->c_twitroom );
153 CtdlSetConfigStr( "c_moreprompt" , lconfig->c_moreprompt );
154 CtdlSetConfigInt( "c_restrict" , lconfig->c_restrict );
155 CtdlSetConfigStr( "c_site_location" , lconfig->c_site_location );
156 CtdlSetConfigStr( "c_sysadm" , lconfig->c_sysadm );
157 CtdlSetConfigInt( "c_maxsessions" , lconfig->c_maxsessions );
158 CtdlSetConfigStr( "c_ip_addr" , lconfig->c_ip_addr );
159 CtdlSetConfigInt( "c_port_number" , lconfig->c_port_number );
160 CtdlSetConfigInt( "c_ep_mode" , lconfig->c_ep.expire_mode );
161 CtdlSetConfigInt( "c_ep_value" , lconfig->c_ep.expire_value );
162 CtdlSetConfigInt( "c_userpurge" , lconfig->c_userpurge );
163 CtdlSetConfigInt( "c_roompurge" , lconfig->c_roompurge );
164 CtdlSetConfigStr( "c_logpages" , lconfig->c_logpages );
165 CtdlSetConfigInt( "c_createax" , lconfig->c_createax );
166 CtdlSetConfigLong( "c_maxmsglen" , lconfig->c_maxmsglen );
167 CtdlSetConfigInt( "c_min_workers" , lconfig->c_min_workers );
168 CtdlSetConfigInt( "c_max_workers" , lconfig->c_max_workers );
169 CtdlSetConfigInt( "c_pop3_port" , lconfig->c_pop3_port );
170 CtdlSetConfigInt( "c_smtp_port" , lconfig->c_smtp_port );
171 CtdlSetConfigInt( "c_rfc822_strict_from" , lconfig->c_rfc822_strict_from );
172 CtdlSetConfigInt( "c_aide_zap" , lconfig->c_aide_zap );
173 CtdlSetConfigInt( "c_imap_port" , lconfig->c_imap_port );
174 CtdlSetConfigLong( "c_net_freq" , lconfig->c_net_freq );
175 CtdlSetConfigInt( "c_disable_newu" , lconfig->c_disable_newu );
176 CtdlSetConfigInt( "c_enable_fulltext" , lconfig->c_enable_fulltext );
177 CtdlSetConfigStr( "c_baseroom" , lconfig->c_baseroom );
178 CtdlSetConfigStr( "c_aideroom" , lconfig->c_aideroom );
179 CtdlSetConfigInt( "c_purge_hour" , lconfig->c_purge_hour );
180 CtdlSetConfigInt( "c_mbxep_mode" , lconfig->c_mbxep.expire_mode );
181 CtdlSetConfigInt( "c_mbxep_value" , lconfig->c_mbxep.expire_value );
182 CtdlSetConfigStr( "c_ldap_host" , lconfig->c_ldap_host );
183 CtdlSetConfigInt( "c_ldap_port" , lconfig->c_ldap_port );
184 CtdlSetConfigStr( "c_ldap_base_dn" , lconfig->c_ldap_base_dn );
185 CtdlSetConfigStr( "c_ldap_bind_dn" , lconfig->c_ldap_bind_dn );
186 CtdlSetConfigStr( "c_ldap_bind_pw" , lconfig->c_ldap_bind_pw );
187 CtdlSetConfigInt( "c_msa_port" , lconfig->c_msa_port );
188 CtdlSetConfigInt( "c_imaps_port" , lconfig->c_imaps_port );
189 CtdlSetConfigInt( "c_pop3s_port" , lconfig->c_pop3s_port );
190 CtdlSetConfigInt( "c_smtps_port" , lconfig->c_smtps_port );
191 CtdlSetConfigInt( "c_auto_cull" , lconfig->c_auto_cull );
192 CtdlSetConfigInt( "c_allow_spoofing" , lconfig->c_allow_spoofing );
193 CtdlSetConfigInt( "c_journal_email" , lconfig->c_journal_email );
194 CtdlSetConfigInt( "c_journal_pubmsgs" , lconfig->c_journal_pubmsgs );
195 CtdlSetConfigStr( "c_journal_dest" , lconfig->c_journal_dest );
196 CtdlSetConfigStr( "c_default_cal_zone" , lconfig->c_default_cal_zone );
197 CtdlSetConfigInt( "c_pftcpdict_port" , lconfig->c_pftcpdict_port );
198 CtdlSetConfigInt( "c_auth_mode" , lconfig->c_auth_mode );
199 CtdlSetConfigInt( "c_rbl_at_greeting" , lconfig->c_rbl_at_greeting );
200 CtdlSetConfigStr( "c_pager_program" , lconfig->c_pager_program );
201 CtdlSetConfigInt( "c_imap_keep_from" , lconfig->c_imap_keep_from );
202 CtdlSetConfigInt( "c_xmpp_c2s_port" , lconfig->c_xmpp_c2s_port );
203 CtdlSetConfigInt( "c_xmpp_s2s_port" , lconfig->c_xmpp_s2s_port );
204 CtdlSetConfigLong( "c_pop3_fetch" , lconfig->c_pop3_fetch );
205 CtdlSetConfigLong( "c_pop3_fastest" , lconfig->c_pop3_fastest );
206 CtdlSetConfigInt( "c_spam_flag_only" , lconfig->c_spam_flag_only );
207 CtdlSetConfigInt( "c_guest_logins" , lconfig->c_guest_logins );
208 CtdlSetConfigInt( "c_nntp_port" , lconfig->c_nntp_port );
209 CtdlSetConfigInt( "c_nntps_port" , lconfig->c_nntps_port );
210}
211
212
213/*
214 * Called during the initialization of Citadel server.
215 * It verifies the system's integrity and reads citadel.config into memory.
216 */
218 FILE *cfp;
219 int rv;
220 struct legacy_config lconfig; // legacy configuration
221 ctdlconfig = NewHash(1, NULL); // set up the real config system
222
223 /* Ensure that we are linked to the correct version of libcitadel */
224 if (libcitadel_version_number() < LIBCITADEL_VERSION_NUMBER) {
225 fprintf(stderr, "You are running libcitadel version %d\n", libcitadel_version_number());
226 fprintf(stderr, "citserver was compiled against version %d\n", LIBCITADEL_VERSION_NUMBER);
228 }
229
230 memset(&lconfig, 0, sizeof(struct legacy_config));
231 cfp = fopen(file_citadel_config, "rb");
232 if (cfp != NULL) {
233 if (CtdlGetConfigLong("c_config_created_or_migrated") > 0) {
234 fprintf(stderr, "Citadel Server found BOTH legacy and new configurations present.\n");
235 fprintf(stderr, "Exiting to prevent data corruption.\n");
236 exit(CTDLEXIT_CONFIG);
237 }
238 rv = fread((char *) &lconfig, sizeof(struct legacy_config), 1, cfp);
239 if (rv != 1)
240 {
241 fprintf(stderr,
242 "Warning: Found a legacy config file %s has unexpected size. \n",
244 );
245 }
246
247 migrate_legacy_config(&lconfig);
248
249 fclose(cfp);
250 if (unlink(file_citadel_config) != 0) {
251 fprintf(stderr, "Unable to remove legacy config file %s after migrating it.\n", file_citadel_config);
252 fprintf(stderr, "Exiting to prevent data corruption.\n");
253 exit(CTDLEXIT_CONFIG);
254 }
255
256 /*
257 * Prevent migration/initialization from happening again.
258 */
259 CtdlSetConfigLong("c_config_created_or_migrated", (long)time(NULL));
260
261 }
262
263 /* New installation? Set up configuration */
264 if (CtdlGetConfigLong("c_config_created_or_migrated") <= 0) {
266 }
267
268 /* Only allow LDAP auth mode if we actually have LDAP support */
269#ifndef HAVE_LDAP
270 if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
271 fprintf(stderr, "Your system is configured for LDAP authentication,\n"
272 "but you are running a server built without OpenLDAP support.\n");
274 }
275#endif
276
277 /* Default maximum message length is 10 megabytes. This is site
278 * configurable. Also check to make sure the limit has not been
279 * set below 8192 bytes.
280 */
281 if (CtdlGetConfigLong("c_maxmsglen") <= 0) CtdlSetConfigLong("c_maxmsglen", 10485760);
282 if (CtdlGetConfigLong("c_maxmsglen") < 8192) CtdlSetConfigLong("c_maxmsglen", 8192);
283
284 /*
285 * Default lower and upper limits on number of worker threads
286 */
287 if (CtdlGetConfigInt("c_min_workers") < 5) CtdlSetConfigInt("c_min_workers", 5); // min
288 if (CtdlGetConfigInt("c_max_workers") == 0) CtdlSetConfigInt("c_max_workers", 256); // default max
289 if (CtdlGetConfigInt("c_max_workers") < CtdlGetConfigInt("c_min_workers")) {
290 CtdlSetConfigInt("c_max_workers", CtdlGetConfigInt("c_min_workers")); // max >= min
291 }
292
293 /* Networking more than once every five minutes just isn't sane */
294 if (CtdlGetConfigLong("c_net_freq") == 0) CtdlSetConfigLong("c_net_freq", 3600); // once per hour default
295 if (CtdlGetConfigLong("c_net_freq") < 300) CtdlSetConfigLong("c_net_freq", 300); // minimum 5 minutes
296
297 /* Same goes for POP3 */
298 if (CtdlGetConfigLong("c_pop3_fetch") == 0) CtdlSetConfigLong("c_pop3_fetch", 3600); // once per hour default
299 if (CtdlGetConfigLong("c_pop3_fetch") < 300) CtdlSetConfigLong("c_pop3_fetch", 300); // 5 minutes min
300 if (CtdlGetConfigLong("c_pop3_fastest") == 0) CtdlSetConfigLong("c_pop3_fastest", 3600); // once per hour default
301 if (CtdlGetConfigLong("c_pop3_fastest") < 300) CtdlSetConfigLong("c_pop3_fastest", 300); // 5 minutes min
302
303 /* LDAP sync frequency */
304 if (CtdlGetConfigLong("c_ldap_sync_freq") == 0) CtdlSetConfigLong("c_ldap_sync_freq", 300); // every 5 minutes default
305
306 /* "create new user" only works with native authentication mode */
307 if (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) {
308 CtdlSetConfigInt("c_disable_newu", 1);
309 }
310}
311
312
313/*
314 * Called when Citadel server is shutting down.
315 * Clears out the config hash table.
316 */
318{
319 DeleteHash(&ctdlconfig);
320}
321
322
323/*
324 * Set a system config value. Simple key/value here.
325 */
326void CtdlSetConfigStr(char *key, char *value)
327{
328 int key_len = strlen(key);
329 int value_len = strlen(value);
330
331 /* Save it in memory */
332 Put(ctdlconfig, key, key_len, strdup(value), NULL);
333
334 /* Also write it to the config database */
335
336 int dbv_size = key_len + value_len + 2;
337 char *dbv = malloc(dbv_size);
338 strcpy(dbv, key);
339 strcpy(&dbv[key_len + 1], value);
340 cdb_store(CDB_CONFIG, key, key_len, dbv, dbv_size);
341 free(dbv);
342}
343
344
345/*
346 * Set a numeric system config value (long integer)
347 */
348void CtdlSetConfigLong(char *key, long value)
349{
350 char longstr[256];
351 sprintf(longstr, "%ld", value);
352 CtdlSetConfigStr(key, longstr);
353}
354
355
356/*
357 * Set a numeric system config value (integer)
358 */
359void CtdlSetConfigInt(char *key, int value)
360{
361 char intstr[256];
362 sprintf(intstr, "%d", value);
363 CtdlSetConfigStr(key, intstr);
364}
365
366
367/*
368 * Delete a system config value.
369 */
370void CtdlDelConfig(char *key)
371{
372 int key_len = strlen(key);
373
374 if (IsEmptyStr(key)) return;
375
376 /* Delete from the database. */
377 cdb_delete(CDB_CONFIG, key, key_len);
378
379 /* Delete from the in-memory cache */
380 HashPos *Pos = GetNewHashPos(ctdlconfig, 1);
381 if (GetHashPosFromKey(ctdlconfig, key, key_len, Pos)) {
382 DeleteEntryFromHash(ctdlconfig, Pos);
383 }
384 DeleteHashPos(&Pos);
385
386 assert(Pos == NULL); // no memory leaks allowed
387}
388
389
390/*
391 * Fetch a system config value. Caller does *not* own the returned value and may not alter it.
392 */
393char *CtdlGetConfigStr(char *key)
394{
395 char *value = NULL;
396 struct cdbdata *cdb;
397 int key_len = strlen(key);
398
399 if (IsEmptyStr(key)) return(NULL);
400
401 /* First look in memory */
402 if (GetHash(ctdlconfig, key, key_len, (void *)&value))
403 {
404 return value;
405 }
406
407 /* Then look in the database. */
408
409 cdb = cdb_fetch(CDB_CONFIG, key, key_len);
410
411 if (cdb == NULL) { /* nope, not there either. */
412 return(NULL);
413 }
414
415 /* Got it. Save it in memory for the next fetch. */
416 value = strdup(cdb->ptr + key_len + 1); /* The key was stored there too; skip past it */
417 cdb_free(cdb);
418 Put(ctdlconfig, key, key_len, value, NULL);
419 return value;
420}
421
422
423/*
424 * Fetch a system config value - integer
425 */
426int CtdlGetConfigInt(char *key)
427{
428 char *s = CtdlGetConfigStr(key);
429 if (s) return atoi(s);
430 return 0;
431}
432
433
434/*
435 * Fetch a system config value - long integer
436 */
437long CtdlGetConfigLong(char *key) {
438 char *s = CtdlGetConfigStr(key);
439 if (s) return atol(s);
440 return 0;
441}
442
443
444void CtdlGetSysConfigBackend(long msgnum, void *userdata) {
445 config_msgnum = msgnum;
446}
447
448
449/*
450 * This is for fetching longer configuration sets which are stored in the message base.
451 */
452char *CtdlGetSysConfig(char *sysconfname) {
453 char hold_rm[ROOMNAMELEN];
454 long msgnum = -1;
455 char *conf;
456 struct CtdlMessage *msg;
457 char buf[SIZ];
458
459 strcpy(hold_rm, CC->room.QRname);
460 if (CtdlGetRoom(&CC->room, SYSCONFIGROOM) != 0) {
461 CtdlGetRoom(&CC->room, hold_rm);
462 return NULL;
463 }
464
465 /* The new way: hunt for the message number in the config database */
466 msgnum = CtdlGetConfigLong(sysconfname);
467
468 /* Legacy format: hunt through the local system configuration room for a message with a matching MIME type */
469 if (msgnum <= 0) {
471 config_msgnum = -1;
472 CtdlForEachMessage(MSGS_LAST, 1, NULL, sysconfname, NULL, CtdlGetSysConfigBackend, NULL);
473 msgnum = config_msgnum;
475 if (msgnum > 0) {
476 CtdlSetConfigLong(sysconfname, msgnum); // store it the new way so we don't have to do this again
477 }
478 }
479
480 if (msgnum <= 0) {
481 conf = NULL;
482 }
483 else {
484 msg = CtdlFetchMessage(msgnum, 1);
485 if (msg != NULL) {
486 conf = strdup(msg->cm_fields[eMesageText]);
487 CM_Free(msg);
488 }
489 else {
490 conf = NULL;
491 }
492 }
493
494 CtdlGetRoom(&CC->room, hold_rm);
495
496 if (conf != NULL) { // Strip the MIME headers, leaving only the content
497 do {
498 extract_token(buf, conf, 0, '\n', sizeof buf);
499 strcpy(conf, &conf[strlen(buf)+1]);
500 } while ( (!IsEmptyStr(conf)) && (!IsEmptyStr(buf)) );
501 }
502
503 return(conf);
504}
505
506
507/*
508 * This is for storing longer configuration sets which are stored in the message base.
509 */
510void CtdlPutSysConfig(char *sysconfname, char *sysconfdata) {
511 long old_msgnum = -1;
512 long new_msgnum = -1;
513
514 // Search for the previous copy of this config item, so we can delete it
515 old_msgnum = CtdlGetConfigLong(sysconfname);
516
517 // Go ahead and save it, and write the new msgnum to the config database so we can find it again
518 new_msgnum = CtdlWriteObject(SYSCONFIGROOM, sysconfname, sysconfdata, (strlen(sysconfdata)+1), NULL, 0, 0);
519 if (new_msgnum > 0) {
520 CtdlSetConfigLong(sysconfname, new_msgnum);
521
522 // Now delete the old copy
523 if (old_msgnum > 0) {
524 CtdlDeleteMessages(SYSCONFIGROOM, &old_msgnum, 1, "");
525 }
526 }
527}
#define ROOMNAMELEN
Definition: citadel.h:56
#define AUTHMODE_LDAP
Definition: citadel.h:175
#define AUTHMODE_NATIVE
Definition: citadel.h:173
#define AUTHMODE_LDAP_AD
Definition: citadel.h:176
#define file_citadel_config
Definition: citadel_dirs.h:25
void CtdlGetSysConfigBackend(long msgnum, void *userdata)
Definition: config.c:444
char * CtdlGetConfigStr(char *key)
Definition: config.c:393
void CtdlSetConfigLong(char *key, long value)
Definition: config.c:348
void shutdown_config_system(void)
Definition: config.c:317
void config_warn_if_empty(char *key)
Definition: config.c:36
void migrate_legacy_config(struct legacy_config *lconfig)
Definition: config.c:142
HashList * ctdlconfig
Definition: config.c:22
void initialize_config_system(void)
Definition: config.c:217
int CtdlGetConfigInt(char *key)
Definition: config.c:426
void CtdlDelConfig(char *key)
Definition: config.c:370
void brand_new_installation_set_defaults(void)
Definition: config.c:82
long CtdlGetConfigLong(char *key)
Definition: config.c:437
long config_msgnum
Definition: config.c:21
void CtdlPutSysConfig(char *sysconfname, char *sysconfdata)
Definition: config.c:510
void config_warn_if_port_unset(char *key, int default_port)
Definition: config.c:25
void CtdlSetConfigStr(char *key, char *value)
Definition: config.c:326
void CtdlSetConfigInt(char *key, int value)
Definition: config.c:359
char * CtdlGetSysConfig(char *sysconfname)
Definition: config.c:452
void validate_config(void)
Definition: config.c:45
#define CC
Definition: context.h:140
int CtdlGetRoom(struct ctdlroom *qrbuf, const char *room_name)
Definition: room_ops.c:342
void cdb_free(struct cdbdata *cdb)
Definition: database.c:609
int cdb_store(int cdb, const void *ckey, int ckeylen, void *cdata, int cdatalen)
Definition: database.c:397
struct cdbdata * cdb_fetch(int cdb, const void *key, int keylen)
Definition: database.c:546
int cdb_delete(int cdb, void *key, int keylen)
Definition: database.c:482
void CM_Free(struct CtdlMessage *msg)
Definition: msgbase.c:310
int CtdlForEachMessage(int mode, long ref, char *search_string, char *content_type, struct CtdlMessage *compare, ForEachMsgCallback CallBack, void *userdata)
Definition: msgbase.c:626
struct CtdlMessage * CtdlFetchMessage(long msgnum, int with_body)
Definition: msgbase.c:1135
long CtdlWriteObject(char *req_room, char *content_type, char *raw_message, off_t raw_length, struct ctdluser *is_mailbox, int is_binary, unsigned int flags)
Definition: msgbase.c:3482
int CtdlDeleteMessages(const char *room_name, long *dmsgnums, int num_dmsgnums, char *content_type)
Definition: msgbase.c:3240
@ MSGS_LAST
Definition: msgbase.h:10
void * malloc(size_t)
void free(void *)
#define CTDLEXIT_CONFIG
Definition: server.h:74
uid_t ctdluid
Definition: server_main.c:30
@ eMesageText
Definition: server.h:315
#define CTDLEXIT_LIBCITADEL
Definition: server.h:77
#define CTDL_EXIT_UNSUP_AUTH
Definition: server.h:78
@ CDB_CONFIG
Definition: server.h:198
@ S_CONFIG
Definition: server.h:143
char * cm_fields[256]
Definition: server.h:37
int expire_mode
Definition: citadel.h:65
int expire_value
Definition: citadel.h:66
char * ptr
Definition: server.h:204
int c_nntps_port
Definition: config.h:95
int c_rfc822_strict_from
Definition: config.h:50
char c_imap_keep_from
Definition: config.h:87
time_t c_net_freq
Definition: config.h:53
char c_sysadm[26]
Definition: config.h:33
char c_aideroom[128]
Definition: config.h:57
int c_min_workers
Definition: config.h:46
char c_fqdn[64]
Definition: config.h:19
time_t c_pop3_fetch
Definition: config.h:90
int c_purge_hour
Definition: config.h:58
int c_guest_logins
Definition: config.h:93
char c_twitdetect
Definition: config.h:27
char c_rbl_at_greeting
Definition: config.h:83
char c_moreprompt[80]
Definition: config.h:29
int c_xmpp_c2s_port
Definition: config.h:88
int c_sleeping
Definition: config.h:24
char c_ldap_bind_pw[256]
Definition: config.h:64
char c_initax
Definition: config.h:25
int c_msa_port
Definition: config.h:65
char c_disable_newu
Definition: config.h:54
int c_imap_port
Definition: config.h:52
int c_max_workers
Definition: config.h:47
int c_aide_zap
Definition: config.h:51
int c_nntp_port
Definition: config.h:94
char c_restrict
Definition: config.h:30
int c_pftcpdict_port
Definition: config.h:76
char c_site_location[32]
Definition: config.h:32
int c_maxsessions
Definition: config.h:36
char c_journal_pubmsgs
Definition: config.h:73
int c_ldap_port
Definition: config.h:61
int c_auth_mode
Definition: config.h:78
char c_ldap_base_dn[256]
Definition: config.h:62
char c_baseroom[128]
Definition: config.h:56
char c_ldap_host[128]
Definition: config.h:60
char c_auto_cull
Definition: config.h:69
int c_pop3_port
Definition: config.h:48
int c_port_number
Definition: config.h:38
int c_xmpp_s2s_port
Definition: config.h:89
char c_nodename[16]
Definition: config.h:18
int c_spam_flag_only
Definition: config.h:92
char c_creataide
Definition: config.h:23
char c_twitroom[128]
Definition: config.h:28
char c_ip_addr[20]
Definition: config.h:37
long c_maxmsglen
Definition: config.h:45
char c_regiscall
Definition: config.h:26
time_t c_pop3_fastest
Definition: config.h:91
char c_default_cal_zone[128]
Definition: config.h:75
char c_humannode[21]
Definition: config.h:20
int c_imaps_port
Definition: config.h:66
char c_logpages[128]
Definition: config.h:43
int c_pop3s_port
Definition: config.h:67
char c_journal_dest[128]
Definition: config.h:74
int c_userpurge
Definition: config.h:41
char c_enable_fulltext
Definition: config.h:55
struct ExpirePolicy c_mbxep
Definition: config.h:59
char c_pager_program[256]
Definition: config.h:86
int c_roompurge
Definition: config.h:42
int c_smtps_port
Definition: config.h:68
struct ExpirePolicy c_ep
Definition: config.h:40
int c_smtp_port
Definition: config.h:49
char c_ldap_bind_dn[256]
Definition: config.h:63
char c_createax
Definition: config.h:44
char c_allow_spoofing
Definition: config.h:71
char c_journal_email
Definition: config.h:72
#define BASEROOM
Definition: sysconfig.h:60
#define SIZ
Definition: sysconfig.h:33
#define SYSCONFIGROOM
Definition: sysconfig.h:72
void begin_critical_section(int which_one)
Definition: threads.c:67
void end_critical_section(int which_one)
Definition: threads.c:85