Completed initial code for config system cutover. Not tested yet. Also the import...
authorArt Cancro <ajc@uncensored.citadel.org>
Tue, 5 May 2015 15:32:48 +0000 (11:32 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Tue, 5 May 2015 15:32:48 +0000 (11:32 -0400)
citadel/citserver.c
citadel/control.c
citadel/modules/migrate/serv_migrate.c
citadel/modules/smtp/smtp_clienthandlers.c
citadel/modules/upgrade/serv_upgrade.c
citadel/room_ops.c

index ce562ccdbba6953e58636d589e446044101d93d4..3b63214b882026af3b27615a6ce50ebc01fff0c6 100644 (file)
@@ -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");
 }
 
index 8912bff0758cac0f7eef1b6c4b9a1e3800440d61..2b2721d04a31e1bca930bff66e5a29ba9f0eee74 100644 (file)
@@ -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")
index f5de3cd0126e3bf2dcc2830a6086e2ff3205708f..4a0fd4caa9cb9699b567aee6674678a2d4c3bd5f 100644 (file)
@@ -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");
        }
index bab1d7159a80aa2ac6b365478537a7bdbee62f69..960a6e0258a7ff8be83deb99daf87041df1093f7 100644 (file)
@@ -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;
index 7cd9c10b5e5e34336081b5cee83563e6104c3f7f..eadfefb3086a18af2c5d989626f14c10423682e8 100644 (file)
@@ -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();
index 1c01f99461abb7c7383e7262c41329f3b660ebba..9979e03ea0658e486425b5c7cd2915702b16d217 100644 (file)
@@ -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);