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