X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fconfig.c;h=d9eee63e739b40a00d8880986c7c933c07d22944;hb=6cd4b62a62098566ed73d7662d22e29fc509b9f3;hp=a993a63ee1cb52ee5a64aceba5ae57a334b87fcc;hpb=97d2e8bd7fc240780d91eb4b21bc219e7401c4de;p=citadel.git diff --git a/citadel/config.c b/citadel/config.c index a993a63ee..d9eee63e7 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -1,7 +1,7 @@ /* * Read and write the citadel.config file * - * Copyright (c) 1987-2016 by the citadel.org team + * Copyright (c) 1987-2017 by the citadel.org team * * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3. @@ -13,7 +13,10 @@ */ #include "sysdep.h" +#include +#include #include +#include #include #include #include @@ -29,8 +32,8 @@ void config_warn_if_port_unset(char *key, int default_port) \ int p = CtdlGetConfigInt(key); if ((p < -1) || (p == 0) || (p > UINT16_MAX)) { - syslog(LOG_EMERG, - "configuration setting %s is not -1 (disabled) or a valid TCP-Port - check your config! Default setting is: %d", + syslog(LOG_ERR, + "config: setting %s is not -1 (disabled) or a valid TCP-Port - check your config! Default setting is: %d", key, default_port ); } @@ -41,12 +44,11 @@ void config_warn_if_empty(char *key) { if (IsEmptyStr(CtdlGetConfigStr(key))) { - syslog(LOG_EMERG, "configuration setting %s is empty, but must not - check your config!", key); + syslog(LOG_ERR, "config: setting %s is empty, but must not - check your config!", key); } } - void validate_config(void) { /* @@ -78,11 +80,11 @@ void validate_config(void) { config_warn_if_port_unset("c_nntps_port", 563); if (getpwuid(ctdluid) == NULL) { - syslog(LOG_EMERG, "The UID (%d) citadel is configured to use is not defined in your system (/etc/passwd?)!", ctdluid); + syslog(LOG_ERR, "config: UID (%d) citadel is configured to use is not defined in your system (/etc/passwd?)!", ctdluid); } - } + /* * Put some sane default values into our configuration. Some will be overridden when we run setup. */ @@ -143,7 +145,6 @@ void brand_new_installation_set_defaults(void) { } - /* * Migrate a supplied legacy configuration to the new in-db format. * No individual site should ever have to do this more than once. @@ -206,10 +207,6 @@ void migrate_legacy_config(struct legacy_config *lconfig) CtdlSetConfigInt( "c_pftcpdict_port" , lconfig->c_pftcpdict_port ); CtdlSetConfigInt( "c_managesieve_port" , lconfig->c_managesieve_port ); CtdlSetConfigInt( "c_auth_mode" , lconfig->c_auth_mode ); - CtdlSetConfigStr( "c_funambol_host" , lconfig->c_funambol_host ); - CtdlSetConfigInt( "c_funambol_port" , lconfig->c_funambol_port ); - CtdlSetConfigStr( "c_funambol_source" , lconfig->c_funambol_source ); - CtdlSetConfigStr( "c_funambol_auth" , lconfig->c_funambol_auth ); CtdlSetConfigInt( "c_rbl_at_greeting" , lconfig->c_rbl_at_greeting ); CtdlSetConfigStr( "c_master_user" , lconfig->c_master_user ); CtdlSetConfigStr( "c_master_pass" , lconfig->c_master_pass ); @@ -226,7 +223,6 @@ void migrate_legacy_config(struct legacy_config *lconfig) } - /* * Called during the initialization of Citadel server. * It verifies the system's integrity and reads citadel.config into memory. @@ -239,12 +235,8 @@ void initialize_config_system(void) { /* Ensure that we are linked to the correct version of libcitadel */ if (libcitadel_version_number() < LIBCITADEL_VERSION_NUMBER) { - fprintf(stderr, "You are running libcitadel version %d.%02d\n", - (libcitadel_version_number() / 100), (libcitadel_version_number() % 100) - ); - fprintf(stderr, "citserver was compiled against version %d.%02d\n", - (LIBCITADEL_VERSION_NUMBER / 100), (LIBCITADEL_VERSION_NUMBER % 100) - ); + fprintf(stderr, "You are running libcitadel version %d\n", libcitadel_version_number()); + fprintf(stderr, "citserver was compiled against version %d\n", LIBCITADEL_VERSION_NUMBER); exit(CTDLEXIT_LIBCITADEL); } @@ -337,7 +329,6 @@ void initialize_config_system(void) { } - /* * Called when Citadel server is shutting down. * Clears out the config hash table. @@ -348,7 +339,6 @@ void shutdown_config_system(void) } - /* * Set a system config value. Simple key/value here. */ @@ -393,7 +383,6 @@ void CtdlSetConfigInt(char *key, int value) } - /* * Delete a system config value. */ @@ -417,8 +406,6 @@ void CtdlDelConfig(char *key) } - - /* * Fetch a system config value. Caller does *not* own the returned value and may not alter it. */ @@ -474,18 +461,6 @@ long CtdlGetConfigLong(char *key) } - -/**********************************************************************/ - - - - - - - - - - void CtdlGetSysConfigBackend(long msgnum, void *userdata) { config_msgnum = msgnum; } @@ -504,12 +479,10 @@ char *CtdlGetSysConfig(char *sysconfname) { return NULL; } - /* We want the last (and probably only) config in this room */ begin_critical_section(S_CONFIG); config_msgnum = (-1L); - CtdlForEachMessage(MSGS_LAST, 1, NULL, sysconfname, NULL, - CtdlGetSysConfigBackend, NULL); + CtdlForEachMessage(MSGS_LAST, 1, NULL, sysconfname, NULL, CtdlGetSysConfigBackend, NULL); msgnum = config_msgnum; end_critical_section(S_CONFIG); @@ -529,10 +502,12 @@ char *CtdlGetSysConfig(char *sysconfname) { CtdlGetRoom(&CC->room, hold_rm); - if (conf != NULL) do { + if (conf != NULL) { + do { extract_token(buf, conf, 0, '\n', sizeof buf); strcpy(conf, &conf[strlen(buf)+1]); } while ( (!IsEmptyStr(conf)) && (!IsEmptyStr(buf)) ); + } return(conf); } @@ -541,4 +516,3 @@ char *CtdlGetSysConfig(char *sysconfname) { void CtdlPutSysConfig(char *sysconfname, char *sysconfdata) { CtdlWriteObject(SYSCONFIGROOM, sysconfname, sysconfdata, (strlen(sysconfdata)+1), NULL, 0, 1, 0); } -