From: Art Cancro Date: Wed, 3 Jun 2015 16:14:38 +0000 (-0400) Subject: Finished migrating legacy control record to new config format X-Git-Tag: Release_902~156^2~1^2~4^2~7 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=7b6c1a40ca8adc2e68c525d09a5788a5d46034ce Finished migrating legacy control record to new config format --- diff --git a/citadel/citadel.h b/citadel/citadel.h index d1dd3598f..f45b0ea77 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -116,9 +116,7 @@ struct ctdluser { /* User record */ }; -/* Bits which may appear in CitControl.MMflags. Note that these don't - * necessarily pertain to the message base -- it's just a good place to - * store any global flags. +/* Bits which may appear in MMflags. */ #define MM_VALID 4 /* New users need validating */ diff --git a/citadel/citserver.c b/citadel/citserver.c index d26102f61..9832b7812 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -138,9 +138,10 @@ void master_startup(void) { open_databases(); /* Load site-specific configuration */ - syslog(LOG_INFO, "Loading citadel.config"); + syslog(LOG_INFO, "Initializing configuration system"); initialize_config_system(); validate_config(); + migrate_legacy_control_record(); /* Check floor reference counts */ check_ref_counts(); diff --git a/citadel/control.c b/citadel/control.c index 230b8d3df..681381f25 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -21,10 +21,22 @@ #include "citserver.h" #include "user_ops.h" -struct CitControl CitControl; -FILE *control_fp = NULL; long control_highest_user = 0; +/* + * This is the control record for the message base... + */ +struct legacy_ctrl_format { + long MMhighest; /* highest message number in file */ + unsigned MMflags; /* Global system flags */ + long MMnextuser; /* highest user number on system */ + long MMnextroom; /* highest room number on system */ + int MM_hosted_upgrade_level; /* Server-hosted upgrade level */ + int MM_fulltext_wordbreaker; /* ID of wordbreaker in use */ + long MMfulltext; /* highest message number indexed */ + int MMdbversion; /* Version of Berkeley DB used on previous server run */ +}; + /* @@ -40,9 +52,9 @@ void control_find_highest(struct ctdlroom *qrbuf, void *data) int room_fixed = 0; int message_fixed = 0; - if (qrbuf->QRnumber > CitControl.MMnextroom) + if (qrbuf->QRnumber > CtdlGetConfigLong("MMnextroom")) { - CitControl.MMnextroom = qrbuf->QRnumber; + CtdlSetConfigLong("MMnextroom", qrbuf->QRnumber); room_fixed = 1; } @@ -61,18 +73,20 @@ void control_find_highest(struct ctdlroom *qrbuf, void *data) { for (c=0; c CitControl.MMhighest) + if (msglist[c] > CtdlGetConfigLong("MMhighest")) { - CitControl.MMhighest = msglist[c]; + CtdlSetConfigLong("MMhighest", msglist[c]); message_fixed = 1; } } } cdb_free(cdbfr); - if (room_fixed) + if (room_fixed) { syslog(LOG_INFO, "Control record checking....Fixed room counter\n"); - if (message_fixed) + } + if (message_fixed) { syslog(LOG_INFO, "Control record checking....Fixed message count\n"); + } return; } @@ -85,9 +99,9 @@ void control_find_user (struct ctdluser *EachUser, void *out_data) { int user_fixed = 0; - if (EachUser->usernum > CitControl.MMnextuser) + if (EachUser->usernum > CtdlGetConfigLong("MMnextuser")) { - CitControl.MMnextuser = EachUser->usernum; + CtdlSetConfigLong("MMnextuser", EachUser->usernum); user_fixed = 1; } if(user_fixed) @@ -96,91 +110,38 @@ void control_find_user (struct ctdluser *EachUser, void *out_data) /* - * get_control - read the control record into memory. + * If we have a legacy format control record on disk, import it. */ -void get_control(void) +void migrate_legacy_control_record(void) { - static int already_have_control = 0; - int rv = 0; - - /* - * If we already have the control record in memory, there's no point - * in reading it from disk again. - */ - if (already_have_control) return; - - /* Zero it out. If the control record on disk is missing or short, - * the system functions with all control record fields initialized - * to zero. - */ - memset(&CitControl, 0, sizeof(struct CitControl)); - if (control_fp == NULL) { - control_fp = fopen(file_citadel_control, "rb+"); - if (control_fp != NULL) { - rv = fchown(fileno(control_fp), ctdluid, -1); - if (rv == -1) - syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]\n", - file_citadel_control, strerror(errno)); - rv = fchmod(fileno(control_fp), S_IRUSR|S_IWUSR); - if (rv == -1) - syslog(LOG_EMERG, "Failed to adjust accessrights of: %s [%s]\n", - file_citadel_control, strerror(errno)); - } - } - if (control_fp == NULL) { - control_fp = fopen(file_citadel_control, "wb+"); - if (control_fp != NULL) { - memset(&CitControl, 0, sizeof(struct CitControl)); - - rv = fchown(fileno(control_fp), ctdluid, -1); - if (rv == -1) - syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]\n", - file_citadel_control, strerror(errno)); - - rv = fchmod(fileno(control_fp), S_IRUSR|S_IWUSR); - if (rv == -1) - syslog(LOG_EMERG, "Failed to adjust accessrights of: %s [%s]\n", - file_citadel_control, strerror(errno)); - rv = fwrite(&CitControl, sizeof(struct CitControl), 1, control_fp); - if (rv == -1) - syslog(LOG_EMERG, "Failed to write: %s [%s]\n", - file_citadel_control, strerror(errno)); - rewind(control_fp); + FILE *fp = NULL; + struct legacy_ctrl_format c; + memset(&c, 0, sizeof(c)); + + fp = fopen(file_citadel_control, "rb+"); + if (fp != NULL) { + syslog(LOG_INFO, "Legacy format control record found -- importing to db"); + fread(&c, sizeof(struct legacy_ctrl_format), 1, fp); + + CtdlSetConfigLong( "MMhighest", c.MMhighest); + CtdlSetConfigInt( "MMflags", c.MMflags); + CtdlSetConfigLong( "MMnextuser", c.MMnextuser); + CtdlSetConfigLong( "MMnextroom", c.MMnextroom); + CtdlSetConfigInt( "MM_hosted_upgrade_level", c.MM_hosted_upgrade_level); + CtdlSetConfigInt( "MM_fulltext_wordbreaker", c.MM_fulltext_wordbreaker); + CtdlSetConfigLong( "MMfulltext", c.MMfulltext); + + fclose(fp); + if (unlink(file_citadel_control) != 0) { + fprintf(stderr, "Unable to remove legacy control record %s after migrating it.\n", file_citadel_control); + fprintf(stderr, "Exiting to prevent data corruption.\n"); + exit(CTDLEXIT_CONFIG); } } - if (control_fp == NULL) { - syslog(LOG_ALERT, "ERROR opening %s: %s\n", file_citadel_control, strerror(errno)); - return; - } - - rewind(control_fp); - rv = fread(&CitControl, sizeof(struct CitControl), 1, control_fp); - if (rv == -1) - syslog(LOG_EMERG, "Failed to read Controlfile: %s [%s]\n", - file_citadel_control, strerror(errno)); - already_have_control = 1; - rv = chown(file_citadel_control, ctdluid, (-1)); - if (rv == -1) - syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]\n", - file_citadel_control, strerror(errno)); } -/* - * put_control - write the control record to disk. - */ -void put_control(void) -{ - int rv = 0; - - if (control_fp != NULL) { - rewind(control_fp); - rv = fwrite(&CitControl, sizeof(struct CitControl), 1, control_fp); - if (rv == -1) - syslog(LOG_EMERG, "Failed to write: %s [%s]\n", - file_citadel_control, strerror(errno)); - fflush(control_fp); - } -} + + /* @@ -188,25 +149,12 @@ void put_control(void) */ void check_control(void) { - syslog(LOG_INFO, "Checking/re-building control record\n"); - get_control(); - // Find highest room number and message number. + syslog(LOG_INFO, "Sanity checking the recorded highest message, user, and room numbers\n"); CtdlForEachRoom(control_find_highest, NULL); ForEachUser(control_find_user, NULL); - put_control(); } -/* - * release_control - close our fd on exit - */ -void release_control(void) -{ - if (control_fp != NULL) { - fclose(control_fp); - } - control_fp = NULL; -} /* * get_new_message_number() - Obtain a new, unique ID to be used for a message. @@ -215,9 +163,9 @@ long get_new_message_number(void) { long retval = 0L; begin_critical_section(S_CONTROL); - get_control(); - retval = ++CitControl.MMhighest; - put_control(); + retval = CtdlGetConfigLong("MMhighest"); + ++retval; + CtdlSetConfigLong("MMhighest", retval); end_critical_section(S_CONTROL); return(retval); } @@ -228,15 +176,12 @@ long get_new_message_number(void) * This provides a quick way to initialise a variable that might be used to indicate * messages that should not be processed. EG. a new Sieve script will use this * to record determine that messages older than this should not be processed. + * + * (Why is this function here? Can't we just go straight to the config variable it fetches?) */ long CtdlGetCurrentMessageNumber(void) { - long retval = 0L; - begin_critical_section(S_CONTROL); - get_control(); - retval = CitControl.MMhighest; - end_critical_section(S_CONTROL); - return(retval); + return CtdlGetConfigLong("MMhighest"); } @@ -247,9 +192,9 @@ long get_new_user_number(void) { long retval = 0L; begin_critical_section(S_CONTROL); - get_control(); - retval = ++CitControl.MMnextuser; - put_control(); + retval = CtdlGetConfigLong("MMnextuser"); + ++retval; + CtdlSetConfigLong("MMnextuser", retval); end_critical_section(S_CONTROL); return(retval); } @@ -263,9 +208,9 @@ long get_new_room_number(void) { long retval = 0L; begin_critical_section(S_CONTROL); - get_control(); - retval = ++CitControl.MMnextroom; - put_control(); + retval = CtdlGetConfigLong("MMnextroom"); + ++retval; + CtdlSetConfigLong("MMnextroom", retval); end_critical_section(S_CONTROL); return(retval); } @@ -645,8 +590,7 @@ void cmd_conf(char *argbuf) * index so it doesn't try to use it later. */ if (CtdlGetConfigInt("c_enable_fulltext") == 0) { - CitControl.MM_fulltext_wordbreaker = 0; - put_control(); + CtdlSetConfigInt("MM_fulltext_wordbreaker", 0); } } diff --git a/citadel/control.h b/citadel/control.h index f6ed7bfb4..649d3fd85 100644 --- a/citadel/control.h +++ b/citadel/control.h @@ -16,3 +16,4 @@ void check_control(void); long int get_new_message_number (void); long int get_new_user_number (void); long int get_new_room_number (void); +void migrate_legacy_control_record(void); diff --git a/citadel/modules/ctdlproto/serv_user.c b/citadel/modules/ctdlproto/serv_user.c index 7d6b18c6c..51ea437b7 100644 --- a/citadel/modules/ctdlproto/serv_user.c +++ b/citadel/modules/ctdlproto/serv_user.c @@ -240,23 +240,19 @@ void cmd_creu(char *cmdbuf) } - /* * get user parameters */ void cmd_getu(char *cmdbuf) { - if (CtdlAccessCheck(ac_logged_in)) return; CtdlGetUser(&CC->user, CC->curr_user); - cprintf("%d 80|24|%d|\n", - CIT_OK, - (CC->user.flags & US_USER_SET) - ); + cprintf("%d 80|24|%d|\n", CIT_OK, (CC->user.flags & US_USER_SET)); } + /* * set user parameters */ @@ -423,7 +419,7 @@ void cmd_gnur(char *argbuf) return; } - if ((CitControl.MMflags & MM_VALID) == 0) { + if ((CtdlGetConfigInt("MMflags") & MM_VALID) == 0) { cprintf("%d There are no unvalidated users.\n", CIT_OK); return; } @@ -451,13 +447,12 @@ void cmd_gnur(char *argbuf) */ begin_critical_section(S_CONTROL); - get_control(); - CitControl.MMflags = CitControl.MMflags & (~MM_VALID); - put_control(); + int flags; + flags = CtdlGetConfigInt("MMflags"); + flags = flags & (~MM_VALID); + CtdlSetConfigInt("MMflags", flags); end_critical_section(S_CONTROL); cprintf("%d *** End of registration.\n", CIT_OK); - - } @@ -533,9 +528,9 @@ void cmd_chek(char *argbuf) regis = 1; if (CC->user.axlevel >= AxAideU) { - get_control(); - if (CitControl.MMflags & MM_VALID) + if (CtdlGetConfigInt("MMflags") & MM_VALID) { vali = 1; + } } /* check for mail */ diff --git a/citadel/modules/fulltext/serv_fulltext.c b/citadel/modules/fulltext/serv_fulltext.c index 8029b7583..05ab77906 100644 --- a/citadel/modules/fulltext/serv_fulltext.c +++ b/citadel/modules/fulltext/serv_fulltext.c @@ -210,7 +210,7 @@ void ft_index_message(long msgnum, int op) { */ void ft_index_msg(long msgnum, void *userdata) { - if ((msgnum > CitControl.MMfulltext) && (msgnum <= ft_newhighest)) { + if ((msgnum > CtdlGetConfigLong("MMfulltext")) && (msgnum <= ft_newhighest)) { ++ft_num_msgs; if (ft_num_msgs > ft_num_alloc) { ft_num_alloc += 1024; @@ -268,7 +268,10 @@ void do_fulltext_indexing(void) { * Check to see whether the fulltext index is up to date; if there * are no messages to index, don't waste any more time trying. */ - if ((CitControl.MMfulltext >= CitControl.MMhighest) && (CitControl.MM_fulltext_wordbreaker == FT_WORDBREAKER_ID)) { + if ( + (CtdlGetConfigLong("MMfulltext") >= CtdlGetConfigLong("MMhighest")) + && (CtdlGetConfigInt("MM_fulltext_wordbreaker") == FT_WORDBREAKER_ID) + ) { return; /* nothing to do! */ } @@ -280,21 +283,20 @@ void do_fulltext_indexing(void) { * over. */ begin_critical_section(S_CONTROL); - if (CitControl.MM_fulltext_wordbreaker != FT_WORDBREAKER_ID) { + if (CtdlGetConfigInt("MM_fulltext_wordbreaker") != FT_WORDBREAKER_ID) { syslog(LOG_DEBUG, "wb ver on disk = %d, code ver = %d", - CitControl.MM_fulltext_wordbreaker, FT_WORDBREAKER_ID + CtdlGetConfigInt("MM_fulltext_wordbreaker"), FT_WORDBREAKER_ID ); syslog(LOG_INFO, "(re)initializing full text index"); cdb_trunc(CDB_FULLTEXT); - CitControl.MMfulltext = 0L; - put_control(); + CtdlSetConfigLong("MMfulltext", 0); } end_critical_section(S_CONTROL); /* * Now go through each room and find messages to index. */ - ft_newhighest = CitControl.MMhighest; + ft_newhighest = CtdlGetConfigLong("MMhighest"); CtdlForEachRoom(ft_index_room, NULL); /* load all msg pointers */ if (ft_num_msgs > 0) { @@ -353,9 +355,8 @@ void do_fulltext_indexing(void) { /* Save our place so we don't have to do this again */ ft_flush_cache(); begin_critical_section(S_CONTROL); - CitControl.MMfulltext = ft_newhighest; - CitControl.MM_fulltext_wordbreaker = FT_WORDBREAKER_ID; - put_control(); + CtdlSetConfigLong("MMfulltext", ft_newhighest); + CtdlSetConfigInt("MM_fulltext_wordbreaker", FT_WORDBREAKER_ID); end_critical_section(S_CONTROL); last_index = time(NULL); diff --git a/citadel/modules/imap/serv_imap.c b/citadel/modules/imap/serv_imap.c index 34c175dcb..60584df27 100644 --- a/citadel/modules/imap/serv_imap.c +++ b/citadel/modules/imap/serv_imap.c @@ -913,7 +913,7 @@ void imap_select(int num_parms, ConstStr *Params) IAPrintf("* %d RECENT\r\n", new); IAPrintf("* OK [UIDVALIDITY %ld] UID validity status\r\n", GLOBAL_UIDVALIDITY_VALUE); - IAPrintf("* OK [UIDNEXT %ld] Predicted next UID\r\n", CitControl.MMhighest + 1); + IAPrintf("* OK [UIDNEXT %ld] Predicted next UID\r\n", CtdlGetConfigLong("MMhighest") + 1); /* Technically, \Deleted is a valid flag, but not a permanent flag, * because we don't maintain its state across sessions. Citadel @@ -1216,7 +1216,7 @@ void imap_status(int num_parms, ConstStr *Params) IPutStr(imaproomname, len); IAPrintf(" (MESSAGES %d ", msgs); IAPrintf("RECENT %d ", new); /* Initially, new==recent */ - IAPrintf("UIDNEXT %ld ", CitControl.MMhighest + 1); + IAPrintf("UIDNEXT %ld ", CtdlGetConfigLong("MMhighest") + 1); IAPrintf("UNSEEN %d)\r\n", new); /* diff --git a/citadel/modules/migrate/serv_migrate.c b/citadel/modules/migrate/serv_migrate.c index 2d2ddda38..7dbbdee5f 100644 --- a/citadel/modules/migrate/serv_migrate.c +++ b/citadel/modules/migrate/serv_migrate.c @@ -16,8 +16,7 @@ * Explanation of tags: * * 0% nothing - * 1% finished exporting config - * 2% finished exporting control + * 2% finished exporting configuration * 7% finished exporting users * 12% finished exporting openids * 17% finished exporting rooms @@ -61,7 +60,6 @@ #include "database.h" #include "msgbase.h" #include "user_ops.h" -#include "control.h" #include "euidindex.h" #include "ctdl_module.h" @@ -452,21 +450,10 @@ void migr_do_export(void) { cprintf("%d\n", REV_LEVEL); cprintf("%d\n", 0); - /* export the config file (this is done using x-macros) */ + /* export the configuration database */ migr_export_configs(); - cprintf("%d\n", 1); - - /* Export the control file */ - get_control(); - client_write("\n", 10); - cprintf("%ld\n", CitControl.MMhighest); - cprintf("%u\n", CitControl.MMflags); - cprintf("%ld\n", CitControl.MMnextuser); - cprintf("%ld\n", CitControl.MMnextroom); - cprintf("%d\n", CitControl.MM_hosted_upgrade_level); - client_write("\n", 11); cprintf("%d\n", 2); - + if (Ctx->kill_me == 0) migr_export_users(); cprintf("%d\n", 7); if (Ctx->kill_me == 0) migr_export_openids(); @@ -568,26 +555,6 @@ void migr_xml_start(void *data, const char *el, const char **attr) { } - -int migr_controlrecord(void *data, const char *el) -{ - if (!strcasecmp(el, "control_highest")) CitControl.MMhighest = atol(ChrPtr(migr_chardata)); - else if (!strcasecmp(el, "control_flags")) CitControl.MMflags = atoi(ChrPtr(migr_chardata)); - else if (!strcasecmp(el, "control_nextuser")) CitControl.MMnextuser = atol(ChrPtr(migr_chardata)); - else if (!strcasecmp(el, "control_nextroom")) CitControl.MMnextroom = atol(ChrPtr(migr_chardata)); - else if (!strcasecmp(el, "control_version")) CitControl.MM_hosted_upgrade_level = atoi(ChrPtr(migr_chardata)); - - else if (!strcasecmp(el, "control")) { - CitControl.MMfulltext = (-1L); /* always flush */ - put_control(); - syslog(LOG_INFO, "Completed import of control record\n"); - } - else return 0; - return 1; - -} - - int migr_userrecord(void *data, const char *el) { if (!strcasecmp(el, "u_version")) usbuf.version = atoi(ChrPtr(migr_chardata)); @@ -696,10 +663,6 @@ void migr_xml_end(void *data, const char *el) CtdlSetConfigInt("c_enable_fulltext", 0); /* always disable FIXME put this somewhere more appropriate */ } - /*** CONTROL ***/ - else if ((!strncasecmp(el, HKEY("control"))) && - migr_controlrecord(data, el)) - ; /* Nothing to do anymore */ /*** USER ***/ else if ((!strncasecmp(el, HKEY("u_"))) && migr_userrecord(data, el)) diff --git a/citadel/modules/mrtg/serv_mrtg.c b/citadel/modules/mrtg/serv_mrtg.c index cff00a7ae..0402461db 100644 --- a/citadel/modules/mrtg/serv_mrtg.c +++ b/citadel/modules/mrtg/serv_mrtg.c @@ -110,7 +110,7 @@ void mrtg_users(void) { * Volume of messages submitted */ void mrtg_messages(void) { - mrtg_output(CitControl.MMhighest, 0L); + mrtg_output(CtdlGetConfigLong("MMhighest"), 0); } diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index eadfefb30..06eb8bcae 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -261,7 +261,7 @@ void guess_time_zone(void) { */ void update_config(void) { - int oldver = CitControl.MM_hosted_upgrade_level; + int oldver = CtdlGetConfigInt("MM_hosted_upgrade_level"); if (oldver < 606) { CtdlSetConfigInt("c_rfc822_strict_from", 0); @@ -310,13 +310,12 @@ void update_config(void) { */ void check_server_upgrades(void) { - get_control(); syslog(LOG_INFO, "Existing database version on disk is %d.%02d", - (CitControl.MM_hosted_upgrade_level / 100), - (CitControl.MM_hosted_upgrade_level % 100) + (CtdlGetConfigInt("MM_hosted_upgrade_level") / 100), + (CtdlGetConfigInt("MM_hosted_upgrade_level") % 100) ); - if (CitControl.MM_hosted_upgrade_level < REV_LEVEL) { + if (CtdlGetConfigInt("MM_hosted_upgrade_level") < REV_LEVEL) { syslog(LOG_WARNING, "Server hosted updates need to be processed at this time. Please wait..." ); @@ -327,29 +326,29 @@ void check_server_upgrades(void) { update_config(); - if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 555)) { + if ((CtdlGetConfigInt("MM_hosted_upgrade_level") > 000) && (CtdlGetConfigInt("MM_hosted_upgrade_level") < 555)) { syslog(LOG_EMERG, "This database is too old to be upgraded. Citadel server will exit."); exit(EXIT_FAILURE); } - if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 591)) { + if ((CtdlGetConfigInt("MM_hosted_upgrade_level") > 000) && (CtdlGetConfigInt("MM_hosted_upgrade_level") < 591)) { bump_mailbox_generation_numbers(); } - if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 608)) { + if ((CtdlGetConfigInt("MM_hosted_upgrade_level") > 000) && (CtdlGetConfigInt("MM_hosted_upgrade_level") < 608)) { convert_ctdluid_to_minusone(); } - if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 659)) { + if ((CtdlGetConfigInt("MM_hosted_upgrade_level") > 000) && (CtdlGetConfigInt("MM_hosted_upgrade_level") < 659)) { rebuild_euid_index(); } - if (CitControl.MM_hosted_upgrade_level < 735) { + if (CtdlGetConfigInt("MM_hosted_upgrade_level") < 735) { fix_sys_user_name(); } - if (CitControl.MM_hosted_upgrade_level < 736) { + if (CtdlGetConfigInt("MM_hosted_upgrade_level") < 736) { rebuild_usersbynumber(); } - if (CitControl.MM_hosted_upgrade_level < 790) { + if (CtdlGetConfigInt("MM_hosted_upgrade_level") < 790) { remove_thread_users(); } - if (CitControl.MM_hosted_upgrade_level < 810) { + if (CtdlGetConfigInt("MM_hosted_upgrade_level") < 810) { struct ctdlroom QRoom; if (!CtdlGetRoom(&QRoom, SMTP_SPOOLOUT_ROOM)) { QRoom.QRdefaultview = VIEW_QUEUE; @@ -361,7 +360,7 @@ void check_server_upgrades(void) { } } - CitControl.MM_hosted_upgrade_level = REV_LEVEL; + CtdlSetConfigInt("MM_hosted_upgrade_level", REV_LEVEL); /* * Negative values for maxsessions are not allowed. @@ -378,8 +377,6 @@ void check_server_upgrades(void) { CtdlSetConfigInt("c_ep_mode", EXPIRE_MANUAL); CtdlSetConfigInt("c_ep_value", 0); } - - put_control(); } diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index 12e39696d..08cda5b08 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -73,10 +73,12 @@ * set global flag calling for an aide to validate new users */ void set_mm_valid(void) { + int flags = 0; + begin_critical_section(S_CONTROL); - get_control(); - CitControl.MMflags = CitControl.MMflags | MM_VALID ; - put_control(); + flags = CtdlGetConfigInt("MMflags"); + flags = flags | MM_VALID ; + CtdlSetConfigInt("MMflags", flags); end_critical_section(S_CONTROL); } diff --git a/citadel/server.h b/citadel/server.h index 0eff9fdc4..4a6dbc1d2 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -116,22 +116,7 @@ enum { #define CS_POSTING 4 /* Posting */ -/* - * This is the control record for the message base... - */ -struct CitControl { - long MMhighest; /* highest message number in file */ - unsigned MMflags; /* Global system flags */ - long MMnextuser; /* highest user number on system */ - long MMnextroom; /* highest room number on system */ - int MM_hosted_upgrade_level; /* Server-hosted upgrade level */ - int MM_fulltext_wordbreaker; /* ID of wordbreaker in use */ - long MMfulltext; /* highest message number indexed */ - int MMdbversion; /* Version of Berkeley DB used on previous server run */ -}; - extern int ScheduledShutdown; -extern struct CitControl CitControl; extern uid_t ctdluid; struct ExpressMessage {