From: Art Cancro Date: Tue, 5 May 2015 15:32:48 +0000 (-0400) Subject: Completed initial code for config system cutover. Not tested yet. Also the import... X-Git-Tag: Release_902~167^2~2 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=cd5ae5682a319e1d7c698cb03c915b04bd55b978 Completed initial code for config system cutover. Not tested yet. Also the import/export module is mostly stubbed out. --- diff --git a/citadel/citserver.c b/citadel/citserver.c index ce562ccdb..3b63214b8 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -144,7 +144,6 @@ void master_startup(void) { syslog(LOG_INFO, "Acquiring control record"); get_control(); - put_config(); /* Check floor reference counts */ check_ref_counts(); @@ -183,8 +182,6 @@ void master_startup(void) { srand(seed); srandom(seed); - put_config(); - syslog(LOG_DEBUG, "master_startup() finished\n"); } diff --git a/citadel/control.c b/citadel/control.c index 8912bff07..2b2721d04 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -648,7 +648,6 @@ void cmd_conf(char *argbuf) } ++a; } - put_config(); snprintf(buf, sizeof buf, "The global system configuration has been edited by %s.\n", (CC->logged_in ? CC->curr_user : "an administrator") diff --git a/citadel/modules/migrate/serv_migrate.c b/citadel/modules/migrate/serv_migrate.c index f5de3cd01..4a0fd4caa 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -683,7 +683,7 @@ void migr_xml_end(void *data, const char *el) if (!strcasecmp(el, "config")) { - /* config.c_enable_fulltext = 0; always disable */ + CtdlSetConfigInt("c_enable_fulltext", 0); /* always disable */ we_are_currently_importing_config = 0; syslog(LOG_INFO, "Completed import of server configuration\n"); } diff --git a/citadel/modules/smtp/smtp_clienthandlers.c b/citadel/modules/smtp/smtp_clienthandlers.c index bab1d7159..960a6e025 100644 --- a/citadel/modules/smtp/smtp_clienthandlers.c +++ b/citadel/modules/smtp/smtp_clienthandlers.c @@ -138,7 +138,7 @@ eNextState SMTPC_send_EHLO(SmtpOutMsg *Msg) /* At this point we know we are talking to a real SMTP server */ /* Do a EHLO command. If it fails, try the HELO command. */ - StrBufPrintf(Msg->IO.SendBuf.Buf, "EHLO %s\r\n", CtdlGetconfigStr("c_fqdn")); + StrBufPrintf(Msg->IO.SendBuf.Buf, "EHLO %s\r\n", CtdlGetConfigStr("c_fqdn")); SMTP_DBG_SEND(); return eReadMessage; @@ -173,7 +173,7 @@ eNextState SMTPC_read_EHLO_reply(SmtpOutMsg *Msg) eNextState STMPC_send_HELO(SmtpOutMsg *Msg) { AsyncIO *IO = &Msg->IO; - StrBufPrintf(Msg->IO.SendBuf.Buf, "HELO %s\r\n", CtdlGetconfigStr("c_fqdn")); + StrBufPrintf(Msg->IO.SendBuf.Buf, "HELO %s\r\n", CtdlGetConfigStr("c_fqdn")); SMTP_DBG_SEND(); return eReadMessage; diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index 7cd9c10b5..eadfefb30 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -261,43 +261,43 @@ void guess_time_zone(void) { */ void update_config(void) { - oldver = CitControl.MM_hosted_upgrade_level; + int oldver = CitControl.MM_hosted_upgrade_level; if (oldver < 606) { - config.c_rfc822_strict_from = 0; + CtdlSetConfigInt("c_rfc822_strict_from", 0); } if (oldver < 609) { - config.c_purge_hour = 3; + CtdlSetConfigInt("c_purge_hour", 3); } if (oldver < 615) { - config.c_ldap_port = 389; + CtdlSetConfigInt("c_ldap_port", 389); } if (oldver < 623) { - strcpy(config.c_ip_addr, "*"); + CtdlSetConfigStr("c_ip_addr", "*"); } if (oldver < 650) { - config.c_enable_fulltext = 1; + CtdlSetConfigInt("c_enable_fulltext", 1); } if (oldver < 652) { - config.c_auto_cull = 1; + CtdlSetConfigInt("c_auto_cull", 1); } if (oldver < 725) { - config.c_xmpp_c2s_port = 5222; - config.c_xmpp_s2s_port = 5269; + CtdlSetConfigInt("c_xmpp_c2s_port", 5222); + CtdlSetConfigInt("c_xmpp_s2s_port", 5269); } if (oldver < 830) { - config.c_nntp_port = 119; - config.c_nntps_port = 563; + CtdlSetConfigInt("c_nntp_port", 119); + CtdlSetConfigInt("c_nntps_port", 563); } - if (IsEmptyStr(config.c_default_cal_zone)) { + if (IsEmptyStr(CtdlGetConfigStr("c_default_cal_zone"))) { guess_time_zone(); } } @@ -366,17 +366,17 @@ void check_server_upgrades(void) { /* * Negative values for maxsessions are not allowed. */ - if (config.c_maxsessions < 0) { - config.c_maxsessions = 0; + if (CtdlGetConfigInt("c_maxsessions") < 0) { + CtdlSetConfigInt("c_maxsessions", 0); } /* We need a system default message expiry policy, because this is * the top level and there's no 'higher' policy to fall back on. * By default, do not expire messages at all. */ - if (config.c_ep.expire_mode == 0) { - config.c_ep.expire_mode = EXPIRE_MANUAL; - config.c_ep.expire_value = 0; + if (CtdlGetConfigInt("c_ep_mode") == 0) { + CtdlSetConfigInt("c_ep_mode", EXPIRE_MANUAL); + CtdlSetConfigInt("c_ep_value", 0); } put_control(); diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 1c01f9946..9979e03ea 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -1056,12 +1056,10 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) { /* If baseroom/aideroom name changes, update config */ if (!strncasecmp(old_name, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN)) { - safestrncpy(CtdlGetConfigStr("c_baseroom"), new_name, ROOMNAMELEN); - put_config(); + CtdlSetConfigStr("c_baseroom", new_name); } if (!strncasecmp(old_name, CtdlGetConfigStr("c_aideroom"), ROOMNAMELEN)) { - safestrncpy(CtdlGetConfigStr("c_aideroom"), new_name, ROOMNAMELEN); - put_config(); + CtdlSetConfigStr("c_aideroom", new_name); } end_critical_section(S_CONFIG);