X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fconfig.c;h=34028abb0ee36b511a9fdcd7cbb9565b8f68ab37;hb=88c52d18e496b38205b30eff94c14eef59558f51;hp=5aee1d72a42782073bef40e060648709db8dd09e;hpb=597f6cc2278e4bb14a4387be32f7f1b9b1db7f5f;p=citadel.git diff --git a/citadel/config.c b/citadel/config.c index 5aee1d72a..34028abb0 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -22,6 +22,49 @@ struct config config; struct configlen configlen; +#define STR_NOT_EMPTY(CFG_FIELDNAME) if (IsEmptyStr(config.CFG_FIELDNAME)) \ + syslog(LOG_EMERG, "configuration setting "#CFG_FIELDNAME" is empty, but must not - check your config!"); + +#define TEST_PORT(CFG_PORT, DEFAULTPORT) \ + if ((config.CFG_PORT < -1) || \ + (config.CFG_PORT == 0) || \ + (config.CFG_PORT > UINT16_MAX)) \ + syslog(LOG_EMERG, "configuration setting "#CFG_PORT" is not -1 (disabled) or a valid TCP-Port - check your config! Default setting is: "#DEFAULTPORT); + + +void validate_config(void) { +/* these shouldn't be empty: */ + STR_NOT_EMPTY(c_fqdn); + + STR_NOT_EMPTY(c_baseroom); + STR_NOT_EMPTY(c_aideroom); + STR_NOT_EMPTY(c_twitroom); + STR_NOT_EMPTY(c_nodename); + STR_NOT_EMPTY(c_default_cal_zone); + +/* we bind a lot of ports: */ + TEST_PORT(c_smtp_port, 25); + TEST_PORT(c_pop3_port, 110); + TEST_PORT(c_imap_port, 143); + TEST_PORT(c_msa_port, 587); + TEST_PORT(c_port_number, 504); + TEST_PORT(c_smtps_port, 465); + TEST_PORT(c_pop3s_port, 995); + TEST_PORT(c_imaps_port, 993); + TEST_PORT(c_pftcpdict_port, -1); + TEST_PORT(c_managesieve_port, 2020); + TEST_PORT(c_xmpp_c2s_port, 5222); + TEST_PORT(c_xmpp_s2s_port, 5269); + TEST_PORT(c_nntp_port, 119); + TEST_PORT(c_nntps_port, 563); + + if (config.c_ctdluid == 0) + syslog(LOG_EMERG, "citadel should not be configured to run as root! Check the value of c_ctdluid"); + else if (getpwuid(CTDLUID) == NULL) + syslog(LOG_EMERG, "The UID (%d) citadel is configured to use is not defined in your system (/etc/passwd?)! Check the value of c_ctdluid", CTDLUID); + +} + /* * Put some sane default values into our configuration. Some will be overridden when we run setup. */ @@ -92,6 +135,7 @@ void brand_new_installation_set_defaults(void) { config.c_xmpp_c2s_port = 5222; config.c_xmpp_s2s_port = 5269; config.c_nntp_port = 119; + config.c_nntps_port = 563; } void setcfglen(void)