Accidentally merged the configdb branch into master. Reverting.
authorArt Cancro <ajc@uncensored.citadel.org>
Thu, 7 May 2015 11:17:54 +0000 (07:17 -0400)
committerArt Cancro <ajc@uncensored.citadel.org>
Thu, 7 May 2015 11:17:54 +0000 (07:17 -0400)
This reverts commit 15054b0f11409cfc68102560fe4ab5a4e2bf4ea0, reversing
changes made to 1d738ab06a5394f604de22f816b87efaa6f2563a.

68 files changed:
citadel/citserver.c
citadel/citserver.h
citadel/config.c
citadel/config.h
citadel/context.c
citadel/control.c
citadel/database.c
citadel/event_client.c
citadel/ical_dezonify.c
citadel/include/ctdl_module.h
citadel/internet_addressing.c
citadel/journaling.c
citadel/ldap.c
citadel/modules/autocompletion/serv_autocompletion.c
citadel/modules/bio/serv_bio.c
citadel/modules/calendar/serv_calendar.c
citadel/modules/crypto/serv_crypto.c
citadel/modules/ctdlproto/serv_file.c
citadel/modules/ctdlproto/serv_messages.c
citadel/modules/ctdlproto/serv_rooms.c
citadel/modules/ctdlproto/serv_session.c
citadel/modules/ctdlproto/serv_user.c
citadel/modules/eventclient/serv_eventclient.c
citadel/modules/expire/expire_policy.c
citadel/modules/expire/serv_expire.c
citadel/modules/extnotify/extnotify_main.c
citadel/modules/extnotify/funambol65.c
citadel/modules/fulltext/serv_fulltext.c
citadel/modules/imap/imap_fetch.c
citadel/modules/imap/imap_misc.c
citadel/modules/imap/imap_search.c
citadel/modules/imap/serv_imap.c
citadel/modules/instmsg/serv_instmsg.c
citadel/modules/managesieve/serv_managesieve.c
citadel/modules/migrate/serv_migrate.c
citadel/modules/mrtg/serv_mrtg.c
citadel/modules/network/serv_netmail.c
citadel/modules/network/serv_netspool.c
citadel/modules/network/serv_network.c
citadel/modules/networkclient/serv_networkclient.c
citadel/modules/nntp/serv_nntp.c
citadel/modules/openid/serv_openid_rp.c
citadel/modules/pop3/serv_pop3.c
citadel/modules/pop3client/serv_pop3client.c
citadel/modules/rssclient/serv_rssclient.c
citadel/modules/sieve/serv_sieve.c
citadel/modules/smtp/serv_smtp.c
citadel/modules/smtp/serv_smtpqueue.c
citadel/modules/smtp/smtp_clienthandlers.c
citadel/modules/smtp/smtp_util.c
citadel/modules/spam/serv_spam.c
citadel/modules/upgrade/serv_upgrade.c
citadel/modules/vcard/serv_vcard.c
citadel/modules/wiki/serv_wiki.c
citadel/modules/xmpp/serv_xmpp.c
citadel/modules/xmpp/xmpp_presence.c
citadel/modules/xmpp/xmpp_query_namespace.c
citadel/msgbase.c
citadel/netconfig.c
citadel/parsedate.c
citadel/room_ops.c
citadel/serv_extensions.c
citadel/server.h
citadel/server_main.c
citadel/sysdep.c
citadel/threads.c
citadel/user_ops.c
citadel/utils/setup.c

index 3b63214b882026af3b27615a6ce50ebc01fff0c6..4a1070b23563876a03ca5b84c10951497888665f 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Main source module for the Citadel server
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2014 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.
@@ -122,9 +122,11 @@ void master_startup(void) {
        
        syslog(LOG_DEBUG, "master_startup() started\n");
        time(&server_startup_time);
+       get_config();
+       validate_config();
 
        syslog(LOG_INFO, "Checking directory access");
-       if ((pw = getpwuid(ctdluid)) == NULL) {
+       if ((pw = getpwuid(CTDLUID)) == NULL) {
                gid = getgid();
        } else {
                gid = pw->pw_gid;
@@ -136,23 +138,13 @@ void master_startup(void) {
        }
        syslog(LOG_INFO, "Opening databases");
        open_databases();
-
-       /* Load site-specific configuration */
-       syslog(LOG_INFO, "Loading citadel.config");
-       initialize_config_system();
-       validate_config();
-
-       syslog(LOG_INFO, "Acquiring control record");
-       get_control();
-
-       /* Check floor reference counts */
        check_ref_counts();
 
        syslog(LOG_INFO, "Creating base rooms (if necessary)\n");
-       CtdlCreateRoom(CtdlGetConfigStr("c_baseroom"),  0, "", 0, 1, 0, VIEW_BBS);
-       CtdlCreateRoom(AIDEROOM,                        3, "", 0, 1, 0, VIEW_BBS);
-       CtdlCreateRoom(SYSCONFIGROOM,                   3, "", 0, 1, 0, VIEW_BBS);
-       CtdlCreateRoom(CtdlGetConfigStr("c_twitroom"),  0, "", 0, 1, 0, VIEW_BBS);
+       CtdlCreateRoom(config.c_baseroom,       0, "", 0, 1, 0, VIEW_BBS);
+       CtdlCreateRoom(AIDEROOM,                3, "", 0, 1, 0, VIEW_BBS);
+       CtdlCreateRoom(SYSCONFIGROOM,           3, "", 0, 1, 0, VIEW_BBS);
+       CtdlCreateRoom(config.c_twitroom,       0, "", 0, 1, 0, VIEW_BBS);
 
        /* The "Local System Configuration" room doesn't need to be visible */
         if (CtdlGetRoomLock(&qrbuf, SYSCONFIGROOM) == 0) {
@@ -182,6 +174,8 @@ void master_startup(void) {
        srand(seed);
        srandom(seed);
 
+       put_config();
+
        syslog(LOG_DEBUG, "master_startup() finished\n");
 }
 
@@ -206,9 +200,6 @@ void master_cleanup(int exitcode) {
 
        /* Do system-dependent stuff */
        sysdep_master_cleanup();
-
-       /* Close the configuration system */
-       shutdown_config_system();
        
        /* Close databases */
        syslog(LOG_INFO, "Closing databases\n");
@@ -298,7 +289,7 @@ int CtdlIsPublicClient(void)
                safestrncpy(public_clientspos, LOCALHOSTSTR, sizeof public_clients);
                public_clientspos += sizeof(LOCALHOSTSTR) - 1;
                
-               if (hostname_to_dotted_quad(addrbuf, CtdlGetConfigStr("c_fqdn")) == 0) {
+               if (hostname_to_dotted_quad(addrbuf, config.c_fqdn) == 0) {
                        *(public_clientspos++) = '|';
                        paddr = &addrbuf[0];
                        while (!IsEmptyStr (paddr) && 
@@ -360,12 +351,12 @@ void citproto_begin_session() {
        if (CC->nologin==1) {
                cprintf("%d %s: Too many users are already online (maximum is %d)\n",
                        ERROR + MAX_SESSIONS_EXCEEDED,
-                       CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions")
+                       config.c_nodename, config.c_maxsessions
                );
                CC->kill_me = KILLME_MAX_SESSIONS_EXCEEDED;
        }
        else {
-               cprintf("%d %s Citadel server ready.\n", CIT_OK, CtdlGetConfigStr("c_nodename"));
+               cprintf("%d %s Citadel server ready.\n", CIT_OK, config.c_nodename);
                CC->can_receive_im = 1;
        }
 }
@@ -373,7 +364,7 @@ void citproto_begin_session() {
 
 void citproto_begin_admin_session() {
        CC->internal_pgm = 1;
-       cprintf("%d %s Citadel server ADMIN CONNECTION ready.\n", CIT_OK, CtdlGetConfigStr("c_nodename"));
+       cprintf("%d %s Citadel server ADMIN CONNECTION ready.\n", CIT_OK, config.c_nodename);
 }
 
 
index 997775bd2a50c4381c889b66e9ec7351aed2ea74..4224fcdcb3d56934b5a309575aeda98d6060d54a 100644 (file)
@@ -1,13 +1,13 @@
 /*
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
+ *  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.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  */
 
 #include "serv_extensions.h"
index f41533c5b13b858f27bf70d4f929c38211a76319..34028abb0ee36b511a9fdcd7cbb9565b8f68ab37 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Read and write the citadel.config file
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2014 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.
 #include "config.h"
 #include "ctdl_module.h"
 
-long config_msgnum = 0;
-HashList *ctdlconfig = NULL;   // new configuration
-
-
-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",
-                       key, default_port
-               );
-       }
-}
-
-
-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);
-       }
-}
+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
-        */
-       config_warn_if_empty("c_fqdn");
-       config_warn_if_empty("c_baseroom");
-       config_warn_if_empty("c_aideroom");
-       config_warn_if_empty("c_twitroom");
-       config_warn_if_empty("c_nodename");
-       config_warn_if_empty("c_default_cal_zone");
-
-       /*
-        * Sanity check for port bindings
-        */
-       config_warn_if_port_unset("c_smtp_port", 25);
-       config_warn_if_port_unset("c_pop3_port", 110);
-       config_warn_if_port_unset("c_imap_port", 143);
-       config_warn_if_port_unset("c_msa_port", 587);
-       config_warn_if_port_unset("c_port_number", 504);
-       config_warn_if_port_unset("c_smtps_port", 465);
-       config_warn_if_port_unset("c_pop3s_port", 995);
-       config_warn_if_port_unset("c_imaps_port", 993);
-       config_warn_if_port_unset("c_pftcpdict_port", -1);
-       config_warn_if_port_unset("c_managesieve_port", 2020);
-       config_warn_if_port_unset("c_xmpp_c2s_port", 5222);
-       config_warn_if_port_unset("c_xmpp_s2s_port", 5269);
-       config_warn_if_port_unset("c_nntp_port", 119);
-       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);
-       }
+/* 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);
        
 }
 
@@ -87,165 +70,110 @@ void validate_config(void) {
  */
 void brand_new_installation_set_defaults(void) {
 
+       struct passwd *pw;
        struct utsname my_utsname;
        struct hostent *he;
-       char detected_hostname[256];
 
        /* Determine our host name, in case we need to use it as a default */
        uname(&my_utsname);
-
+       memset(&configlen, 0, sizeof(struct configlen));
        /* set some sample/default values in place of blanks... */
-       extract_token(detected_hostname, my_utsname.nodename, 0, '.', sizeof detected_hostname);
-       CtdlSetConfigStr("c_nodename", detected_hostname);
+       configlen.c_nodename = extract_token(config.c_nodename, my_utsname.nodename, 0, '.', sizeof config.c_nodename);
+       if (IsEmptyStr(config.c_fqdn) ) {
+               if ((he = gethostbyname(my_utsname.nodename)) != NULL) {
+                       configlen.c_fqdn = safestrncpy(config.c_fqdn, he->h_name, sizeof config.c_fqdn);
+               }
+               else {
+                       configlen.c_fqdn = safestrncpy(config.c_fqdn, my_utsname.nodename, sizeof config.c_fqdn);
+               }
+       }
 
-       if ((he = gethostbyname(my_utsname.nodename)) != NULL) {
-               CtdlSetConfigStr("c_fqdn", he->h_name);
+       configlen.c_humannode = safestrncpy(config.c_humannode, "Citadel Server", sizeof config.c_humannode);
+       configlen.c_phonenum = safestrncpy(config.c_phonenum, "US 800 555 1212", sizeof config.c_phonenum);
+       config.c_initax = 4;
+       configlen.c_moreprompt = safestrncpy(config.c_moreprompt, "<more>", sizeof config.c_moreprompt);
+       configlen.c_twitroom = safestrncpy(config.c_twitroom, "Trashcan", sizeof config.c_twitroom);
+       configlen.c_baseroom = safestrncpy(config.c_baseroom, BASEROOM, sizeof config.c_baseroom);
+       configlen.c_aideroom = safestrncpy(config.c_aideroom, "Aide", sizeof config.c_aideroom);
+       config.c_port_number = 504;
+       config.c_sleeping = 900;
+
+       if (config.c_ctdluid == 0) {
+               pw = getpwnam("citadel");
+               if (pw != NULL) {
+                       config.c_ctdluid = pw->pw_uid;
+               }
        }
-       else {
-               CtdlSetConfigStr("c_fqdn", my_utsname.nodename);
+       if (config.c_ctdluid == 0) {
+               pw = getpwnam("bbs");
+               if (pw != NULL) {
+                       config.c_ctdluid = pw->pw_uid;
+               }
        }
-
-       CtdlSetConfigStr("c_humannode",         "Citadel Server");
-       CtdlSetConfigInt("c_initax",            4);
-       CtdlSetConfigStr("c_moreprompt",        "<more>");
-       CtdlSetConfigStr("c_twitroom",          "Trashcan");
-       CtdlSetConfigStr("c_baseroom",          BASEROOM);
-       CtdlSetConfigStr("c_aideroom",          "Aide");
-       CtdlSetConfigInt("c_sleeping",          900);
-
-       if (CtdlGetConfigInt("c_createax") == 0) {
-               CtdlSetConfigInt("c_createax", 3);
+       if (config.c_ctdluid == 0) {
+               pw = getpwnam("guest");
+               if (pw != NULL) {
+                       config.c_ctdluid = pw->pw_uid;
+               }
+       }
+       if (config.c_createax == 0) {
+               config.c_createax = 3;
        }
 
        /*
         * Default port numbers for various services
         */
-       CtdlSetConfigInt("c_port_number",       504);
-       CtdlSetConfigInt("c_smtp_port",         25);
-       CtdlSetConfigInt("c_pop3_port",         110);
-       CtdlSetConfigInt("c_imap_port",         143);
-       CtdlSetConfigInt("c_msa_port",          587);
-       CtdlSetConfigInt("c_smtps_port",        465);
-       CtdlSetConfigInt("c_pop3s_port",        995);
-       CtdlSetConfigInt("c_imaps_port",        993);
-       CtdlSetConfigInt("c_pftcpdict_port",    -1);
-       CtdlSetConfigInt("c_managesieve_port",  2020);
-       CtdlSetConfigInt("c_xmpp_c2s_port",     5222);
-       CtdlSetConfigInt("c_xmpp_s2s_port",     5269);
-       CtdlSetConfigInt("c_nntp_port",         119);
-       CtdlSetConfigInt("c_nntps_port",        563);
-
-       /*
-        * Prevent the "new installation, set defaults" behavior from occurring again
-        */
-       CtdlSetConfigLong("c_config_created_or_migrated", (long)time(NULL));
+       config.c_smtp_port = 25;
+       config.c_pop3_port = 110;
+       config.c_imap_port = 143;
+       config.c_msa_port = 587;
+       config.c_smtps_port = 465;
+       config.c_pop3s_port = 995;
+       config.c_imaps_port = 993;
+       config.c_pftcpdict_port = -1 ;
+       config.c_managesieve_port = 2020;
+       config.c_xmpp_c2s_port = 5222;
+       config.c_xmpp_s2s_port = 5269;
+       config.c_nntp_port = 119;
+       config.c_nntps_port = 563;
 }
 
-
-
-/*
- * Migrate a supplied legacy configuration to the new in-db format.
- * No individual site should ever have to do this more than once.
- */
-void migrate_legacy_config(struct legacy_config *lconfig)
+void setcfglen(void)
 {
-       CtdlSetConfigStr(       "c_nodename"            ,       lconfig->c_nodename             );
-       CtdlSetConfigStr(       "c_fqdn"                ,       lconfig->c_fqdn                 );
-       CtdlSetConfigStr(       "c_humannode"           ,       lconfig->c_humannode            );
-       CtdlSetConfigInt(       "c_creataide"           ,       lconfig->c_creataide            );
-       CtdlSetConfigInt(       "c_sleeping"            ,       lconfig->c_sleeping             );
-       CtdlSetConfigInt(       "c_initax"              ,       lconfig->c_initax               );
-       CtdlSetConfigInt(       "c_regiscall"           ,       lconfig->c_regiscall            );
-       CtdlSetConfigInt(       "c_twitdetect"          ,       lconfig->c_twitdetect           );
-       CtdlSetConfigStr(       "c_twitroom"            ,       lconfig->c_twitroom             );
-       CtdlSetConfigStr(       "c_moreprompt"          ,       lconfig->c_moreprompt           );
-       CtdlSetConfigInt(       "c_restrict"            ,       lconfig->c_restrict             );
-       CtdlSetConfigStr(       "c_site_location"       ,       lconfig->c_site_location        );
-       CtdlSetConfigStr(       "c_sysadm"              ,       lconfig->c_sysadm               );
-       CtdlSetConfigInt(       "c_maxsessions"         ,       lconfig->c_maxsessions          );
-       CtdlSetConfigStr(       "c_ip_addr"             ,       lconfig->c_ip_addr              );
-       CtdlSetConfigInt(       "c_port_number"         ,       lconfig->c_port_number          );
-       CtdlSetConfigInt(       "c_ep_mode"             ,       lconfig->c_ep.expire_mode       );
-       CtdlSetConfigInt(       "c_ep_value"            ,       lconfig->c_ep.expire_value      );
-       CtdlSetConfigInt(       "c_userpurge"           ,       lconfig->c_userpurge            );
-       CtdlSetConfigInt(       "c_roompurge"           ,       lconfig->c_roompurge            );
-       CtdlSetConfigStr(       "c_logpages"            ,       lconfig->c_logpages             );
-       CtdlSetConfigInt(       "c_createax"            ,       lconfig->c_createax             );
-       CtdlSetConfigLong(      "c_maxmsglen"           ,       lconfig->c_maxmsglen            );
-       CtdlSetConfigInt(       "c_min_workers"         ,       lconfig->c_min_workers          );
-       CtdlSetConfigInt(       "c_max_workers"         ,       lconfig->c_max_workers          );
-       CtdlSetConfigInt(       "c_pop3_port"           ,       lconfig->c_pop3_port            );
-       CtdlSetConfigInt(       "c_smtp_port"           ,       lconfig->c_smtp_port            );
-       CtdlSetConfigInt(       "c_rfc822_strict_from"  ,       lconfig->c_rfc822_strict_from   );
-       CtdlSetConfigInt(       "c_aide_zap"            ,       lconfig->c_aide_zap             );
-       CtdlSetConfigInt(       "c_imap_port"           ,       lconfig->c_imap_port            );
-       CtdlSetConfigLong(      "c_net_freq"            ,       lconfig->c_net_freq             );
-       CtdlSetConfigInt(       "c_disable_newu"        ,       lconfig->c_disable_newu         );
-       CtdlSetConfigInt(       "c_enable_fulltext"     ,       lconfig->c_enable_fulltext      );
-       CtdlSetConfigStr(       "c_baseroom"            ,       lconfig->c_baseroom             );
-       CtdlSetConfigStr(       "c_aideroom"            ,       lconfig->c_aideroom             );
-       CtdlSetConfigInt(       "c_purge_hour"          ,       lconfig->c_purge_hour           );
-       CtdlSetConfigInt(       "c_mbxep_mode"          ,       lconfig->c_mbxep.expire_mode    );
-       CtdlSetConfigInt(       "c_mbxep_value"         ,       lconfig->c_mbxep.expire_value   );
-       CtdlSetConfigStr(       "c_ldap_host"           ,       lconfig->c_ldap_host            );
-       CtdlSetConfigInt(       "c_ldap_port"           ,       lconfig->c_ldap_port            );
-       CtdlSetConfigStr(       "c_ldap_base_dn"        ,       lconfig->c_ldap_base_dn         );
-       CtdlSetConfigStr(       "c_ldap_bind_dn"        ,       lconfig->c_ldap_bind_dn         );
-       CtdlSetConfigStr(       "c_ldap_bind_pw"        ,       lconfig->c_ldap_bind_pw         );
-       CtdlSetConfigInt(       "c_msa_port"            ,       lconfig->c_msa_port             );
-       CtdlSetConfigInt(       "c_imaps_port"          ,       lconfig->c_imaps_port           );
-       CtdlSetConfigInt(       "c_pop3s_port"          ,       lconfig->c_pop3s_port           );
-       CtdlSetConfigInt(       "c_smtps_port"          ,       lconfig->c_smtps_port           );
-       CtdlSetConfigInt(       "c_auto_cull"           ,       lconfig->c_auto_cull            );
-       CtdlSetConfigInt(       "c_allow_spoofing"      ,       lconfig->c_allow_spoofing       );
-       CtdlSetConfigInt(       "c_journal_email"       ,       lconfig->c_journal_email        );
-       CtdlSetConfigInt(       "c_journal_pubmsgs"     ,       lconfig->c_journal_pubmsgs      );
-       CtdlSetConfigStr(       "c_journal_dest"        ,       lconfig->c_journal_dest         );
-       CtdlSetConfigStr(       "c_default_cal_zone"    ,       lconfig->c_default_cal_zone     );
-       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          );
-       CtdlSetConfigStr(       "c_pager_program"       ,       lconfig->c_pager_program        );
-       CtdlSetConfigInt(       "c_imap_keep_from"      ,       lconfig->c_imap_keep_from       );
-       CtdlSetConfigInt(       "c_xmpp_c2s_port"       ,       lconfig->c_xmpp_c2s_port        );
-       CtdlSetConfigInt(       "c_xmpp_s2s_port"       ,       lconfig->c_xmpp_s2s_port        );
-       CtdlSetConfigLong(      "c_pop3_fetch"          ,       lconfig->c_pop3_fetch           );
-       CtdlSetConfigLong(      "c_pop3_fastest"        ,       lconfig->c_pop3_fastest         );
-       CtdlSetConfigInt(       "c_spam_flag_only"      ,       lconfig->c_spam_flag_only       );
-       CtdlSetConfigInt(       "c_guest_logins"        ,       lconfig->c_guest_logins         );
-       CtdlSetConfigInt(       "c_nntp_port"           ,       lconfig->c_nntp_port            );
-       CtdlSetConfigInt(       "c_nntps_port"          ,       lconfig->c_nntps_port           );
+       configlen.c_nodename = strlen(config.c_nodename);
+       configlen.c_fqdn = strlen(config.c_fqdn);
+       configlen.c_humannode = strlen(config.c_humannode);
+       configlen.c_phonenum = strlen(config.c_phonenum);
+       configlen.c_twitroom = strlen(config.c_twitroom);
+       configlen.c_moreprompt = strlen(config.c_moreprompt);
+       configlen.c_site_location = strlen(config.c_site_location);
+       configlen.c_sysadm = strlen(config.c_sysadm);
+       configlen.c_niu_2 = strlen(config.c_niu_2);
+       configlen.c_ip_addr = strlen(config.c_ip_addr);
+       configlen.c_logpages = strlen(config.c_logpages);
+       configlen.c_baseroom = strlen(config.c_baseroom);
+       configlen.c_aideroom = strlen(config.c_aideroom);
+       configlen.c_ldap_host = strlen(config.c_ldap_host);
+       configlen.c_ldap_base_dn = strlen(config.c_ldap_base_dn);
+       configlen.c_ldap_bind_dn = strlen(config.c_ldap_bind_dn);
+       configlen.c_ldap_bind_pw = strlen(config.c_ldap_bind_pw);
+       configlen.c_journal_dest = strlen(config.c_journal_dest);
+       configlen.c_default_cal_zone = strlen(config.c_default_cal_zone);
+       configlen.c_funambol_host = strlen(config.c_funambol_host);
+       configlen.c_funambol_source = strlen(config.c_funambol_source);
+       configlen.c_funambol_auth = strlen(config.c_funambol_auth);
+       configlen.c_master_user = strlen(config.c_master_user);
+       configlen.c_master_pass = strlen(config.c_master_pass);
+       configlen.c_pager_program = strlen(config.c_pager_program);
 }
 
-
-
 /*
- * Called during the initialization of Citadel server.
+ * get_config() is called during the initialization of Citadel server.
  * It verifies the system's integrity and reads citadel.config into memory.
  */
-void initialize_config_system(void) {
+void get_config(void) {
        FILE *cfp;
        int rv;
-       struct legacy_config lconfig;   // legacy configuration
-       ctdlconfig = NewHash(1, NULL);  // set up the real config system
-
-       /* 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)
-               );
-               exit(CTDLEXIT_LIBCITADEL);
-       }
 
        if (chdir(ctdl_bbsbase_dir) != 0) {
                fprintf(stderr,
@@ -256,47 +184,36 @@ void initialize_config_system(void) {
                exit(CTDLEXIT_HOME);
        }
 
-       memset(&lconfig, 0, sizeof(struct legacy_config));
+       memset(&config, 0, sizeof(struct config));
        cfp = fopen(file_citadel_config, "rb");
        if (cfp != NULL) {
-               if (CtdlGetConfigLong("c_config_created_or_migrated") <= 0) {
-                       fprintf(stderr, "Citadel Server found BOTH legacy and new configurations present.\n");
-                       fprintf(stderr, "Exiting to prevent data corruption.\n");
-                       exit(CTDLEXIT_CONFIG);
-               }
-               rv = fread((char *) &lconfig, sizeof(struct legacy_config), 1, cfp);
+               rv = fread((char *) &config, sizeof(struct config), 1, cfp);
                if (rv != 1)
                {
                        fprintf(stderr, 
-                               "Warning: Found a legacy config file %s has unexpected size. \n",
+                               "Warning: The config file %s has unexpected size. \n",
                                file_citadel_config
                        );
                }
-
-               migrate_legacy_config(&lconfig);
-
                fclose(cfp);
-               if (unlink(file_citadel_config) != 0) {
-                       fprintf(stderr, "Unable to remove legacy config file %s after migrating it.\n", file_citadel_config);
-                       fprintf(stderr, "Exiting to prevent data corruption.\n");
-                       exit(CTDLEXIT_CONFIG);
-               }
-
-               /*
-                * Prevent migration/initialization from happening again.
-                */
-               CtdlSetConfigLong("c_config_created_or_migrated", (long)time(NULL));
-
+               setcfglen();
        }
-
-       /* New installation?  Set up configuration */
-       if (CtdlGetConfigLong("c_config_created_or_migrated") <= 0) {
+       else {
                brand_new_installation_set_defaults();
        }
 
+       /* 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));
+               exit(CTDLEXIT_LIBCITADEL);
+       }
+
        /* Only allow LDAP auth mode if we actually have LDAP support */
 #ifndef HAVE_LDAP
-       if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
+       if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
                fprintf(stderr, "Your system is configured for LDAP authentication,\n"
                                "but you are running a server built without OpenLDAP support.\n");
                exit(CTDL_EXIT_UNSUP_AUTH);
@@ -307,169 +224,70 @@ void initialize_config_system(void) {
         * configurable.  Also check to make sure the limit has not been
         * set below 8192 bytes.
          */
-        if (CtdlGetConfigLong("c_maxmsglen") <= 0)     CtdlSetConfigLong("c_maxmsglen", 10485760);
-        if (CtdlGetConfigLong("c_maxmsglen") < 8192)   CtdlSetConfigLong("c_maxmsglen", 8192);
+        if (config.c_maxmsglen <= 0)
+                config.c_maxmsglen = 10485760;
+        if (config.c_maxmsglen < 8192)
+                config.c_maxmsglen = 8192;
 
-        /*
-        * Default lower and upper limits on number of worker threads
-        */
-       if (CtdlGetConfigInt("c_min_workers") < 5)      CtdlSetConfigInt("c_min_workers", 5);   // min
-       if (CtdlGetConfigInt("c_max_workers") == 0)     CtdlSetConfigInt("c_max_workers", 256); // default max
-       if (CtdlGetConfigInt("c_max_workers") < CtdlGetConfigInt("c_min_workers")) {
-               CtdlSetConfigInt("c_max_workers", CtdlGetConfigInt("c_min_workers"));           // max >= min
-       }
+        /* Default lower and upper limits on number of worker threads */
+
+       if (config.c_min_workers < 3)           /* no less than 3 */
+               config.c_min_workers = 5;
+
+       if (config.c_max_workers == 0)                  /* default maximum */
+               config.c_max_workers = 256;
+
+       if (config.c_max_workers < config.c_min_workers)   /* max >= min */
+               config.c_max_workers = config.c_min_workers;
 
        /* Networking more than once every five minutes just isn't sane */
-       if (CtdlGetConfigLong("c_net_freq") == 0)       CtdlSetConfigLong("c_net_freq", 3600);  // once per hour default
-       if (CtdlGetConfigLong("c_net_freq") < 300)      CtdlSetConfigLong("c_net_freq", 300);   // minimum 5 minutes
+       if (config.c_net_freq == 0L)
+               config.c_net_freq = 3600L;      /* once per hour default */
+       if (config.c_net_freq < 300L) 
+               config.c_net_freq = 300L;
 
        /* Same goes for POP3 */
-       if (CtdlGetConfigLong("c_pop3_fetch") == 0)     CtdlSetConfigLong("c_pop3_fetch", 3600);        // once per hour default
-       if (CtdlGetConfigLong("c_pop3_fetch") < 300)    CtdlSetConfigLong("c_pop3_fetch", 300);         // 5 minutes min
-       if (CtdlGetConfigLong("c_pop3_fastest") == 0)   CtdlSetConfigLong("c_pop3_fastest", 3600);      // once per hour default
-       if (CtdlGetConfigLong("c_pop3_fastest") < 300)  CtdlSetConfigLong("c_pop3_fastest", 300);       // 5 minutes min
+       if (config.c_pop3_fetch == 0L)
+               config.c_pop3_fetch = 3600L;    /* once per hour default */
+       if (config.c_pop3_fetch < 300L) 
+               config.c_pop3_fetch = 300L;
+       if (config.c_pop3_fastest == 0L)
+               config.c_pop3_fastest = 3600L;  /* once per hour default */
+       if (config.c_pop3_fastest < 300L) 
+               config.c_pop3_fastest = 300L;
 
        /* "create new user" only works with native authentication mode */
-       if (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) {
-               CtdlSetConfigInt("c_disable_newu", 1);
+       if (config.c_auth_mode != AUTHMODE_NATIVE) {
+               config.c_disable_newu = 1;
        }
 }
 
-
-
-/*
- * Called when Citadel server is shutting down.
- * Clears out the config hash table.
- */
-void shutdown_config_system(void) 
-{
-       DeleteHash(&ctdlconfig);
-}
-
-
-
-/*
- * Set a system config value.  Simple key/value here.
- */
-void CtdlSetConfigStr(char *key, char *value)
-{
-       int key_len = strlen(key);
-       int value_len = strlen(value);
-
-       /* FIXME we are noisy logging for now */
-       syslog(LOG_DEBUG, "\033[31mSET CONFIG: '%s' = '%s'\033[0m", key, value);
-
-       /* Save it in memory */
-       Put(ctdlconfig, key, key_len, strdup(value), NULL);
-
-       /* Also write it to the config database */
-
-       int dbv_size = key_len + value_len + 2;
-       char *dbv = malloc(dbv_size);
-       strcpy(dbv, key);
-       strcpy(&dbv[key_len + 1], value);
-       cdb_store(CDB_CONFIG, key, key_len, dbv, dbv_size);
-       free(dbv);
-}
-
-
-/*
- * Set a numeric system config value (long integer)
- */
-void CtdlSetConfigLong(char *key, long value)
-{
-       char longstr[256];
-       sprintf(longstr, "%ld", value);
-       CtdlSetConfigStr(key, longstr);
-}
-
-
-/*
- * Set a numeric system config value (integer)
- */
-void CtdlSetConfigInt(char *key, int value)
-{
-       char intstr[256];
-       sprintf(intstr, "%d", value);
-       CtdlSetConfigStr(key, intstr);
-}
-
+long config_msgnum = 0;
 
 /*
- * Fetch a system config value.  Caller does *not* own the returned value and may not alter it.
+ * Occasionally, we will need to write the config file, because some operations
+ * change site-wide parameters.
  */
-char *CtdlGetConfigStr(char *key)
+void put_config(void)
 {
-       char *value = NULL;
-       struct cdbdata *cdb;
-       int key_len = strlen(key);
-
-       if (IsEmptyStr(key)) return(NULL);
-
-       /* Temporary hack to make sure we didn't mess up any porting - FIXME remove this after testing thoroughly */
-       if (!strncmp(key, "config", 6)) {
-               syslog(LOG_EMERG, "You requested a key starting with 'config' which probably means a porting error: %s", key);
-               abort();
-       }
-
-       /* First look in memory */
-       if (GetHash(ctdlconfig, key, key_len, (void *)&value))
-       {
-               syslog(LOG_DEBUG, "\033[32mGET CONFIG: '%s' = '%s'\033[0m", key, value);
-               return value;
-       }
-
-       /* Then look in the database. */
-
-       cdb = cdb_fetch(CDB_CONFIG, key, key_len);
+       FILE *cfp;
+       int blocks_written = 0;
 
-       if (cdb == NULL) {      /* nope, not there either. */
-               syslog(LOG_DEBUG, "\033[32mGET CONFIG: '%s' = NULL\033[0m", key);
-               return(NULL);
+       cfp = fopen(file_citadel_config, "w");
+       if (cfp != NULL) {
+               blocks_written = fwrite((char *) &config, sizeof(struct config), 1, cfp);
+               if (blocks_written == 1) {
+                       chown(file_citadel_config, CTDLUID, (-1));
+                       chmod(file_citadel_config, 0600);
+                       fclose(cfp);
+                       return;
+               }
+               fclose(cfp);
        }
-
-       /* Got it.  Save it in memory for the next fetch. */
-       value = strdup(cdb->ptr + key_len + 1);         /* The key was stored there too; skip past it */
-       cdb_free(cdb);
-       Put(ctdlconfig, key, key_len, value, NULL);
-       syslog(LOG_DEBUG, "\033[32mGET CONFIG: '%s' = '%s'\033[0m", key, value);
-       return value;
-}
-
-
-/*
- * Fetch a system config value - integer
- */
-int CtdlGetConfigInt(char *key)
-{
-       char *s = CtdlGetConfigStr(key);
-       if (s) return atoi(s);
-       return 0;
+       syslog(LOG_EMERG, "%s: %s", file_citadel_config, strerror(errno));
 }
 
 
-/*
- * Fetch a system config value - long integer
- */
-long CtdlGetConfigLong(char *key)
-{
-       char *s = CtdlGetConfigStr(key);
-       if (s) return atol(s);
-       return 0;
-}
-
-
-
-/**********************************************************************/
-
-
-
-
-
-
-
-
-
 
 void CtdlGetSysConfigBackend(long msgnum, void *userdata) {
        config_msgnum = msgnum;
index 293593b817a89763489ca1f272892e2c561abea6..eb61711cc44339b857addc0dbafabeab54f200bf 100644 (file)
 /*
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
+ *  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.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  */
 
 #include "serv_extensions.h"
 #include "citadel_dirs.h"
 
 
-
-/*
- * This is the format of the legacy config file.  Do not attempt to do anything with it other
- * than migrate it into the new format. 
- */
-struct legacy_config {
-       char c_nodename[16];            /* short name of this node on a Citadel network */
-       char c_fqdn[64];                /* this site's fully qualified domain name */
-       char c_humannode[21];           /* human-readable site name */
-       char c_niu_7[16];
-       uid_t c_niu_6;
-       char c_creataide;               /* 1 = creating a room auto-grants room aide privileges */
-       int c_sleeping;                 /* watchdog timer (seconds) */
-       char c_initax;                  /* initial access level for new users */
-       char c_regiscall;               /* after c_regiscall logins user will be asked to register */
-       char c_twitdetect;              /* automatically move messages from problem users to trashcan */
-       char c_twitroom[ROOMNAMELEN];   /* name of trashcan */
-       char c_moreprompt[80];          /* paginator prompt */
-       char c_restrict;                /* require per-user permission to send Internet mail */
-       long c_niu_1;
-       char c_site_location[32];       /* geographic location of this Citadel site */
-       char c_sysadm[26];              /* name of system administrator */
-       char c_niu_2[15];
-       int c_niu_3;
-       int c_maxsessions;              /* maximum number of concurrent sessions allowed */
-       char c_ip_addr[20];             /* bind address for listening sockets */
-       int c_port_number;              /* port number for Citadel protocol (usually 504) */
-       int c_niu_4;
-       struct ExpirePolicy c_ep;       /* default expire policy for the entire site */
-       int c_userpurge;                /* user purge time (in days) */
-       int c_roompurge;                /* room purge time (in days) */
-       char c_logpages[ROOMNAMELEN];
-       char c_createax;
-       long c_maxmsglen;
-       int c_min_workers;
-       int c_max_workers;
-       int c_pop3_port;
-       int c_smtp_port;
-       int c_rfc822_strict_from;
-       int c_aide_zap;
-       int c_imap_port;
-       time_t c_net_freq;
-       char c_disable_newu;
-       char c_enable_fulltext;
-       char c_baseroom[ROOMNAMELEN];
-       char c_aideroom[ROOMNAMELEN];
-       int c_purge_hour;
-       struct ExpirePolicy c_mbxep;
-       char c_ldap_host[128];
-       int c_ldap_port;
-       char c_ldap_base_dn[256];
-       char c_ldap_bind_dn[256];
-       char c_ldap_bind_pw[256];
-       int c_msa_port;
-       int c_imaps_port;
-       int c_pop3s_port;
-       int c_smtps_port;
-       char c_auto_cull;
-       char c_niu_5;
-       char c_allow_spoofing;
-       char c_journal_email;
-       char c_journal_pubmsgs;
-       char c_journal_dest[128];
-       char c_default_cal_zone[128];
-       int c_pftcpdict_port;
-       int c_managesieve_port;
-       int c_auth_mode;
-       char c_funambol_host[256];
-       int c_funambol_port;
-       char c_funambol_source[256];
-       char c_funambol_auth[256];
-       char c_rbl_at_greeting;
-       char c_master_user[32];
-       char c_master_pass[32];
-       char c_pager_program[256];
-       char c_imap_keep_from;
-       int c_xmpp_c2s_port;
-       int c_xmpp_s2s_port;
-       time_t c_pop3_fetch;
-       time_t c_pop3_fastest;
-       int c_spam_flag_only;
-       int c_guest_logins;
-       int c_nntp_port;
-       int c_nntps_port;
-};
-
-
-
-
-void initialize_config_system(void);
-void shutdown_config_system(void);
+void get_config(void);
 void put_config(void);
-void CtdlSetConfigStr(char *, char *);
-char *CtdlGetConfigStr(char *);
-int CtdlGetConfigInt(char *);
-long CtdlGetConfigLong(char *);
-void CtdlSetConfigInt(char *key, int value);
-void CtdlSetConfigLong(char *key, long value);
 
 char *CtdlGetSysConfig(char *sysconfname);
 void CtdlPutSysConfig(char *sysconfname, char *sysconfdata);
index 576e9359c7da3cc9efeea5b6f6644d8e740f174f..81b597850b1dbfbe00396ea6119ba1014ed80e3e 100644 (file)
@@ -2,7 +2,7 @@
  * Citadel context management stuff.
  * Here's where we (hopefully) have all the code that manipulates contexts.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2011 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.
@@ -22,7 +22,6 @@
 #include "locate_host.h"
 #include "context.h"
 #include "control.h"
-#include "config.h"
 
 int DebugSession = 0;
 
@@ -245,8 +244,8 @@ void terminate_idle_sessions(void)
        for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
                if (
                        (ccptr != CC)
-                       && (CtdlGetConfigLong("c_sleeping") > 0)
-                       && (now - (ccptr->lastcmd) > CtdlGetConfigLong("c_sleeping"))
+                       && (config.c_sleeping > 0)
+                       && (now - (ccptr->lastcmd) > config.c_sleeping)
                ) {
                        if (!ccptr->dont_term) {
                                ccptr->kill_me = KILLME_IDLE;
@@ -515,7 +514,7 @@ void begin_session(CitContext *con)
        *con->fake_hostname = '\0';
        *con->fake_roomname = '\0';
        *con->cs_clientinfo = '\0';
-       safestrncpy(con->cs_host, CtdlGetConfigStr("c_fqdn"), sizeof con->cs_host);
+       safestrncpy(con->cs_host, config.c_fqdn, sizeof con->cs_host);
        safestrncpy(con->cs_addr, "", sizeof con->cs_addr);
        con->cs_UDSclientUID = -1;
        con->cs_host[sizeof con->cs_host - 1] = 0;
@@ -567,7 +566,7 @@ void begin_session(CitContext *con)
        con->dl_is_net = 0;
 
        con->nologin = 0;
-       if (((CtdlGetConfigInt("c_maxsessions") > 0)&&(num_sessions > CtdlGetConfigInt("c_maxsessions"))) || CtdlWantSingleUser()) {
+       if (((config.c_maxsessions > 0)&&(num_sessions > config.c_maxsessions)) || CtdlWantSingleUser()) {
                con->nologin = 1;
        }
 
index 2b2721d04a31e1bca930bff66e5a29ba9f0eee74..2a608eee014a24a78887f6a0c9e62c593dc57208 100644 (file)
@@ -1,15 +1,15 @@
 /*
  * This module handles states which are global to the entire server.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2014 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.
+ *  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.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  */
 
 #include <stdio.h>
@@ -22,6 +22,7 @@
 #include "user_ops.h"
 
 struct CitControl CitControl;
+extern struct config config;
 FILE *control_fp = NULL;
 long control_highest_user = 0;
 
@@ -132,7 +133,7 @@ void get_control(void)
                control_fp = fopen(file_citadel_control, "rb+");
                if (control_fp != NULL) {
                        lock_control();
-                       rv = fchown(fileno(control_fp), ctdluid, -1);
+                       rv = fchown(fileno(control_fp), config.c_ctdluid, -1);
                        if (rv == -1)
                                syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]\n", 
                                       file_citadel_control, strerror(errno));
@@ -148,7 +149,7 @@ void get_control(void)
                        lock_control();
                        memset(&CitControl, 0, sizeof(struct CitControl));
 
-                       rv = fchown(fileno(control_fp), ctdluid, -1);
+                       rv = fchown(fileno(control_fp), config.c_ctdluid, -1);
                        if (rv == -1)
                                syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]\n", 
                                       file_citadel_control, strerror(errno));
@@ -175,7 +176,7 @@ void get_control(void)
                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));
+       rv = chown(file_citadel_control, config.c_ctdluid, (-1));
        if (rv == -1)
                syslog(LOG_EMERG, "Failed to adjust ownership of: %s [%s]\n", 
                       file_citadel_control, strerror(errno));  
@@ -288,17 +289,6 @@ long get_new_room_number(void)
 
 
 
-/*
- * Helper function for cmd_conf() to handle boolean values
- */
-int confbool(char *v)
-{
-       if (IsEmptyStr(v)) return(0);
-       if (atoi(v) != 0) return(1);
-       return(0);
-}
-
-
 /* 
  * Get or set global configuration options
  *
@@ -310,8 +300,7 @@ void cmd_conf(char *argbuf)
 {
        char cmd[16];
        char buf[256];
-       int a, i;
-       long ii;
+       int a;
        char *confptr;
        char confname[128];
 
@@ -320,44 +309,44 @@ void cmd_conf(char *argbuf)
        extract_token(cmd, argbuf, 0, '|', sizeof cmd);
        if (!strcasecmp(cmd, "GET")) {
                cprintf("%d Configuration...\n", LISTING_FOLLOWS);
-               cprintf("%s\n",         CtdlGetConfigStr("c_nodename"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_fqdn"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_humannode"));
-               cprintf("xxx\n"); /* placeholder -- field no longer in use */
-               cprintf("%d\n",         CtdlGetConfigInt("c_creataide"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_sleeping"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_initax"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_regiscall"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_twitdetect"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_twitroom"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_moreprompt"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_restrict"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_site_location"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_sysadm"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_maxsessions"));
+               cprintf("%s\n", config.c_nodename);
+               cprintf("%s\n", config.c_fqdn);
+               cprintf("%s\n", config.c_humannode);
+               cprintf("%s\n", config.c_phonenum);
+               cprintf("%d\n", config.c_creataide);
+               cprintf("%d\n", config.c_sleeping);
+               cprintf("%d\n", config.c_initax);
+               cprintf("%d\n", config.c_regiscall);
+               cprintf("%d\n", config.c_twitdetect);
+               cprintf("%s\n", config.c_twitroom);
+               cprintf("%s\n", config.c_moreprompt);
+               cprintf("%d\n", config.c_restrict);
+               cprintf("%s\n", config.c_site_location);
+               cprintf("%s\n", config.c_sysadm);
+               cprintf("%d\n", config.c_maxsessions);
                cprintf("xxx\n"); /* placeholder -- field no longer in use */
-               cprintf("%d\n",         CtdlGetConfigInt("c_userpurge"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_roompurge"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_logpages"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_createax"));
-               cprintf("%ld\n",        CtdlGetConfigLong("c_maxmsglen"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_min_workers"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_max_workers"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_pop3_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_smtp_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_rfc822_strict_from"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_aide_zap"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_imap_port"));
-               cprintf("%ld\n",        CtdlGetConfigLong("c_net_freq"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_disable_newu"));
+               cprintf("%d\n", config.c_userpurge);
+               cprintf("%d\n", config.c_roompurge);
+               cprintf("%s\n", config.c_logpages);
+               cprintf("%d\n", config.c_createax);
+               cprintf("%ld\n", config.c_maxmsglen);
+               cprintf("%d\n", config.c_min_workers);
+               cprintf("%d\n", config.c_max_workers);
+               cprintf("%d\n", config.c_pop3_port);
+               cprintf("%d\n", config.c_smtp_port);
+               cprintf("%d\n", config.c_rfc822_strict_from);
+               cprintf("%d\n", config.c_aide_zap);
+               cprintf("%d\n", config.c_imap_port);
+               cprintf("%ld\n", config.c_net_freq);
+               cprintf("%d\n", config.c_disable_newu);
                cprintf("1\n"); /* niu */
-               cprintf("%d\n",         CtdlGetConfigInt("c_purge_hour"));
+               cprintf("%d\n", config.c_purge_hour);
 #ifdef HAVE_LDAP
-               cprintf("%s\n",         CtdlGetConfigStr("c_ldap_host"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_ldap_port"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_ldap_base_dn"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_ldap_bind_dn"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_ldap_bind_pw"));
+               cprintf("%s\n", config.c_ldap_host);
+               cprintf("%d\n", config.c_ldap_port);
+               cprintf("%s\n", config.c_ldap_base_dn);
+               cprintf("%s\n", config.c_ldap_bind_dn);
+               cprintf("%s\n", config.c_ldap_bind_pw);
 #else
                cprintf("\n");
                cprintf("0\n");
@@ -365,41 +354,41 @@ void cmd_conf(char *argbuf)
                cprintf("\n");
                cprintf("\n");
 #endif
-               cprintf("%s\n",         CtdlGetConfigStr("c_ip_addr"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_msa_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_imaps_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_pop3s_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_smtps_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_enable_fulltext"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_auto_cull"));
+               cprintf("%s\n", config.c_ip_addr);
+               cprintf("%d\n", config.c_msa_port);
+               cprintf("%d\n", config.c_imaps_port);
+               cprintf("%d\n", config.c_pop3s_port);
+               cprintf("%d\n", config.c_smtps_port);
+               cprintf("%d\n", config.c_enable_fulltext);
+               cprintf("%d\n", config.c_auto_cull);
                cprintf("1\n");
-               cprintf("%d\n",         CtdlGetConfigInt("c_allow_spoofing"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_journal_email"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_journal_pubmsgs"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_journal_dest"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_default_cal_zone"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_pftcpdict_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_managesieve_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_auth_mode"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_funambol_host"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_funambol_port"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_funambol_source"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_funambol_auth"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_rbl_at_greeting"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_master_user"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_master_pass"));
-               cprintf("%s\n",         CtdlGetConfigStr("c_pager_program"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_imap_keep_from"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_xmpp_c2s_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_xmpp_s2s_port"));
-               cprintf("%ld\n",        CtdlGetConfigLong("c_pop3_fetch"));
-               cprintf("%ld\n",        CtdlGetConfigLong("c_pop3_fastest"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_spam_flag_only"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_guest_logins"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_port_number"));
-               cprintf("%d\n",         ctdluid);
-               cprintf("%d\n",         CtdlGetConfigInt("c_nntp_port"));
-               cprintf("%d\n",         CtdlGetConfigInt("c_nntps_port"));
+               cprintf("%d\n", config.c_allow_spoofing);
+               cprintf("%d\n", config.c_journal_email);
+               cprintf("%d\n", config.c_journal_pubmsgs);
+               cprintf("%s\n", config.c_journal_dest);
+               cprintf("%s\n", config.c_default_cal_zone);
+               cprintf("%d\n", config.c_pftcpdict_port);
+               cprintf("%d\n", config.c_managesieve_port);
+               cprintf("%d\n", config.c_auth_mode);
+               cprintf("%s\n", config.c_funambol_host);
+               cprintf("%d\n", config.c_funambol_port);
+               cprintf("%s\n", config.c_funambol_source);
+               cprintf("%s\n", config.c_funambol_auth);
+               cprintf("%d\n", config.c_rbl_at_greeting);
+               cprintf("%s\n", config.c_master_user);
+               cprintf("%s\n", config.c_master_pass);
+               cprintf("%s\n", config.c_pager_program);
+               cprintf("%d\n", config.c_imap_keep_from);
+               cprintf("%d\n", config.c_xmpp_c2s_port);
+               cprintf("%d\n", config.c_xmpp_s2s_port);
+               cprintf("%ld\n", config.c_pop3_fetch);
+               cprintf("%ld\n", config.c_pop3_fastest);
+               cprintf("%d\n", config.c_spam_flag_only);
+               cprintf("%d\n", config.c_guest_logins);
+               cprintf("%d\n", config.c_port_number);
+               cprintf("%d\n", config.c_ctdluid);
+               cprintf("%d\n", config.c_nntp_port);
+               cprintf("%d\n", config.c_nntps_port);
                cprintf("000\n");
        }
 
@@ -410,258 +399,290 @@ void cmd_conf(char *argbuf)
                while (client_getln(buf, sizeof buf) >= 0 && strcmp(buf, "000")) {
                        switch (a) {
                        case 0:
-                               CtdlSetConfigStr("c_nodename", buf);
+                               configlen.c_nodename = safestrncpy(config.c_nodename, buf,
+                                                                  sizeof config.c_nodename);
                                break;
                        case 1:
-                               CtdlSetConfigStr("c_fqdn", buf);
+                               configlen.c_fqdn = safestrncpy(config.c_fqdn, buf,
+                                                              sizeof config.c_fqdn);
                                break;
                        case 2:
-                               CtdlSetConfigStr("c_humannode", buf);
+                               configlen.c_humannode = safestrncpy(config.c_humannode, buf,
+                                                                   sizeof config.c_humannode);
                                break;
                        case 3:
-                               /* placeholder -- field no longer in use */
+                               configlen.c_phonenum = safestrncpy(config.c_phonenum, buf,
+                                                                  sizeof config.c_phonenum);
                                break;
                        case 4:
-                               CtdlSetConfigInt("c_creataide", atoi(buf));
+                               config.c_creataide = atoi(buf);
                                break;
                        case 5:
-                               CtdlSetConfigInt("c_sleeping", atoi(buf));
+                               config.c_sleeping = atoi(buf);
                                break;
                        case 6:
-                               i = atoi(buf);
-                               if (i < 1) i = 1;
-                               if (i > 6) i = 6;
-                               CtdlSetConfigInt("c_initax", i);
+                               config.c_initax = atoi(buf);
+                               if (config.c_initax < 1)
+                                       config.c_initax = 1;
+                               if (config.c_initax > 6)
+                                       config.c_initax = 6;
                                break;
                        case 7:
-                               CtdlSetConfigInt("c_regiscall", confbool(buf));
+                               config.c_regiscall = atoi(buf);
+                               if (config.c_regiscall != 0)
+                                       config.c_regiscall = 1;
                                break;
                        case 8:
-                               CtdlSetConfigInt("c_twitdetect", confbool(buf));
+                               config.c_twitdetect = atoi(buf);
+                               if (config.c_twitdetect != 0)
+                                       config.c_twitdetect = 1;
                                break;
                        case 9:
-                               CtdlSetConfigStr("c_twitroom", buf);
+                               configlen.c_twitroom = safestrncpy(config.c_twitroom, buf,
+                                                                  sizeof config.c_twitroom);
                                break;
                        case 10:
-                               CtdlSetConfigStr("c_moreprompt", buf);
+                               configlen.c_moreprompt = safestrncpy(config.c_moreprompt, buf,
+                                                                    sizeof config.c_moreprompt);
                                break;
                        case 11:
-                               CtdlSetConfigInt("c_restrict", confbool(buf));
+                               config.c_restrict = atoi(buf);
+                               if (config.c_restrict != 0)
+                                       config.c_restrict = 1;
                                break;
                        case 12:
-                               CtdlSetConfigInt("c_site_location", confbool(buf));
+                               configlen.c_site_location = safestrncpy(
+                                       config.c_site_location, buf,
+                                       sizeof config.c_site_location);
                                break;
                        case 13:
-                               CtdlSetConfigInt("c_sysadm", confbool(buf));
+                               configlen.c_sysadm = safestrncpy(config.c_sysadm, buf,
+                                                                sizeof config.c_sysadm);
                                break;
                        case 14:
-                               i = atoi(buf);
-                               if (i < 0) i = 0;
-                               CtdlSetConfigInt("c_maxsessions", i);
+                               config.c_maxsessions = atoi(buf);
+                               if (config.c_maxsessions < 0)
+                                       config.c_maxsessions = 0;
                                break;
                        case 15:
                                /* placeholder -- field no longer in use */
                                break;
                        case 16:
-                               CtdlSetConfigInt("c_userpurge", atoi(buf));
+                               config.c_userpurge = atoi(buf);
                                break;
                        case 17:
-                               CtdlSetConfigInt("c_roompurge", atoi(buf));
+                               config.c_roompurge = atoi(buf);
                                break;
                        case 18:
-                               CtdlSetConfigStr("c_logpages", buf);
+                               configlen.c_logpages = safestrncpy(config.c_logpages, buf,
+                                                                  sizeof config.c_logpages);
                                break;
                        case 19:
-                               i = atoi(buf);
-                               if (i < 1) i = 1;
-                               if (i > 6) i = 6;
-                               CtdlSetConfigInt("c_createax", i);
+                               config.c_createax = atoi(buf);
+                               if (config.c_createax < 1)
+                                       config.c_createax = 1;
+                               if (config.c_createax > 6)
+                                       config.c_createax = 6;
                                break;
                        case 20:
-                               ii = atol(buf);
-                               if (ii >= 8192) {
-                                       CtdlSetConfigLong("c_maxmsglen", ii);
-                               }
+                               if (atoi(buf) >= 8192)
+                                       config.c_maxmsglen = atoi(buf);
                                break;
                        case 21:
-                               i = atoi(buf);
-                               if (i >= 3) {                                   // minimum value
-                                       CtdlSetConfigInt("c_min_workers", i);
-                               }
-                               break;
+                               if (atoi(buf) >= 2)
+                                       config.c_min_workers = atoi(buf);
                        case 22:
-                               i = atoi(buf);
-                               if (i >= CtdlGetConfigInt("c_min_workers")) {   // max must be >= min
-                                       CtdlSetConfigInt("c_max_workers", i);
-                               }
-                               break;
+                               if (atoi(buf) >= config.c_min_workers)
+                                       config.c_max_workers = atoi(buf);
                        case 23:
-                               CtdlSetConfigInt("c_pop3_port", atoi(buf));
+                               config.c_pop3_port = atoi(buf);
                                break;
                        case 24:
-                               CtdlSetConfigInt("c_smtp_port", atoi(buf));
+                               config.c_smtp_port = atoi(buf);
                                break;
                        case 25:
-                               CtdlSetConfigInt("c_rfc822_strict_from", atoi(buf));
+                               config.c_rfc822_strict_from = atoi(buf);
                                break;
                        case 26:
-                               CtdlSetConfigInt("c_aide_zap", confbool(buf));
+                               config.c_aide_zap = atoi(buf);
+                               if (config.c_aide_zap != 0)
+                                       config.c_aide_zap = 1;
                                break;
                        case 27:
-                               CtdlSetConfigInt("c_imap_port", atoi(buf));
+                               config.c_imap_port = atoi(buf);
                                break;
                        case 28:
-                               CtdlSetConfigLong("c_net_freq", atol(buf));
+                               config.c_net_freq = atol(buf);
                                break;
                        case 29:
-                               CtdlSetConfigInt("c_disable_newu", confbool(buf));
+                               config.c_disable_newu = atoi(buf);
+                               if (config.c_disable_newu != 0)
+                                       config.c_disable_newu = 1;
                                break;
                        case 30:
                                /* niu */
                                break;
                        case 31:
-                               i = atoi(buf);
-                               if ((i >= 0) && (i <= 23)) {
-                                       CtdlSetConfigInt("c_purge_hour", i);
+                               if ((config.c_purge_hour >= 0)
+                                   && (config.c_purge_hour <= 23)) {
+                                       config.c_purge_hour = atoi(buf);
                                }
                                break;
+#ifdef HAVE_LDAP
                        case 32:
-                               CtdlSetConfigStr("c_ldap_host", buf);
+                               configlen.c_ldap_host = safestrncpy(config.c_ldap_host, buf,
+                                                                   sizeof config.c_ldap_host);
                                break;
                        case 33:
-                               CtdlSetConfigInt("c_ldap_port", atoi(buf));
+                               config.c_ldap_port = atoi(buf);
                                break;
                        case 34:
-                               CtdlSetConfigStr("c_ldap_base_dn", buf);
+                               configlen.c_ldap_base_dn = safestrncpy(config.c_ldap_base_dn, buf,
+                                                                      sizeof config.c_ldap_base_dn);
                                break;
                        case 35:
-                               CtdlSetConfigStr("c_ldap_bind_dn", buf);
+                               configlen.c_ldap_bind_dn = safestrncpy(config.c_ldap_bind_dn, buf,
+                                                                      sizeof config.c_ldap_bind_dn);
                                break;
                        case 36:
-                               CtdlSetConfigStr("c_ldap_bind_pw", buf);
+                               configlen.c_ldap_bind_pw = safestrncpy(config.c_ldap_bind_pw, buf,
+                                                                      sizeof config.c_ldap_bind_pw);
                                break;
+#endif
                        case 37:
-                               CtdlSetConfigStr("c_ip_addr", buf);
-                               break;
+                               configlen.c_ip_addr = safestrncpy(config.c_ip_addr, buf,
+                                                                 sizeof config.c_ip_addr);
                        case 38:
-                               CtdlSetConfigInt("c_msa_port", atoi(buf));
+                               config.c_msa_port = atoi(buf);
                                break;
                        case 39:
-                               CtdlSetConfigInt("c_imaps_port", atoi(buf));
+                               config.c_imaps_port = atoi(buf);
                                break;
                        case 40:
-                               CtdlSetConfigInt("c_pop3s_port", atoi(buf));
+                               config.c_pop3s_port = atoi(buf);
                                break;
                        case 41:
-                               CtdlSetConfigInt("c_smtps_port", atoi(buf));
+                               config.c_smtps_port = atoi(buf);
                                break;
                        case 42:
-                               CtdlSetConfigInt("c_enable_fulltext", confbool(buf));
+                               config.c_enable_fulltext = atoi(buf);
                                break;
                        case 43:
-                               CtdlSetConfigInt("c_auto_cull", confbool(buf));
+                               config.c_auto_cull = atoi(buf);
                                break;
                        case 44:
                                /* niu */
                                break;
                        case 45:
-                               CtdlSetConfigInt("c_allow_spoofing", confbool(buf));
+                               config.c_allow_spoofing = atoi(buf);
                                break;
                        case 46:
-                               CtdlSetConfigInt("c_journal_email", confbool(buf));
+                               config.c_journal_email = atoi(buf);
                                break;
                        case 47:
-                               CtdlSetConfigInt("c_journal_pubmsgs", confbool(buf));
+                               config.c_journal_pubmsgs = atoi(buf);
                                break;
                        case 48:
-                               CtdlSetConfigStr("c_journal_dest", buf);
-                               break;
+                               configlen.c_journal_dest = safestrncpy(config.c_journal_dest, buf,
+                                                                      sizeof config.c_journal_dest);
                        case 49:
-                               CtdlSetConfigStr("c_default_cal_zone", buf);
+                               configlen.c_default_cal_zone = safestrncpy(
+                                       config.c_default_cal_zone, buf,
+                                       sizeof config.c_default_cal_zone);
                                break;
                        case 50:
-                               CtdlSetConfigInt("c_pftcpdict_port", atoi(buf));
+                               config.c_pftcpdict_port = atoi(buf);
                                break;
                        case 51:
-                               CtdlSetConfigInt("c_managesieve_port", atoi(buf));
+                               config.c_managesieve_port = atoi(buf);
                                break;
                        case 52:
-                               CtdlSetConfigInt("c_auth_mode", atoi(buf));
-                               break;
+                               config.c_auth_mode = atoi(buf);
                        case 53:
-                               CtdlSetConfigStr("c_funambol_host", buf);
+                               configlen.c_funambol_host = safestrncpy(
+                                       config.c_funambol_host, buf,
+                                       sizeof config.c_funambol_host);
                                break;
                        case 54:
-                               CtdlSetConfigInt("c_funambol_port", atoi(buf));
+                               config.c_funambol_port = atoi(buf);
                                break;
                        case 55:
-                               CtdlSetConfigStr("c_funambol_source", buf);
+                               configlen.c_funambol_source = safestrncpy(
+                                       config.c_funambol_source, buf, 
+                                       sizeof config.c_funambol_source);
                                break;
                        case 56:
-                               CtdlSetConfigStr("c_funambol_auth", buf);
+                               configlen.c_funambol_auth = safestrncpy(
+                                       config.c_funambol_auth, buf,
+                                       sizeof config.c_funambol_auth);
                                break;
                        case 57:
-                               CtdlSetConfigInt("c_rbl_at_greeting", confbool(buf));
+                               config.c_rbl_at_greeting = atoi(buf);
                                break;
                        case 58:
-                               CtdlSetConfigStr("c_master_user", buf);
+                               configlen.c_master_user = safestrncpy(
+                                       config.c_master_user,
+                                       buf, sizeof config.c_master_user);
                                break;
                        case 59:
-                               CtdlSetConfigStr("c_master_pass", buf);
+                               configlen.c_master_pass = safestrncpy(
+                                       config.c_master_pass, buf, sizeof config.c_master_pass);
                                break;
                        case 60:
-                               CtdlSetConfigStr("c_pager_program", buf);
+                               configlen.c_pager_program = safestrncpy(
+                                       config.c_pager_program, buf, sizeof config.c_pager_program);
                                break;
                        case 61:
-                               CtdlSetConfigInt("c_imap_keep_from", confbool(buf));
+                               config.c_imap_keep_from = atoi(buf);
                                break;
                        case 62:
-                               CtdlSetConfigInt("c_xmpp_c2s_port", atoi(buf));
+                               config.c_xmpp_c2s_port = atoi(buf);
                                break;
                        case 63:
-                               CtdlSetConfigInt("c_xmpp_s2s_port", atoi(buf));
+                               config.c_xmpp_s2s_port = atoi(buf);
                                break;
                        case 64:
-                               CtdlSetConfigLong("c_pop3_fetch", atol(buf));
+                               config.c_pop3_fetch = atol(buf);
                                break;
                        case 65:
-                               CtdlSetConfigLong("c_pop3_fastest", atol(buf));
+                               config.c_pop3_fastest = atol(buf);
                                break;
                        case 66:
-                               CtdlSetConfigInt("c_spam_flag_only", confbool(buf));
+                               config.c_spam_flag_only = atoi(buf);
                                break;
                        case 67:
-                               CtdlSetConfigInt("c_guest_logins", confbool(buf));
+                               config.c_guest_logins = atoi(buf);
                                break;
                        case 68:
-                               CtdlSetConfigInt("c_port_number", atoi(buf));
+                               config.c_port_number = atoi(buf);
                                break;
                        case 69:
-                               /* niu */
+                               config.c_ctdluid = atoi(buf);
                                break;
                        case 70:
-                               CtdlSetConfigInt("c_nntp_port", atoi(buf));
+                               config.c_nntp_port = atoi(buf);
                                break;
                        case 71:
-                               CtdlSetConfigInt("c_nntps_port", atoi(buf));
+                               config.c_nntps_port = atoi(buf);
                                break;
                        }
                        ++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")
                );
                CtdlAideMessage(buf,"Citadel Configuration Manager Message");
 
-               if (!IsEmptyStr(CtdlGetConfigStr("c_logpages")))
-                       CtdlCreateRoom(CtdlGetConfigStr("c_logpages"), 3, "", 0, 1, 1, VIEW_BBS);
+               if (!IsEmptyStr(config.c_logpages))
+                       CtdlCreateRoom(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
 
                /* If full text indexing has been disabled, invalidate the
                 * index so it doesn't try to use it later.
                 */
-               if (CtdlGetConfigInt("c_enable_fulltext") == 0) {
-                       CitControl.MM_fulltext_wordbreaker = 0;
+               if (config.c_enable_fulltext == 0) {
+                       CitControl.fulltext_wordbreaker = 0;
                        put_control();
                }
        }
@@ -689,7 +710,7 @@ void cmd_conf(char *argbuf)
                extract_token(confname, argbuf, 1, '|', sizeof confname);
                unbuffer_output();
                cprintf("%d %s\n", SEND_LISTING, confname);
-               confptr = CtdlReadMessageBody(HKEY("000"), CtdlGetConfigLong("c_maxmsglen"), NULL, 0, 0);
+               confptr = CtdlReadMessageBody(HKEY("000"), config.c_maxmsglen, NULL, 0, 0);
                CtdlPutSysConfig(confname, confptr);
                free(confptr);
        }
@@ -737,7 +758,7 @@ void cmd_gvdn(char *argbuf)
        void *vptr;
        
        List = NewHash(1, NULL);
-       Cfg = NewStrBufPlain(CtdlGetConfigStr("c_fqdn"), -1);
+       Cfg = NewStrBufPlain(config.c_fqdn, -1);
        Put(List, SKEY(Cfg), Cfg, HFreeStrBuf);
        Cfg = NULL;
 
index 0d905db37118eb526495687525773a86f70dea42..e89783f69faab825970c15a8258ee7b3ec2e8ea7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This is a data store backend for the Citadel server which uses Berkeley DB.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
@@ -50,7 +50,6 @@
 #include "ctdl_module.h"
 #include "control.h"
 #include "citserver.h"
-#include "config.h"
 
 
 static DB *dbp[MAXCDB];                /* One DB handle for each Citadel database */
@@ -224,7 +223,7 @@ void cdb_checkpoint(void)
        }
 
        /* After a successful checkpoint, we can cull the unused logs */
-       if (CtdlGetConfigInt("c_auto_cull")) {
+       if (config.c_auto_cull) {
                cdb_cull_logs();
        }
 }
index d47333e3c22dd11c23ae9dbb163d70b3e04df4e2..999c9e4546c1b989efc6fb93c6f6ab8df8394b8f 100644 (file)
@@ -27,7 +27,6 @@
 #include "ctdl_module.h"
 #include "event_client.h"
 #include "citserver.h"
-#include "config.h"
 
 ConstStr IOStates[] = {
        {HKEY("DB Queue")},
@@ -1060,8 +1059,8 @@ eNextState EvConnectSock(AsyncIO *IO,
        
                memset(&egress_sin, 0, sizeof(egress_sin));
                egress_sin.sin_family = AF_INET;
-               if (!IsEmptyStr(CtdlGetConfigStr("c_ip_addr"))) {
-                       egress_sin.sin_addr.s_addr = inet_addr(CtdlGetConfigStr("c_ip_addr"));
+               if (!IsEmptyStr(config.c_ip_addr)) {
+                       egress_sin.sin_addr.s_addr = inet_addr(config.c_ip_addr);
                        if (egress_sin.sin_addr.s_addr == !INADDR_ANY) {
                                egress_sin.sin_addr.s_addr = INADDR_ANY;
                        }
index 34c0e4bff64e77c381d6a9f3e44c300af1fb3cab..41c67a7e7556261649db1aac46e37e2b7f7e6d6e 100644 (file)
@@ -2,16 +2,6 @@
  * Function to go through an ical component set and convert all non-UTC
  * date/time properties to UTC.  It also strips out any VTIMEZONE
  * subcomponents afterwards, because they're irrelevant.
- *
- * Copyright (c) 1987-2015 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 
@@ -44,7 +34,8 @@
 icaltimezone *get_default_icaltimezone(void) {
 
         icaltimezone *zone = NULL;
-       char *default_zone_name = CtdlGetConfigStr("c_default_cal_zone");
+       char *default_zone_name = config.c_default_cal_zone;
+       //char *default_zone_name = "America/New_York";
 
         if (!zone) {
                 zone = icaltimezone_get_builtin_timezone(default_zone_name);
index 05a5a7037b80f9f6609222898fe4a7b6a7d6ed0e..86255e2f304a410ed020e01ba689484b9a188b7d 100644 (file)
@@ -293,14 +293,134 @@ enum {
  */
 void CtdlModuleDoSearch(int *num_msgs, long **search_msgs, const char *search_string, const char *func_name);
 
-#define NODENAME               CtdlGetConfigStr("c_nodename")
-#define FQDN                   CtdlGetConfigStr("c_fqdn")
-#define CTDLUID                        ctdluid
-#define CREATAIDE              CtdlGetConfigInt("c_creataide")
-#define REGISCALL              CtdlGetConfigInt("c_regiscall")
-#define TWITDETECT             CtdlGetConfigInt("c_twitdetect")
-#define TWITROOM               CtdlGetConfigStr("c_twitroom")
-#define RESTRICT_INTERNET      CtdlGetConfigInt("c_restrict")
+/* 
+ * Global system configuration
+ */
+struct config {
+       char c_nodename[16];            /* short name of this node on a Citadel network */
+       char c_fqdn[64];                /* this site's fully qualified domain name */
+       char c_humannode[21];           /* human-readable site name */
+       char c_phonenum[16];            /* telephone number */
+       uid_t c_ctdluid;                /* uid of posix account under which Citadel will run */
+       char c_creataide;               /* 1 = creating a room auto-grants room aide privileges */
+       int c_sleeping;                 /* watchdog timer (seconds) */
+       char c_initax;                  /* initial access level for new users */
+       char c_regiscall;               /* after c_regiscall logins user will be asked to register */
+       char c_twitdetect;              /* automatically move messages from problem users to trashcan */
+       char c_twitroom[ROOMNAMELEN];   /* name of trashcan */
+       char c_moreprompt[80];          /* paginator prompt */
+       char c_restrict;                /* require per-user permission to send Internet mail */
+       long c_niu_1;
+       char c_site_location[32];       /* geographic location of this Citadel site */
+       char c_sysadm[26];              /* name of system administrator */
+       char c_niu_2[15];
+       int c_niu_3;
+       int c_maxsessions;              /* maximum number of concurrent sessions allowed */
+       char c_ip_addr[20];             /* bind address for listening sockets */
+       int c_port_number;              /* port number for Citadel protocol (usually 504) */
+       int c_niu_4;
+       struct ExpirePolicy c_ep;       /* default expire policy for the entire site */
+       int c_userpurge;                /* user purge time (in days) */
+       int c_roompurge;                /* room purge time (in days) */
+       char c_logpages[ROOMNAMELEN];
+       char c_createax;
+       long c_maxmsglen;
+       int c_min_workers;
+       int c_max_workers;
+       int c_pop3_port;
+       int c_smtp_port;
+       int c_rfc822_strict_from;
+       int c_aide_zap;
+       int c_imap_port;
+       time_t c_net_freq;
+       char c_disable_newu;
+       char c_enable_fulltext;
+       char c_baseroom[ROOMNAMELEN];
+       char c_aideroom[ROOMNAMELEN];
+       int c_purge_hour;
+       struct ExpirePolicy c_mbxep;
+       char c_ldap_host[128];
+       int c_ldap_port;
+       char c_ldap_base_dn[256];
+       char c_ldap_bind_dn[256];
+       char c_ldap_bind_pw[256];
+       int c_msa_port;
+       int c_imaps_port;
+       int c_pop3s_port;
+       int c_smtps_port;
+       char c_auto_cull;
+       char c_niu_5;
+       char c_allow_spoofing;
+       char c_journal_email;
+       char c_journal_pubmsgs;
+       char c_journal_dest[128];
+       char c_default_cal_zone[128];
+       int c_pftcpdict_port;
+       int c_managesieve_port;
+       int c_auth_mode;
+       char c_funambol_host[256];
+       int c_funambol_port;
+       char c_funambol_source[256];
+       char c_funambol_auth[256];
+       char c_rbl_at_greeting;
+       char c_master_user[32];
+       char c_master_pass[32];
+       char c_pager_program[256];
+       char c_imap_keep_from;
+       int c_xmpp_c2s_port;
+       int c_xmpp_s2s_port;
+       time_t c_pop3_fetch;
+       time_t c_pop3_fastest;
+       int c_spam_flag_only;
+       int c_guest_logins;
+       int c_nntp_port;
+       int c_nntps_port;
+};
+struct configlen {
+       long c_nodename;
+       long c_fqdn;
+       long c_humannode;
+       long c_phonenum;
+       long c_twitroom;
+       long c_moreprompt;
+       long c_site_location;
+       long c_sysadm;
+       long c_niu_2;
+       long c_ip_addr;
+       long c_logpages;
+       long c_baseroom;
+       long c_aideroom;
+       long c_ldap_host;
+       long c_ldap_base_dn;
+       long c_ldap_bind_dn;
+       long c_ldap_bind_pw;
+       long c_journal_dest;
+       long c_default_cal_zone;
+       long c_funambol_host;
+       long c_funambol_source;
+       long c_funambol_auth;
+       long c_master_user;
+       long c_master_pass;
+       long c_pager_program;
+};
+
+#define SET_CFGSTRBUF(which, buffer) configlen.which = safestrncpy(config.which, ChrPtr(buffer), sizeof(config.which))
+#define SET_CFGSTR(which, buffer) configlen.which = safestrncpy(config.which, buffer, sizeof(config.which))
+
+extern struct config config;
+extern struct configlen configlen;
+
+
+#define NODENAME               config.c_nodename
+#define FQDN                   config.c_fqdn
+#define CTDLUID                        config.c_ctdluid
+#define CREATAIDE              config.c_creataide
+#define REGISCALL              config.c_regiscall
+#define TWITDETECT             config.c_twitdetect
+#define TWITROOM               config.c_twitroom
+#define RESTRICT_INTERNET      config.c_restrict
+
+#define CFG_KEY(which) config.which, configlen.which
 
 typedef void (*CfgLineParser)(const CfgLineType *ThisOne, StrBuf *Line, const char *LinePos, OneRoomNetCfg *rncfg);
 typedef void (*CfgLineSerializer)(const CfgLineType *ThisOne, StrBuf *OuptputBuffer, OneRoomNetCfg *rncfg, RoomNetCfgLine *data);
index a8868e954c7a12320e4567113473ccd5bb82ef72..c2131cbff46ce421a37225fb78b21772dbd9ceba 100644 (file)
@@ -1,19 +1,8 @@
 /*
  * This file contains functions which handle the mapping of Internet addresses
  * to users on the Citadel system.
- *
- * Copyright (c) 1987-2015 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
-
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -292,8 +281,8 @@ int CtdlHostAlias(char *fqdn) {
        if (fqdn == NULL) return(hostalias_nomatch);
        if (IsEmptyStr(fqdn)) return(hostalias_nomatch);
        if (!strcasecmp(fqdn, "localhost")) return(hostalias_localhost);
-       if (!strcasecmp(fqdn, CtdlGetConfigStr("c_fqdn"))) return(hostalias_localhost);
-       if (!strcasecmp(fqdn, CtdlGetConfigStr("c_nodename"))) return(hostalias_localhost);
+       if (!strcasecmp(fqdn, config.c_fqdn)) return(hostalias_localhost);
+       if (!strcasecmp(fqdn, config.c_nodename)) return(hostalias_localhost);
        if (inetcfg == NULL) return(hostalias_nomatch);
 
        config_lines = num_tokens(inetcfg, '\n');
@@ -644,7 +633,7 @@ recptypes *validate_recipients(const char *supplied_recipients,
                case MES_LOCAL:
                        if (!strcasecmp(this_recp, "sysop")) {
                                ++ret->num_room;
-                               strcpy(this_recp, CtdlGetConfigStr("c_aideroom"));
+                               strcpy(this_recp, config.c_aideroom);
                                if (!IsEmptyStr(ret->recp_room)) {
                                        strcat(ret->recp_room, "|");
                                }
@@ -1036,7 +1025,7 @@ void process_rfc822_addr(const char *rfc822, char *user, char *node, char *name)
        int a;
 
        strcpy(user, "");
-       strcpy(node, CtdlGetConfigStr("c_fqdn"));
+       strcpy(node, config.c_fqdn);
        strcpy(name, "");
 
        if (rfc822 == NULL) return;
@@ -1125,7 +1114,7 @@ void process_rfc822_addr(const char *rfc822, char *user, char *node, char *name)
                && (haschar(node, '%')==0)
                && (haschar(node, '!')==0)
        ) {
-               strcpy(node, CtdlGetConfigStr("c_nodename"));
+               strcpy(node, config.c_nodename);
        }
 
        else {
index 8af9afdca80668f96c3ddf8bea509c9d485fe9da..eb9e378e7f76872b95d7291d946598bcf2bb8ad2 100644 (file)
@@ -1,15 +1,5 @@
 /*
  * Message journaling functions.
- *
- * Copyright (c) 1987-2015 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <stdio.h>
@@ -18,7 +8,6 @@
 #include "ctdl_module.h"
 
 #include "citserver.h"
-#include "config.h"
 #include "user_ops.h"
 #include "serv_vcard.h"                        /* Needed for vcard_getuser and extract_inet_email_addrs */
 #include "internet_addressing.h"
@@ -111,7 +100,7 @@ void JournalRunQueueMsg(struct jnlq *jmsg) {
 
        if (jmsg == NULL)
                return;
-       journal_recps = validate_recipients(CtdlGetConfigStr("c_journal_dest"), NULL, 0);
+       journal_recps = validate_recipients(config.c_journal_dest, NULL, 0);
        if (journal_recps != NULL) {
 
                if (  (journal_recps->num_local > 0)
index 97288637fdcad3c2ec4660e1f579dd1544d57038..9d6ddf16389c57ebb76d44ab99e5c87caca1fd28 100644 (file)
@@ -2,7 +2,7 @@
  * These functions implement the portions of AUTHMODE_LDAP and AUTHMODE_LDAP_AD which
  * actually speak to the LDAP server.
  *
- * Copyright (c) 2011-2015 by the citadel.org development team.
+ * Copyright (c) 2011-2014 by the citadel.org development 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.
@@ -22,7 +22,6 @@ int ctdl_require_ldap_version = 3;
 #include "citadel_ldap.h"
 #include "ctdl_module.h"
 #include "user_ops.h"
-#include "config.h"
 
 #ifdef HAVE_LDAP
 #define LDAP_DEPRECATED 1      /* Suppress libldap's warning that we are using deprecated API calls */
@@ -38,7 +37,7 @@ int ctdl_ldap_initialize(LDAP **ld) {
        char server_url[256];
        int ret;
 
-       snprintf(server_url, sizeof server_url, "ldap://%s:%d", CtdlGetConfigStr("c_ldap_host"), CtdlGetConfigInt("c_ldap_port"));
+       snprintf(server_url, sizeof server_url, "ldap://%s:%d", config.c_ldap_host, config.c_ldap_port);
        ret = ldap_initialize(ld, server_url);
        if (ret != LDAP_SUCCESS) {
                syslog(LOG_ALERT, "LDAP: Could not connect to %s : %s",
@@ -81,12 +80,12 @@ int CtdlTryUserLDAP(char *username,
        ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ctdl_require_ldap_version);
        ldap_set_option(ldserver, LDAP_OPT_REFERRALS, (void *)LDAP_OPT_OFF);
 
-       striplt(CtdlGetConfigStr("c_ldap_bind_dn"));
-       striplt(CtdlGetConfigStr("c_ldap_bind_pw"));
-       syslog(LOG_DEBUG, "LDAP bind DN: %s", CtdlGetConfigStr("c_ldap_bind_dn"));
+       striplt(config.c_ldap_bind_dn);
+       striplt(config.c_ldap_bind_pw);
+       syslog(LOG_DEBUG, "LDAP bind DN: %s", config.c_ldap_bind_dn);
        i = ldap_simple_bind_s(ldserver,
-               (!IsEmptyStr(CtdlGetConfigStr("c_ldap_bind_dn")) ? CtdlGetConfigStr("c_ldap_bind_dn") : NULL),
-               (!IsEmptyStr(CtdlGetConfigStr("c_ldap_bind_pw")) ? CtdlGetConfigStr("c_ldap_bind_pw") : NULL)
+               (!IsEmptyStr(config.c_ldap_bind_dn) ? config.c_ldap_bind_dn : NULL),
+               (!IsEmptyStr(config.c_ldap_bind_pw) ? config.c_ldap_bind_pw : NULL)
        );
        if (i != LDAP_SUCCESS) {
                syslog(LOG_ALERT, "LDAP: Cannot bind: %s (%d)", ldap_err2string(i), i);
@@ -96,7 +95,7 @@ int CtdlTryUserLDAP(char *username,
        tv.tv_sec = 10;
        tv.tv_usec = 0;
 
-       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD) {
+       if (config.c_auth_mode == AUTHMODE_LDAP_AD) {
                if (lookup_based_on_username != 0)
                        snprintf(searchstring, sizeof(searchstring), "(displayName=%s)",username);
                else
@@ -112,7 +111,7 @@ int CtdlTryUserLDAP(char *username,
        syslog(LOG_DEBUG, "LDAP search: %s", searchstring);
        (void) ldap_search_ext_s(
                ldserver,                                       /* ld                           */
-               CtdlGetConfigStr("c_ldap_base_dn"),             /* base                         */
+               config.c_ldap_base_dn,                          /* base                         */
                LDAP_SCOPE_SUBTREE,                             /* scope                        */
                searchstring,                                   /* filter                       */
                NULL,                                           /* attrs (all attributes)       */
@@ -144,7 +143,7 @@ int CtdlTryUserLDAP(char *username,
                        syslog(LOG_DEBUG, "dn = %s", user_dn);
                }
 
-               if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD) {
+               if (config.c_auth_mode == AUTHMODE_LDAP_AD) {
                        values = ldap_get_values(ldserver, search_result, "displayName");
                        if (values) {
                                if (values[0]) {
@@ -166,7 +165,7 @@ int CtdlTryUserLDAP(char *username,
                }
                /* If we know the username is the CN/displayName, we already set the uid*/
                if (lookup_based_on_username==0) {
-                       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD) {
+                       if (config.c_auth_mode == AUTHMODE_LDAP_AD) {
                                values = ldap_get_values(ldserver, search_result, "objectGUID");
                                if (values) {
                                        if (values[0]) {
@@ -323,12 +322,12 @@ int Ctdl_LDAP_to_vCard(char *ldap_dn, struct vCard *v)
        ldap_set_option(ldserver, LDAP_OPT_PROTOCOL_VERSION, &ctdl_require_ldap_version);
        ldap_set_option(ldserver, LDAP_OPT_REFERRALS, (void *)LDAP_OPT_OFF);
 
-       striplt(CtdlGetConfigStr("c_ldap_bind_dn"));
-       striplt(CtdlGetConfigStr("c_ldap_bind_pw"));
-       syslog(LOG_DEBUG, "LDAP bind DN: %s", CtdlGetConfigStr("c_ldap_bind_dn"));
+       striplt(config.c_ldap_bind_dn);
+       striplt(config.c_ldap_bind_pw);
+       syslog(LOG_DEBUG, "LDAP bind DN: %s", config.c_ldap_bind_dn);
        i = ldap_simple_bind_s(ldserver,
-               (!IsEmptyStr(CtdlGetConfigStr("c_ldap_bind_dn")) ? CtdlGetConfigStr("c_ldap_bind_dn") : NULL),
-               (!IsEmptyStr(CtdlGetConfigStr("c_ldap_bind_pw")) ? CtdlGetConfigStr("c_ldap_bind_pw") : NULL)
+               (!IsEmptyStr(config.c_ldap_bind_dn) ? config.c_ldap_bind_dn : NULL),
+               (!IsEmptyStr(config.c_ldap_bind_pw) ? config.c_ldap_bind_pw : NULL)
        );
        if (i != LDAP_SUCCESS) {
                syslog(LOG_ALERT, "LDAP: Cannot bind: %s (%d)", ldap_err2string(i), i);
index 952b313db61cfede8220ec0256c0822e39ff97d0..00e190839bda557cdfeb6baafb410bf0f52e4245 100644 (file)
@@ -1,21 +1,21 @@
 /*
  * Autocompletion of email recipients, etc.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
+ *  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.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  */
+#include "ctdl_module.h"
 
 
-#include "ctdl_module.h"
 #include "serv_autocompletion.h"
-#include "config.h"
+
 
 
 /*
@@ -170,7 +170,7 @@ void cmd_auto(char *argbuf) {
        /*
         * Search-reduce the results if we have the full text index available
         */
-       if (CtdlGetConfigInt("c_enable_fulltext")) {
+       if (config.c_enable_fulltext) {
                CtdlModuleDoSearch(&fts_num_msgs, &fts_msgs, search_string, "fulltext");
                if (fts_msgs) {
                        for (i=0; i<num_msgs; ++i) {
index 81a54b573914d230981ad2c063e5571ffff9f2b5..ea88b87d36da0ed953fb7a4d8b9cbbc94bb1c1d3 100644 (file)
@@ -2,7 +2,7 @@
  * This module implementsserver commands related to the display and
  * manipulation of user "bio" files.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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 as published by
@@ -16,7 +16,6 @@
  */
 
 #include "ctdl_module.h"
-#include "config.h"
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -46,7 +45,7 @@ void cmd_ebio(char *cmdbuf) {
        }
        cprintf("%d  \n",SEND_LISTING);
        while(client_getln(buf, sizeof buf) >= 0 && strcmp(buf,"000")) {
-               if (ftell(fp) < CtdlGetConfigLong("c_maxmsglen")) {
+               if (ftell(fp) < config.c_maxmsglen) {
                        fprintf(fp,"%s\n",buf);
                }
        }
index df3a13d4f7109b708c9b346aff92cba9a976f51c..1504fcc93bca1b92eb087fc44366bd2ed4894246 100644 (file)
@@ -3,15 +3,22 @@
  * room on a Citadel server.  It handles iCalendar objects using the
  * iTIP protocol.  See RFCs 2445 and 2446.
  *
- * Copyright (c) 1987-2015 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.
+ * Copyright (c) 1987-2011 by the citadel.org team
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is open source software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #define PRODID "-//Citadel//NONSGML Citadel Calendar//EN"
@@ -26,7 +33,6 @@
 #include "room_ops.h"
 #include "euidindex.h"
 #include "ical_dezonify.h"
-#include "config.h"
 
 
 
@@ -143,8 +149,8 @@ void ical_write_to_cal(struct ctdluser *u, icalcomponent *cal) {
                msg->cm_format_type = 4;
                CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
                CM_SetField(msg, eOriginalRoom, CCC->room.QRname, strlen(CCC->room.QRname));
-               CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
-               CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode")));
+               CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
+               CM_SetField(msg, eHumanNode, CFG_KEY(c_humannode));
 
                MsgBody = NewStrBufPlain(NULL, serlen + 100);
                StrBufAppendBufPlain(MsgBody, HKEY("Content-type: text/calendar\r\n\r\n"), 0);
@@ -1454,7 +1460,7 @@ void ical_freebusy(char *who) {
         * primary FQDN of this Citadel node.
         */
        if (found_user != 0) {
-               snprintf(buf, sizeof buf, "%s@%s", who, CtdlGetConfigStr("c_fqdn"));
+               snprintf(buf, sizeof buf, "%s@%s", who, config.c_fqdn);
                syslog(LOG_DEBUG, "Trying <%s>\n", buf);
                recp = validate_recipients(buf, NULL, 0);
                if (recp != NULL) {
@@ -1526,7 +1532,7 @@ void ical_freebusy(char *who) {
        sprintf(buf, "MAILTO:%s", who);
        if (strchr(buf, '@') == NULL) {
                strcat(buf, "@");
-               strcat(buf, CtdlGetConfigStr("c_fqdn"));
+               strcat(buf, config.c_fqdn);
        }
        for (i=0; buf[i]; ++i) {
                if (buf[i]==' ') buf[i] = '_';
@@ -1749,7 +1755,7 @@ void ical_putics(void)
        }
 
        cprintf("%d Transmit data now\n", SEND_LISTING);
-       calstream = CtdlReadMessageBody(HKEY("000"), CtdlGetConfigLong("c_maxmsglen"), NULL, 0, 0);
+       calstream = CtdlReadMessageBody(HKEY("000"), config.c_maxmsglen, NULL, 0, 0);
        if (calstream == NULL) {
                return;
        }
index cb12d318570517ed3f37221f207795dc77ac0dae..a9761a549e6adf267786151fcb617581686284fb 100644 (file)
@@ -1,13 +1,19 @@
 /*
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
+ *  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.
+ *  
+ *  
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  
+ *  
+ *  
  */
 
 #include <string.h>
@@ -254,7 +260,7 @@ void init_ssl(void)
 
                                        X509_NAME_add_entry_by_txt(name, "O",
                                                                   MBSTRING_ASC, 
-                                                                  (unsigned char*) CtdlGetConfigStr("c_humannode"),
+                                                                  (unsigned char*) config.c_humannode,
                                                                   -1, -1, 0);
 
                                        X509_NAME_add_entry_by_txt(name, "OU",
@@ -263,7 +269,7 @@ void init_ssl(void)
                                                                   -1, -1, 0);
 
                                        /* X509_NAME_add_entry_by_txt(name, "CN",
-                                               MBSTRING_ASC, CtdlGetConfigStr("c_fqdn"), -1, -1, 0);
+                                               MBSTRING_ASC, config.c_fqdn, -1, -1, 0);
                                        */
 
                                        X509_NAME_add_entry_by_txt(name, 
index 50661c7c75d64187e97edcdbef00a4d88fcc4bce..15e43b46d1c0659b4c70b919fd7d8888c49d3189 100644 (file)
@@ -1,15 +1,5 @@
 /* 
  * Server functions which handle file transfers and room directories.
- *
- * Copyright (c) 1987-2015 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #include <stdio.h>
@@ -19,10 +9,8 @@
 #include "ctdl_module.h"
 #include "citserver.h"
 #include "support.h"
-#include "config.h"
 #include "user_ops.h"
 
-
 /*
  * Server command to delete a file from a room's directory
  */
@@ -799,15 +787,16 @@ void do_help_subst(char *buffer)
 {
        char buf2[16];
 
-       help_subst(buffer, "^nodename", CtdlGetConfigStr("c_nodename"));
-       help_subst(buffer, "^humannode", CtdlGetConfigStr("c_humannode"));
-       help_subst(buffer, "^fqdn", CtdlGetConfigStr("c_fqdn"));
+       help_subst(buffer, "^nodename", config.c_nodename);
+       help_subst(buffer, "^humannode", config.c_humannode);
+       help_subst(buffer, "^fqdn", config.c_fqdn);
        help_subst(buffer, "^username", CC->user.fullname);
        snprintf(buf2, sizeof buf2, "%ld", CC->user.usernum);
        help_subst(buffer, "^usernum", buf2);
-       help_subst(buffer, "^sysadm", CtdlGetConfigStr("c_sysadm"));
+       help_subst(buffer, "^sysadm", config.c_sysadm);
        help_subst(buffer, "^variantname", CITADEL);
-       help_subst(buffer, "^maxsessions", CtdlGetConfigStr("c_maxsessions"));          // yes it's numeric but str is ok here
+       snprintf(buf2, sizeof buf2, "%d", config.c_maxsessions);
+       help_subst(buffer, "^maxsessions", buf2);
        help_subst(buffer, "^bbsdir", ctdl_message_dir);
 }
 
index 3a51e16b6b46ea86319f6b841b05a61ef1a7e698..2d3208a221640a8c16f6ae0ce755e27de8c791df 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * represent messages to the citadel clients
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
 #include "internet_addressing.h"
 #include "user_ops.h"
 #include "room_ops.h"
-#include "config.h"
 
 extern char *msgkeys[];
 
 
+
 /*
  * Back end for the MSGS command: output message number only.
  */
@@ -34,6 +34,7 @@ void simple_listing(long msgnum, void *userdata)
 }
 
 
+
 /*
  * Back end for the MSGS command: output header summary.
  */
@@ -136,7 +137,7 @@ void cmd_msgs(char *cmdbuf)
        else
                mode = MSGS_ALL;
 
-       if ( (mode == MSGS_SEARCH) && (!CtdlGetConfigInt("c_enable_fulltext")) ) {
+       if ( (mode == MSGS_SEARCH) && (!config.c_enable_fulltext) ) {
                cprintf("%d Full text index is not enabled on this server.\n",
                        ERROR + CMD_NOT_SUPPORTED);
                return;
index 51456ac03528ecae834bb62506128a2ce3d61fe7..14673274baabd90bd5e0318b7d4bf7ac3754cae2 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Server functions which perform operations on room objects.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
@@ -19,7 +19,6 @@
 #include "citserver.h"
 #include "ctdl_module.h"
 #include "room_ops.h"
-#include "config.h"
 
 /*
  * Back-back-end for all room listing commands
@@ -417,7 +416,7 @@ void cmd_rdir(char *cmdbuf)
                cprintf("%d not here.\n", ERROR + HIGHER_ACCESS_REQUIRED);
                return;
        }
-       cprintf("%d %s|%s/%s\n", LISTING_FOLLOWS, CtdlGetConfigStr("c_fqdn"), ctdl_file_dir, CC->room.QRdirname);
+       cprintf("%d %s|%s/%s\n", LISTING_FOLLOWS, config.c_fqdn, ctdl_file_dir, CC->room.QRdirname);
        
        snprintf(buf, sizeof buf, "%s/%s/filedir", ctdl_file_dir, CC->room.QRdirname);
        fd = fopen(buf, "r");
@@ -596,7 +595,8 @@ void cmd_setr(char *args)
                CC->room.QRflags |= QR_PRIVATE;
 
        /* Some changes can't apply to BASEROOM */
-       if (!strncasecmp(CC->room.QRname, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN)) {
+       if (!strncasecmp(CC->room.QRname, config.c_baseroom,
+                        ROOMNAMELEN)) {
                CC->room.QRorder = 0;
                CC->room.QRpasswd[0] = '\0';
                CC->room.QRflags &= ~(QR_PRIVATE & QR_PASSWORDED &
@@ -619,7 +619,8 @@ void cmd_setr(char *args)
                }
        }
        /* Some changes can't apply to AIDEROOM */
-       if (!strncasecmp(CC->room.QRname, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN)) {
+       if (!strncasecmp(CC->room.QRname, config.c_baseroom,
+                        ROOMNAMELEN)) {
                CC->room.QRorder = 0;
                CC->room.QRflags &= ~QR_MAILBOX;
                CC->room.QRflags |= QR_PERMANENT;
@@ -760,7 +761,7 @@ void cmd_kill(char *argbuf)
                CtdlScheduleRoomForDeletion(&CC->room);
 
                /* Return to the Lobby */
-               CtdlUserGoto(CtdlGetConfigStr("c_baseroom"), 0, 0, NULL, NULL, NULL, NULL);
+               CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
 
                /* tell the world what we did */
                snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n",
@@ -830,7 +831,7 @@ void cmd_cre8(char *args)
 
        if (CtdlAccessCheck(ac_logged_in)) return;
 
-       if (CC->user.axlevel < CtdlGetConfigInt("c_createax") && !CC->internal_pgm) {
+       if (CC->user.axlevel < config.c_createax && !CC->internal_pgm) {
                cprintf("%d You need higher access to create rooms.\n",
                        ERROR + HIGHER_ACCESS_REQUIRED);
                return;
index 4aaba407226199187b100748f5114bf486e06a92..6c3914654475069572c3a981e96931c3ddd3ed6a 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Server functions which perform operations on user objects.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2011 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.
@@ -18,7 +18,6 @@
 #include "citserver.h"
 #include "svn_revision.h"
 #include "ctdl_module.h"
-#include "config.h"
 
 void cmd_noop(char *argbuf)
 {
@@ -53,15 +52,15 @@ void cmd_asyn(char *argbuf)
 void cmd_info(char *cmdbuf) {
        cprintf("%d Server info:\n", LISTING_FOLLOWS);
        cprintf("%d\n", CC->cs_pid);
-       cprintf("%s\n", CtdlGetConfigStr("c_nodename"));
-       cprintf("%s\n", CtdlGetConfigStr("c_humannode"));
-       cprintf("%s\n", CtdlGetConfigStr("c_fqdn"));
+       cprintf("%s\n", config.c_nodename);
+       cprintf("%s\n", config.c_humannode);
+       cprintf("%s\n", config.c_fqdn);
        cprintf("%s\n", CITADEL);
        cprintf("%d\n", REV_LEVEL);
-       cprintf("%s\n", CtdlGetConfigStr("c_site_location"));
-       cprintf("%s\n", CtdlGetConfigStr("c_sysadm"));
+       cprintf("%s\n", config.c_site_location);
+       cprintf("%s\n", config.c_sysadm);
        cprintf("%d\n", SERVER_TYPE);
-       cprintf("%s\n", CtdlGetConfigStr("c_moreprompt"));
+       cprintf("%s\n", config.c_moreprompt);
        cprintf("1\n"); /* 1 = yes, this system supports floors */
        cprintf("1\n"); /* 1 = we support the extended paging options */
        cprintf("\n");  /* nonce no longer supported */
@@ -73,15 +72,16 @@ void cmd_info(char *cmdbuf) {
        cprintf("0\n"); /* 1 = no, this server is not LDAP-enabled */
 #endif
 
-       if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_NATIVE) && (CtdlGetConfigInt("c_disable_newu") == 0))
+       if ((config.c_auth_mode == AUTHMODE_NATIVE) &&
+           (config.c_disable_newu == 0))
        {
-               cprintf("%d\n", CtdlGetConfigInt("c_disable_newu"));
+               cprintf("%d\n", config.c_disable_newu);
        }
        else {
                cprintf("1\n"); /* "create new user" does not work with non-native auth modes */
        }
 
-       cprintf("%s\n", CtdlGetConfigStr("c_default_cal_zone"));
+       cprintf("%s\n", config.c_default_cal_zone);
 
        /* thread load averages -- temporarily disabled during refactoring of this code */
        cprintf("0\n");         /* load average */
@@ -89,17 +89,17 @@ void cmd_info(char *cmdbuf) {
        cprintf("0\n");         /* thread count */
 
        cprintf("1\n");         /* yes, Sieve mail filtering is supported */
-       cprintf("%d\n", CtdlGetConfigInt("c_enable_fulltext"));
+       cprintf("%d\n", config.c_enable_fulltext);
        cprintf("%s\n", svn_revision());
 
-       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_NATIVE) {
+       if (config.c_auth_mode == AUTHMODE_NATIVE) {
                cprintf("%d\n", openid_level_supported); /* OpenID is enabled when using native auth */
        }
        else {
                cprintf("0\n"); /* OpenID is disabled when using non-native auth */
        }
 
-       cprintf("%d\n", CtdlGetConfigInt("c_guest_logins"));
+       cprintf("%d\n", config.c_guest_logins);
        
        cprintf("000\n");
 }
@@ -116,7 +116,7 @@ void cmd_echo(char *etext)
  * get the paginator prompt
  */
 void cmd_more(char *argbuf) {
-       cprintf("%d %s\n", CIT_OK, CtdlGetConfigStr("c_moreprompt"));
+       cprintf("%d %s\n", CIT_OK, config.c_moreprompt);
 }
 
 
@@ -142,7 +142,7 @@ void cmd_iden(char *argbuf)
        rev_level = extract_int(argbuf,2);
        extract_token(desc, argbuf, 3, '|', sizeof desc);
 
-       safestrncpy(from_host, CtdlGetConfigStr("c_fqdn"), sizeof from_host);
+       safestrncpy(from_host, config.c_fqdn, sizeof from_host);
        from_host[sizeof from_host - 1] = 0;
        if (num_parms(argbuf)>=5) extract_token(from_host, argbuf, 4, '|', sizeof from_host);
 
index 7d6b18c6c4e8115f8bbdb845f9660a54af9a17c6..e98daad9fa9e26f6d9e8f3ff79b61362a1f80c76 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Server functions which perform operations on user objects.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2011 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.
 #include "support.h"
 #include "control.h"
 #include "ctdl_module.h"
+
 #include "citserver.h"
-#include "config.h"
+
 #include "user_ops.h"
 #include "internet_addressing.h"
 
 
+
 /*
  * USER cmd
  */
@@ -45,7 +47,7 @@ void cmd_user(char *cmdbuf)
                        "Too many users are already online "
                        "(maximum is %d)\n",
                        ERROR + MAX_SESSIONS_EXCEEDED,
-                       CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions"));
+                       config.c_nodename, config.c_maxsessions);
                return;
        case login_ok:
                cprintf("%d Password required for %s\n",
@@ -97,13 +99,13 @@ void cmd_newu(char *cmdbuf)
        long len;
        char username[SIZ];
 
-       if (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) {
+       if (config.c_auth_mode != AUTHMODE_NATIVE) {
                cprintf("%d This system does not use native mode authentication.\n",
                        ERROR + NOT_HERE);
                return;
        }
 
-       if (CtdlGetConfigInt("c_disable_newu")) {
+       if (config.c_disable_newu) {
                cprintf("%d Self-service user account creation "
                        "is disabled on this system.\n", ERROR + NOT_HERE);
                return;
@@ -116,7 +118,7 @@ void cmd_newu(char *cmdbuf)
        if (CC->nologin) {
                cprintf("%d %s: Too many users are already online (maximum is %d)\n",
                        ERROR + MAX_SESSIONS_EXCEEDED,
-                       CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions"));
+                       config.c_nodename, config.c_maxsessions);
                return;
        }
        extract_token(username, cmdbuf, 0, '|', sizeof username);
@@ -230,7 +232,7 @@ void cmd_creu(char *cmdbuf)
        } else if (a == ERROR + ALREADY_EXISTS) {
                cprintf("%d '%s' already exists.\n", ERROR + ALREADY_EXISTS, username);
                return;
-       } else if ( (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) && (a == ERROR + NO_SUCH_USER) ) {
+       } else if ( (config.c_auth_mode != AUTHMODE_NATIVE) && (a == ERROR + NO_SUCH_USER) ) {
                cprintf("%d User accounts are not created within Citadel in host authentication mode.\n",
                        ERROR + NO_SUCH_USER);
                return;
@@ -370,7 +372,7 @@ void cmd_invt_kick(char *iuser, int op) {
                return;
        }
 
-       if (!strncasecmp(CC->room.QRname, CtdlGetConfigStr("c_baseroom"),
+       if (!strncasecmp(CC->room.QRname, config.c_baseroom,
                         ROOMNAMELEN)) {
                cprintf("%d Can't add/remove users from this room.\n",
                        ERROR + NOT_HERE);
index 22a715615c6ffac6aa32629eb857b657f5fa60ba..f7e286a9ab14cf6188f352b52ac036224df99982 100644 (file)
@@ -1,13 +1,19 @@
 /*
- * Copyright (c) 1998-2015 by the citadel.org team
+ * Copyright (c) 1998-2012 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.
+ *  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.
+ *  
+ *  
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  
+ *  
+ *  
  */
 
 #include "sysdep.h"
@@ -47,8 +53,9 @@
 #include "server.h"
 #include "citserver.h"
 #include "support.h"
+
 #include "ctdl_module.h"
-#include "config.h"
+
 #include "event_client.h"
 #include "serv_curl.h"
 
@@ -470,13 +477,13 @@ int evcurl_init(AsyncIO *IO)
        OPT(WRITEDATA, (void *)IO);
        OPT(ERRORBUFFER, IO->HttpReq.errdesc);
 
-       if ((!IsEmptyStr(CtdlGetConfigStr("c_ip_addr")))
-               && (strcmp(CtdlGetConfigStr("c_ip_addr"), "*"))
-               && (strcmp(CtdlGetConfigStr("c_ip_addr"), "::"))
-               && (strcmp(CtdlGetConfigStr("c_ip_addr"), "0.0.0.0"))
+       if ((!IsEmptyStr(config.c_ip_addr))
+               && (strcmp(config.c_ip_addr, "*"))
+               && (strcmp(config.c_ip_addr, "::"))
+               && (strcmp(config.c_ip_addr, "0.0.0.0"))
                )
        {
-               OPT(INTERFACE, CtdlGetConfigStr("c_ip_addr"));
+               OPT(INTERFACE, config.c_ip_addr);
        }
 
 #ifdef CURLOPT_HTTP_CONTENT_DECODING
index 76c6acb44a2a3ed10605da80491fefc41756bd03..bc4b772a72c1c28626a7b743d864d82ca8dcdbcb 100644 (file)
@@ -1,6 +1,6 @@
 /* 
  * Functions which manage expire policy for rooms
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
@@ -40,6 +40,7 @@
 #include "support.h"
 #include "msgbase.h"
 #include "citserver.h"
+
 #include "ctdl_module.h"
 #include "user_ops.h"
 
@@ -70,16 +71,15 @@ void GetExpirePolicy(struct ExpirePolicy *epbuf, struct ctdlroom *qrbuf) {
         * If there is a default policy for mailbox rooms, return it
         */
        if (qrbuf->QRflags & QR_MAILBOX) {
-               if (CtdlGetConfigInt("c_mbxep_mode") != 0) {
-                       epbuf->expire_mode = CtdlGetConfigInt("c_mbxep_mode");
-                       epbuf->expire_value = CtdlGetConfigInt("c_mbxep_value");
+               if (config.c_mbxep.expire_mode != 0) {
+                       memcpy(epbuf, &config.c_mbxep,
+                               sizeof(struct ExpirePolicy));
                        return;
                }
        }
 
        /* Otherwise, fall back on the system default */
-       epbuf->expire_mode = CtdlGetConfigInt("c_ep_mode");
-       epbuf->expire_value = CtdlGetConfigInt("c_ep_value");
+       memcpy(epbuf, &config.c_ep, sizeof(struct ExpirePolicy));
 }
 
 
@@ -91,22 +91,23 @@ void cmd_gpex(char *argbuf) {
        struct floor *fl;
        char which[128];
 
-       memset(&exp, 0, sizeof(struct ExpirePolicy));
        extract_token(which, argbuf, 0, '|', sizeof which);
-       if (!strcasecmp(which, strof(roompolicy)) || !strcasecmp(which, "room")) {
+       if (!strcasecmp(which, strof(roompolicy))||
+           !strcasecmp(which, "room")) { /* Deprecated version */
                memcpy(&exp, &CC->room.QRep, sizeof(struct ExpirePolicy));
        }
-       else if (!strcasecmp(which, strof(floorpolicy)) || !strcasecmp(which, "floor")) {
+       else if (!strcasecmp(which, strof(floorpolicy))||
+                !strcasecmp(which, "floor")) { /* Deprecated version */
                fl = CtdlGetCachedFloor(CC->room.QRfloor);
                memcpy(&exp, &fl->f_ep, sizeof(struct ExpirePolicy));
        }
-       else if (!strcasecmp(which, strof(mailboxespolicy)) || !strcasecmp(which, "mailboxes")) {
-               exp.expire_mode = CtdlGetConfigInt("c_mbxep_mode");
-               exp.expire_value = CtdlGetConfigInt("c_mbxep_value");
+       else if (!strcasecmp(which, strof(mailboxespolicy))||
+                !strcasecmp(which, "mailboxes")) {/* Deprecated version */
+               memcpy(&exp, &config.c_mbxep, sizeof(struct ExpirePolicy));
        }
-       else if (!strcasecmp(which, strof(sitepolicy)) || !strcasecmp(which, "site")) {
-               exp.expire_mode = CtdlGetConfigInt("c_ep_mode");
-               exp.expire_value = CtdlGetConfigInt("c_ep_value");
+       else if (!strcasecmp(which, strof(sitepolicy))||
+                !strcasecmp(which, "site")) {/* Deprecated version */
+               memcpy(&exp, &config.c_ep, sizeof(struct ExpirePolicy));
        }
        else {
                cprintf("%d Invalid keyword \"%s\"\n", ERROR + ILLEGAL_VALUE, which);
@@ -135,8 +136,9 @@ void cmd_spex(char *argbuf) {
                return;
        }
 
-       if ((!strcasecmp(which, strof(roompolicy))) || (!strcasecmp(which, "room")))
-       {
+       if (    (!strcasecmp(which, strof(roompolicy)))
+               || (!strcasecmp(which, "room"))
+       ) {
                if (!is_room_aide()) {
                        cprintf("%d Higher access required.\n", ERROR + HIGHER_ACCESS_REQUIRED);
                        return;
@@ -158,8 +160,9 @@ void cmd_spex(char *argbuf) {
                return;
        }
 
-       if ((!strcasecmp(which, strof(floorpolicy))) || (!strcasecmp(which, "floor")))
-       {
+       if (    (!strcasecmp(which, strof(floorpolicy)))
+               || (!strcasecmp(which, "floor"))
+       ) {
                lgetfloor(&flbuf, CC->room.QRfloor);
                memcpy(&flbuf.f_ep, &exp, sizeof(struct ExpirePolicy));
                lputfloor(&flbuf, CC->room.QRfloor);
@@ -167,22 +170,25 @@ void cmd_spex(char *argbuf) {
                return;
        }
 
-       else if ((!strcasecmp(which, strof(mailboxespolicy))) || (!strcasecmp(which, "mailboxes")))
-       {
-               CtdlSetConfigInt("c_mbxep_mode", exp.expire_mode);
-               CtdlSetConfigInt("c_mbxep_value", exp.expire_value);
+       else if (       (!strcasecmp(which, strof(mailboxespolicy)))
+                       || (!strcasecmp(which, "mailboxes"))
+               ) {
+               memcpy(&config.c_mbxep, &exp, sizeof(struct ExpirePolicy));
+               put_config();
                cprintf("%d Default expire policy for mailboxes set.\n", CIT_OK);
                return;
        }
 
-       else if ((!strcasecmp(which, strof(sitepolicy))) || (!strcasecmp(which, "site")))
-       {
+       else if (       (!strcasecmp(which, strof(sitepolicy)))
+                       || (!strcasecmp(which, "site"))
+               ) {
                if (exp.expire_mode == EXPIRE_NEXTLEVEL) {
-                       cprintf("%d Invalid policy (no higher level)\n", ERROR + ILLEGAL_VALUE);
+                       cprintf("%d Invalid policy (no higher level)\n",
+                               ERROR + ILLEGAL_VALUE);
                        return;
                }
-               CtdlSetConfigInt("c_ep_mode", exp.expire_mode);
-               CtdlSetConfigInt("c_ep_value", exp.expire_value);
+               memcpy(&config.c_ep, &exp, sizeof(struct ExpirePolicy));
+               put_config();
                cprintf("%d Site expire policy has been updated.\n", CIT_OK);
                return;
        }
index cf501e081615b06a425e8ace4906dbfdc00a9298..583b86dd504019e844aa0ccbe9c5a906b246b976 100644 (file)
@@ -3,7 +3,7 @@
  *
  * You might also see this module affectionately referred to as the DAP (the Dreaded Auto-Purger).
  *
- * Copyright (c) 1988-2015 by citadel.org (Art Cancro, Wilifried Goesgens, and others)
+ * Copyright (c) 1988-2011 by citadel.org (Art Cancro, Wilifried Goesgens, and others)
  *
  * This program is open source software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ *
  * A brief technical discussion:
  *
  * Several of the purge operations found in this module operate in two
@@ -307,11 +312,11 @@ void DoPurgeRooms(struct ctdlroom *qrbuf, void *data) {
                if (qrbuf->QRmtime <= (time_t)0) return;
 
                /* If no room purge time is set, be safe and don't purge */
-               if (CtdlGetConfigLong("c_roompurge") < 0) return;
+               if (config.c_roompurge < 0) return;
 
                /* Otherwise, check the date of last modification */
                age = time(NULL) - (qrbuf->QRmtime);
-               purge_secs = CtdlGetConfigLong("c_roompurge") * 86400;
+               purge_secs = (time_t)config.c_roompurge * (time_t)86400;
                if (purge_secs <= (time_t)0) return;
                syslog(LOG_DEBUG, "<%s> is <%ld> seconds old", qrbuf->QRname, (long)age);
                if (age > purge_secs) do_purge = 1;
@@ -412,10 +417,10 @@ void do_user_purge(struct ctdluser *us, void *data) {
 
        /* Set purge time; if the user overrides the system default, use it */
        if (us->USuserpurge > 0) {
-               purge_time = ((time_t)us->USuserpurge) * 86400;
+               purge_time = ((time_t)us->USuserpurge) * 86400L;
        }
        else {
-               purge_time = CtdlGetConfigLong("c_userpurge") * 86400;
+               purge_time = ((time_t)config.c_userpurge) * 86400L;
        }
 
        /* The default rule is to not purge. */
@@ -424,7 +429,7 @@ void do_user_purge(struct ctdluser *us, void *data) {
        /* If the user hasn't called in two months and expiring of accounts is turned on, his/her account
         * has expired, so purge the record.
         */
-       if (CtdlGetConfigLong("c_userpurge") > 0)
+       if (config.c_userpurge > 0)
        {
                now = time(NULL);
                if ((now - us->lastcall) > purge_time) purge = 1;
@@ -523,7 +528,7 @@ int PurgeUsers(void) {
        syslog(LOG_DEBUG, "PurgeUsers() called");
        users_not_purged = 0;
 
-       switch(CtdlGetConfigInt("c_auth_mode")) {
+       switch(config.c_auth_mode) {
                case AUTHMODE_NATIVE:
                        ForEachUser(do_user_purge, NULL);
                        break;
@@ -531,7 +536,8 @@ int PurgeUsers(void) {
                        ForEachUser(do_uid_user_purge, NULL);
                        break;
                default:
-                       syslog(LOG_DEBUG, "User purge for auth mode %d is not implemented.", CtdlGetConfigInt("c_auth_mode"));
+                       syslog(LOG_DEBUG, "User purge for auth mode %d is not implemented.",
+                               config.c_auth_mode);
                        break;
        }
 
@@ -864,8 +870,10 @@ void purge_databases(void)
         */
        now = time(NULL);
        localtime_r(&now, &tm);
-       if (((tm.tm_hour != CtdlGetConfigInt("c_purge_hour")) || ((now - last_purge) < 43200)) && (force_purge_now == 0))
-       {
+       if (
+               ((tm.tm_hour != config.c_purge_hour) || ((now - last_purge) < 43200))
+               && (force_purge_now == 0)
+       ) {
                        return;
        }
 
index 219a03fa122cf4409c21266a4722568f6d69e93c..8eafc036a61b09e39fbbd54583cc2768dd59e10c 100644 (file)
@@ -8,7 +8,7 @@
  * Based on bits of serv_funambol
  * Contact: <matt@mcbridematt.dhs.org> / <matt@comalies>
  *
- * Copyright (c) 2008-2015
+ * Copyright (c) 2008-2011
  *
  * This program is open source software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
 
@@ -291,9 +295,9 @@ void process_notify(long NotifyMsgnum, void *usrdata)
                {
                case eFunambol:
                        snprintf(remoteurl, SIZ, "http://%s@%s:%d/%s",
-                                CtdlGetConfigStr("c_funambol_auth"),
-                                CtdlGetConfigStr("c_funambol_host"),
-                                CtdlGetConfigInt("c_funambol_port"),
+                                config.c_funambol_auth,
+                                config.c_funambol_host,
+                                config.c_funambol_port,
                                 FUNAMBOL_WS);
 
                        notify_http_server(remoteurl,
@@ -345,7 +349,7 @@ void process_notify(long NotifyMsgnum, void *usrdata)
                        int commandSiz;
                        char *command;
 
-                       commandSiz = sizeof(CtdlGetConfigStr("c_pager_program")) +
+                       commandSiz = sizeof(config.c_pager_program) +
                                strlen(PagerNo) +
                                msg->cm_lengths[eExtnotify] + 5;
 
@@ -354,7 +358,7 @@ void process_notify(long NotifyMsgnum, void *usrdata)
                        snprintf(command,
                                 commandSiz,
                                 "%s %s -u %s",
-                                CtdlGetConfigStr("c_pager_program"),
+                                config.c_pager_program,
                                 PagerNo,
                                 msg->cm_fields[eExtnotify]);
 
@@ -389,8 +393,8 @@ void do_extnotify_queue(void)
         * don't really require extremely fine granularity here, we'll do it
         * with a static variable instead.
         */
-       if (IsEmptyStr(CtdlGetConfigStr("c_pager_program")) &&
-           IsEmptyStr(CtdlGetConfigStr("c_funambol_host")))
+       if (IsEmptyStr(config.c_pager_program) &&
+           IsEmptyStr(config.c_funambol_host))
        {
                syslog(LOG_ERR,
                       "No external notifiers configured on system/user\n");
@@ -468,7 +472,7 @@ int extnotify_after_mbox_save(struct CtdlMessage *msg,
        /* If this is private, local mail, make a copy in the
         * recipient's mailbox and bump the reference count.
         */
-       if (!IsEmptyStr(CtdlGetConfigStr("c_funambol_host")) || !IsEmptyStr(CtdlGetConfigStr("c_pager_program")))
+       if (!IsEmptyStr(config.c_funambol_host) || !IsEmptyStr(config.c_pager_program))
        {
                /* Generate a instruction message for the Funambol notification
                 * server, in the same style as the SMTP queue
index 1a109971988185f4b4ebeb44a1a3604fbdc5042c..20246c90d02a38ac25193743a01440340b5fca48 100644 (file)
@@ -8,15 +8,21 @@
  * Based on bits of the previous serv_funambol
  * Contact: <matt@mcbridematt.dhs.org> / <matt@comalies>
  *
- * Copyright (c) 2008-2015
+ * Copyright (c) 2008-2010
  *
  * 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.
+ * 
+ * 
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * 
+ * 
+ * 
  */
 
 #include <stdio.h>
@@ -140,7 +146,8 @@ int notify_http_server(char *remoteurl,
 
                // Do substitutions
                help_subst(SOAPMessage, "^notifyuser", user);
-               help_subst(SOAPMessage, "^syncsource", CtdlGetConfigStr("c_funambol_source"));
+               help_subst(SOAPMessage, "^syncsource",
+                          config.c_funambol_source);
                help_subst(SOAPMessage, "^msgid", msgid);
                help_subst(SOAPMessage, "^msgnum", msgnumstr);
 
@@ -175,7 +182,7 @@ int notify_http_server(char *remoteurl,
        }
        else {
                help_subst(remoteurl, "^notifyuser", user);
-               help_subst(remoteurl, "^syncsource", CtdlGetConfigStr("c_funambol_source"));
+               help_subst(remoteurl, "^syncsource", config.c_funambol_source);
                help_subst(remoteurl, "^msgid", msgid);
                help_subst(remoteurl, "^msgnum", msgnumstr);
 
index 8029b758383bdfdc101127a4480fcf6abf297431..6288bfc9ab99adb0a240c99b739aab54da32622e 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * This module handles fulltext indexing of the message base.
- * Copyright (c) 2005-2015 by the citadel.org team
+ * Copyright (c) 2005-2011 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 as published
@@ -251,7 +251,7 @@ void do_fulltext_indexing(void) {
        /*
         * Don't do this if the site doesn't have it enabled.
         */
-       if (!CtdlGetConfigInt("c_enable_fulltext")) {
+       if (!config.c_enable_fulltext) {
                return;
        }
 
@@ -268,7 +268,7 @@ 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 ((CitControl.MMfulltext >= CitControl.MMhighest) && (CitControl.fulltext_wordbreaker == FT_WORDBREAKER_ID)) {
                return;         /* nothing to do! */
        }
        
@@ -280,9 +280,9 @@ void do_fulltext_indexing(void) {
         * over.
         */
        begin_critical_section(S_CONTROL);
-       if (CitControl.MM_fulltext_wordbreaker != FT_WORDBREAKER_ID) {
+       if (CitControl.fulltext_wordbreaker != FT_WORDBREAKER_ID) {
                syslog(LOG_DEBUG, "wb ver on disk = %d, code ver = %d",
-                       CitControl.MM_fulltext_wordbreaker, FT_WORDBREAKER_ID
+                       CitControl.fulltext_wordbreaker, FT_WORDBREAKER_ID
                );
                syslog(LOG_INFO, "(re)initializing full text index");
                cdb_trunc(CDB_FULLTEXT);
@@ -354,7 +354,7 @@ void do_fulltext_indexing(void) {
        ft_flush_cache();
        begin_critical_section(S_CONTROL);
        CitControl.MMfulltext = ft_newhighest;
-       CitControl.MM_fulltext_wordbreaker = FT_WORDBREAKER_ID;
+       CitControl.fulltext_wordbreaker = FT_WORDBREAKER_ID;
        put_control();
        end_critical_section(S_CONTROL);
        last_index = time(NULL);
@@ -455,7 +455,7 @@ void cmd_srch(char *argbuf) {
 
        if (CtdlAccessCheck(ac_logged_in)) return;
 
-       if (!CtdlGetConfigInt("c_enable_fulltext")) {
+       if (!config.c_enable_fulltext) {
                cprintf("%d Full text index is not enabled on this server.\n",
                        ERROR + CMD_NOT_SUPPORTED);
                return;
@@ -489,7 +489,7 @@ void ft_delete_remove(char *room, long msgnum)
        if (room) return;
        
        /* Remove from fulltext index */
-       if (CtdlGetConfigInt("c_enable_fulltext")) {
+       if (config.c_enable_fulltext) {
                ft_index_message(msgnum, 0);
        }
 }
index 6708fbc4ea4a63f2b9d7cec5de10e1017ee1e46b..3f00d3f3f65c26380005589c3fc8d8d21bb1d37d 100644 (file)
@@ -2,17 +2,21 @@
  * Implements the FETCH command in IMAP.
  * This is a good example of the protocol's gratuitous complexity.
  *
- * Copyright (c) 2001-2015 by the citadel.org team
+ * Copyright (c) 2001-2011 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 as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
+ *  This program is open source software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 
@@ -359,8 +363,8 @@ void imap_output_envelope_from(struct CtdlMessage *msg) {
                process_rfc822_addr(msg->cm_fields[erFc822Addr], user, node, name);
                IPutStr(user, strlen(user));            /* mailbox name (user id) */
                IAPuts(" ");
-               if (!strcasecmp(node, CtdlGetConfigStr("c_nodename"))) {
-                       IPutStr(CtdlGetConfigStr("c_fqdn"), strlen(CtdlGetConfigStr("c_fqdn")));
+               if (!strcasecmp(node, config.c_nodename)) {
+                       IPutStr(CFG_KEY(c_fqdn));
                }
                else {
                        IPutStr(node, strlen(node));            /* host name */
index 3665264554ddc574840d88acef5e64017c857a31..f4d501c9d3853dd56c8895e804ac0c5d943755ea 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2011 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 as published by
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 
@@ -337,7 +341,7 @@ void imap_append(int num_parms, ConstStr *Params) {
        
        IUnbuffer ();
 
-       client_read_blob(Imap->TransmittedMessage, literal_length, CtdlGetConfigInt("c_sleeping"));
+       client_read_blob(Imap->TransmittedMessage, literal_length, config.c_sleeping);
 
        if ((ret < 0) || (StrLength(Imap->TransmittedMessage) < literal_length)) {
                IReply("NO Read failed.");
@@ -373,15 +377,19 @@ void imap_append(int num_parms, ConstStr *Params) {
        CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
 
        /* If the user is locally authenticated, FORCE the From: header to
-        * show up as the real sender.  (Configurable setting)
+        * show up as the real sender.  FIXME do we really want to do this?
+        * Probably should make it site-definable or even room-definable.
+        *
+        * For now, we allow "forgeries" if the room is one of the user's
+        * private mailboxes.
         */
        if (CCC->logged_in) {
-               if ( ((CCC->room.QRflags & QR_MAILBOX) == 0) && (CtdlGetConfigInt("c_imap_keep_from") == 0))
-               {
-                       CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
-                       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
-                       CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode")));
-               }
+          if ( ((CCC->room.QRflags & QR_MAILBOX) == 0) && (config.c_imap_keep_from == 0)) {
+
+               CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
+               CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
+               CM_SetField(msg, eHumanNode, CFG_KEY(c_humannode));
+           }
        }
 
        /* 
index 02240b1e8c887a6704f010e3a731a0eeed2995c4..cad499ceb63ad2091768ae552a5d8c99b2243758 100644 (file)
@@ -1,15 +1,21 @@
 /*
  * Implements IMAP's gratuitously complex SEARCH command.
  *
- * Copyright (c) 2001-2015 by the citadel.org team
+ * Copyright (c) 2001-2012 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.
+ *  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.
+ *  
+ *  
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  
+ *  
+ *  
  */
 
 #include "ctdl_module.h"
@@ -151,7 +157,7 @@ int imap_do_search_msg(int seq, struct CtdlMessage *supplied_msg,
                /* If fulltext indexing is active, on this server,
                 *  all messages have already been qualified.
                 */
-               if (CtdlGetConfigInt("c_enable_fulltext")) {
+               if (config.c_enable_fulltext) {
                        match = 1;
                }
 
@@ -565,7 +571,7 @@ void imap_do_search(int num_items, ConstStr *itemlist, int is_uid) {
         * text index to disqualify messages that don't have any chance of
         * matching.  (Only do this if the index is enabled!!)
         */
-       if (CtdlGetConfigInt("c_enable_fulltext")) for (i=0; i<(num_items-1); ++i) {
+       if (config.c_enable_fulltext) for (i=0; i<(num_items-1); ++i) {
                if (!strcasecmp(itemlist[i].Key, "BODY")) {
                        CtdlModuleDoSearch(&fts_num_msgs, &fts_msgs, itemlist[i+1].Key, "fulltext");
                        if (fts_num_msgs > 0) {
index 34c175dcbb94818d188295da9f89f7b1eedf17b3..278cc73323392b3883c08ff8ee58b75d1b8fa163 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * IMAP server for the Citadel system
  *
- * Copyright (C) 2000-2015 by Art Cancro and others.
+ * Copyright (C) 2000-2011 by Art Cancro and others.
  * This code is released under the terms of the GNU General Public License.
  *
  * WARNING: the IMAP protocol is badly designed.  No implementation of it
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "sysdep.h"
@@ -595,7 +599,7 @@ void imap_greeting(void)
 
        IAPuts("* OK [");
        imap_output_capability_string();
-       IAPrintf("] %s IMAP4rev1 %s ready\r\n", CtdlGetConfigStr("c_fqdn"), CITADEL);
+       IAPrintf("] %s IMAP4rev1 %s ready\r\n", config.c_fqdn, CITADEL);
        IUnbuffer();
 }
 
@@ -1671,7 +1675,7 @@ void imap_logout(int num_parms, ConstStr *Params)
        if (IMAP->selected) {
                imap_do_expunge();      /* yes, we auto-expunge at logout */
        }
-       IAPrintf("* BYE %s logging out\r\n", CtdlGetConfigStr("c_fqdn"));
+       IAPrintf("* BYE %s logging out\r\n", config.c_fqdn);
        IReply("OK Citadel IMAP session ended.");
        CC->kill_me = KILLME_CLIENT_LOGGED_OUT;
        return;
@@ -1740,10 +1744,10 @@ CTDL_MODULE_INIT(imap)
        if (!threading)
        {
                CtdlRegisterDebugFlagHook(HKEY("imapsrv"), SetIMAPDebugEnabled, &IMAPDebugEnabled);
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_imap_port"),
+               CtdlRegisterServiceHook(config.c_imap_port,
                                        NULL, imap_greeting, imap_command_loop, NULL, CitadelServiceIMAP);
 #ifdef HAVE_OPENSSL
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_imaps_port"),
+               CtdlRegisterServiceHook(config.c_imaps_port,
                                        NULL, imaps_greeting, imap_command_loop, NULL, CitadelServiceIMAPS);
 #endif
                CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP, PRIO_STOP + 30);
index 9884785373f4701758aabdef6031e2f6b2103b77..2c28600b665cc01d437439c6f5442499e46bfc20 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This module handles instant messaging between users.
  * 
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
@@ -11,7 +11,6 @@
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
  */
-
 #include "sysdep.h"
 #include <stdlib.h>
 #include <unistd.h>
@@ -175,7 +174,7 @@ void cmd_gexp(char *argbuf) {
                (long)ptr->timestamp,                   /* time sent */
                ptr->flags,                             /* flags */
                ptr->sender,                            /* sender of msg */
-               CtdlGetConfigStr("c_nodename"),         /* static for now (and possibly deprecated) */
+               config.c_nodename,                      /* static for now (and possibly deprecated) */
                ptr->sender_email                       /* email or jid of sender */
        );
 
@@ -479,7 +478,7 @@ void flush_individual_conversation(struct imlog *im) {
        }
 
        CM_SetField(msg, eOriginalRoom, HKEY(PAGELOGROOM));
-       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+       CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
        CM_SetAsFieldSB(msg, eMesageText, &FullMsgBuf); /* we own this memory now */
 
        /* Start with usernums[1] because it's guaranteed to be higher than usernums[0],
@@ -504,9 +503,9 @@ void flush_individual_conversation(struct imlog *im) {
        }
 
        /* Finally, if we're logging instant messages globally, do that now. */
-       if (!IsEmptyStr(CtdlGetConfigStr("c_logpages"))) {
-               CtdlCreateRoom(CtdlGetConfigStr("c_logpages"), 3, "", 0, 1, 1, VIEW_BBS);
-               CtdlSaveMsgPointerInRoom(CtdlGetConfigStr("c_logpages"), msgnum, 0, NULL);
+       if (!IsEmptyStr(config.c_logpages)) {
+               CtdlCreateRoom(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
+               CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0, NULL);
        }
 
 }
index 6bfe112643cc460a5a9d0c5958f971aa9a46a989..23f5f263c614b67b8db4ea489c3ff841bc33fae8 100644 (file)
@@ -6,7 +6,7 @@
  * as this draft expires with this writing, you might need to search for
  * the new one.
  *
- * Copyright (c) 2007-2015 by the citadel.org team
+ * Copyright (c) 2007-2012 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.
@@ -651,7 +651,7 @@ CTDL_MODULE_INIT(managesieve)
 {
        if (!threading)
        {
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_managesieve_port"),
+               CtdlRegisterServiceHook(config.c_managesieve_port,
                                        NULL,
                                        managesieve_greeting,
                                        managesieve_command_loop,
index 4a0fd4caa9cb9699b567aee6674678a2d4c3bd5f..97181a1c64763850523c23d60c07b99d29a87aa6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This module dumps and/or loads the Citadel database in XML format.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2014 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.
@@ -71,7 +71,7 @@ char migr_tempfilename1[PATH_MAX];
 char migr_tempfilename2[PATH_MAX];
 FILE *migr_global_message_list;
 int total_msgs = 0;
-int we_are_currently_importing_config = 0;
+
 
 /*
  * Code which implements the export appears in this section
@@ -432,9 +432,80 @@ void migr_do_export(void) {
 
        /* export the config file (this is done using x-macros) */
        client_write("<config>\n", 9);
-
-       /* FIXME FIXME FIXME FIXME FIXME write a config exporter and put it here */
-
+       client_write("<c_nodename>", 12);       xml_strout(config.c_nodename);          client_write("</c_nodename>\n", 14);
+       client_write("<c_fqdn>", 8);            xml_strout(config.c_fqdn);              client_write("</c_fqdn>\n", 10);
+       client_write("<c_humannode>", 13);      xml_strout(config.c_humannode);         client_write("</c_humannode>\n", 15);
+       client_write("<c_phonenum>", 12);       xml_strout(config.c_phonenum);          client_write("</c_phonenum>\n", 14);
+       cprintf("<c_ctdluid>%d</c_ctdluid>\n", config.c_ctdluid);
+       cprintf("<c_creataide>%d</c_creataide>\n", config.c_creataide);
+       cprintf("<c_sleeping>%d</c_sleeping>\n", config.c_sleeping);
+       cprintf("<c_initax>%d</c_initax>\n", config.c_initax);
+       cprintf("<c_regiscall>%d</c_regiscall>\n", config.c_regiscall);
+       cprintf("<c_twitdetect>%d</c_twitdetect>\n", config.c_twitdetect);
+       client_write("<c_twitroom>", 12);       xml_strout(config.c_twitroom);          client_write("</c_twitroom>\n", 14);
+       client_write("<c_moreprompt>", 14);     xml_strout(config.c_moreprompt);        client_write("</c_moreprompt>\n", 16);
+       cprintf("<c_restrict>%d</c_restrict>\n", config.c_restrict);
+       client_write("<c_site_location>", 17);  xml_strout(config.c_site_location);     client_write("</c_site_location>\n", 19);
+       client_write("<c_sysadm>", 10);         xml_strout(config.c_sysadm);            client_write("</c_sysadm>\n", 12);
+       cprintf("<c_maxsessions>%d</c_maxsessions>\n", config.c_maxsessions);
+       client_write("<c_ip_addr>", 11);        xml_strout(config.c_ip_addr);           client_write("</c_ip_addr>\n", 13);
+       cprintf("<c_port_number>%d</c_port_number>\n", config.c_port_number);
+       cprintf("<c_ep_expire_mode>%d</c_ep_expire_mode>\n", config.c_ep.expire_mode);
+       cprintf("<c_ep_expire_value>%d</c_ep_expire_value>\n", config.c_ep.expire_value);
+       cprintf("<c_userpurge>%d</c_userpurge>\n", config.c_userpurge);
+       cprintf("<c_roompurge>%d</c_roompurge>\n", config.c_roompurge);
+       client_write("<c_logpages>", 12);       xml_strout(config.c_logpages);          client_write("</c_logpages>\n", 14);
+       cprintf("<c_createax>%d</c_createax>\n", config.c_createax);
+       cprintf("<c_maxmsglen>%ld</c_maxmsglen>\n", config.c_maxmsglen);
+       cprintf("<c_min_workers>%d</c_min_workers>\n", config.c_min_workers);
+       cprintf("<c_max_workers>%d</c_max_workers>\n", config.c_max_workers);
+       cprintf("<c_pop3_port>%d</c_pop3_port>\n", config.c_pop3_port);
+       cprintf("<c_smtp_port>%d</c_smtp_port>\n", config.c_smtp_port);
+       cprintf("<c_rfc822_strict_from>%d</c_rfc822_strict_from>\n", config.c_rfc822_strict_from);
+       cprintf("<c_aide_zap>%d</c_aide_zap>\n", config.c_aide_zap);
+       cprintf("<c_imap_port>%d</c_imap_port>\n", config.c_imap_port);
+       cprintf("<c_net_freq>%ld</c_net_freq>\n", config.c_net_freq);
+       cprintf("<c_disable_newu>%d</c_disable_newu>\n", config.c_disable_newu);
+       cprintf("<c_enable_fulltext>%d</c_enable_fulltext>\n", config.c_enable_fulltext);
+       client_write("<c_baseroom>", 12);       xml_strout(config.c_baseroom);          client_write("</c_baseroom>\n", 14);
+       client_write("<c_aideroom>", 12);       xml_strout(config.c_aideroom);          client_write("</c_aideroom>\n", 14);
+       cprintf("<c_purge_hour>%d</c_purge_hour>\n", config.c_purge_hour);
+       cprintf("<c_mbxep_expire_mode>%d</c_mbxep_expire_mode>\n", config.c_mbxep.expire_mode);
+       cprintf("<c_mbxep_expire_value>%d</c_mbxep_expire_value>\n", config.c_mbxep.expire_value);
+       client_write("<c_ldap_host>", 13);      xml_strout(config.c_ldap_host);         client_write("</c_ldap_host>\n", 15);
+       cprintf("<c_ldap_port>%d</c_ldap_port>\n", config.c_ldap_port);
+       client_write("<c_ldap_base_dn>", 16);   xml_strout(config.c_ldap_base_dn);      client_write("</c_ldap_base_dn>\n", 18);
+       client_write("<c_ldap_bind_dn>", 16);   xml_strout(config.c_ldap_bind_dn);      client_write("</c_ldap_bind_dn>\n", 18);
+       client_write("<c_ldap_bind_pw>", 16);   xml_strout(config.c_ldap_bind_pw);      client_write("</c_ldap_bind_pw>\n", 18);
+       cprintf("<c_msa_port>%d</c_msa_port>\n", config.c_msa_port);
+       cprintf("<c_imaps_port>%d</c_imaps_port>\n", config.c_imaps_port);
+       cprintf("<c_pop3s_port>%d</c_pop3s_port>\n", config.c_pop3s_port);
+       cprintf("<c_smtps_port>%d</c_smtps_port>\n", config.c_smtps_port);
+       cprintf("<c_auto_cull>%d</c_auto_cull>\n", config.c_auto_cull);
+       cprintf("<c_allow_spoofing>%d</c_allow_spoofing>\n", config.c_allow_spoofing);
+       cprintf("<c_journal_email>%d</c_journal_email>\n", config.c_journal_email);
+       cprintf("<c_journal_pubmsgs>%d</c_journal_pubmsgs>\n", config.c_journal_pubmsgs);
+       client_write("<c_journal_dest>", 16);   xml_strout(config.c_journal_dest);      client_write("</c_journal_dest>\n", 18);
+       client_write("<c_default_cal_zone>", 20);       xml_strout(config.c_default_cal_zone);  client_write("</c_default_cal_zone>\n", 22);
+       cprintf("<c_pftcpdict_port>%d</c_pftcpdict_port>\n", config.c_pftcpdict_port);
+       cprintf("<c_managesieve_port>%d</c_managesieve_port>\n", config.c_managesieve_port);
+       cprintf("<c_auth_mode>%d</c_auth_mode>\n", config.c_auth_mode);
+       client_write("<c_funambol_host>", 17);  xml_strout(config.c_funambol_host);     client_write("</c_funambol_host>\n", 19);
+       cprintf("<c_funambol_port>%d</c_funambol_port>\n", config.c_funambol_port);
+       client_write("<c_funambol_source>", 19);        xml_strout(config.c_funambol_source);   client_write("</c_funambol_source>\n", 21);
+       client_write("<c_funambol_auth>", 17);  xml_strout(config.c_funambol_auth);     client_write("</c_funambol_auth>\n", 19);
+       cprintf("<c_rbl_at_greeting>%d</c_rbl_at_greeting>\n", config.c_rbl_at_greeting);
+       client_write("<c_master_user>", 15);    xml_strout(config.c_master_user);               client_write("</c_master_user>\n", 17);
+       client_write("<c_master_pass>", 15);    xml_strout(config.c_master_pass);               client_write("</c_master_pass>\n", 17);
+       client_write("<c_pager_program>", 17);  xml_strout(config.c_pager_program);             client_write("</c_pager_program>\n", 19);
+       cprintf("<c_imap_keep_from>%d</c_imap_keep_from>\n", config.c_imap_keep_from);
+       cprintf("<c_xmpp_c2s_port>%d</c_xmpp_c2s_port>\n", config.c_xmpp_c2s_port);
+       cprintf("<c_xmpp_s2s_port>%d</c_xmpp_s2s_port>\n", config.c_xmpp_s2s_port);
+       cprintf("<c_pop3_fetch>%ld</c_pop3_fetch>\n", config.c_pop3_fetch);
+       cprintf("<c_pop3_fastest>%ld</c_pop3_fastest>\n", config.c_pop3_fastest);
+       cprintf("<c_spam_flag_only>%d</c_spam_flag_only>\n", config.c_spam_flag_only);
+       cprintf("<c_nntp_port>%d</c_nntp_port>\n", config.c_nntp_port);
+       cprintf("<c_nntps_port>%d</c_nntps_port>\n", config.c_nntps_port);
        client_write("</config>\n", 10);
        cprintf("<progress>%d</progress>\n", 1);
        
@@ -445,7 +516,7 @@ void migr_do_export(void) {
        cprintf("<control_flags>%u</control_flags>\n", CitControl.MMflags);
        cprintf("<control_nextuser>%ld</control_nextuser>\n", CitControl.MMnextuser);
        cprintf("<control_nextroom>%ld</control_nextroom>\n", CitControl.MMnextroom);
-       cprintf("<control_version>%d</control_version>\n", CitControl.MM_hosted_upgrade_level);
+       cprintf("<control_version>%d</control_version>\n", CitControl.version);
        client_write("</control>\n", 11);
        cprintf("<progress>%d</progress>\n", 2);
 
@@ -543,30 +614,97 @@ void migr_xml_start(void *data, const char *el, const char **attr) {
                memset(&smi, 0, sizeof (struct MetaData));
                import_msgnum = 0;
        }
-       else if (!strcasecmp(el, "config")) {
-               we_are_currently_importing_config = 1;
-       }
 
 }
 
 
 int migr_config(void *data, const char *el)
 {
-
-       /* FIXME FIXME FIXME FIXME FIXME write a config importer and put it here */
-
-       return 0; /* if string was not found */
-       return 1; /* if string was found */
+       if (!strcasecmp(el, "c_nodename"))                      SET_CFGSTRBUF(c_nodename, migr_chardata);
+       else if (!strcasecmp(el, "c_fqdn"))                     SET_CFGSTRBUF(c_fqdn, migr_chardata);
+       else if (!strcasecmp(el, "c_humannode"))                SET_CFGSTRBUF(c_humannode, migr_chardata);
+       else if (!strcasecmp(el, "c_phonenum"))                 SET_CFGSTRBUF(c_phonenum, migr_chardata);
+       else if (!strcasecmp(el, "c_ctdluid"))                  config.c_ctdluid = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_creataide"))                config.c_creataide = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_sleeping"))                 config.c_sleeping = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_initax"))                   config.c_initax = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_regiscall"))                config.c_regiscall = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_twitdetect"))               config.c_twitdetect = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_twitroom"))                 SET_CFGSTRBUF(c_twitroom, migr_chardata);
+       else if (!strcasecmp(el, "c_moreprompt"))               SET_CFGSTRBUF(c_moreprompt, migr_chardata);
+       else if (!strcasecmp(el, "c_restrict"))                 config.c_restrict = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_site_location"))            SET_CFGSTRBUF(c_site_location, migr_chardata);
+       else if (!strcasecmp(el, "c_sysadm"))                   SET_CFGSTRBUF(c_sysadm, migr_chardata);
+       else if (!strcasecmp(el, "c_maxsessions"))              config.c_maxsessions = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_ip_addr"))                  SET_CFGSTRBUF(c_ip_addr, migr_chardata);
+       else if (!strcasecmp(el, "c_port_number"))              config.c_port_number = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_ep_expire_mode"))           config.c_ep.expire_mode = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_ep_expire_value"))          config.c_ep.expire_value = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_userpurge"))                config.c_userpurge = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_roompurge"))                config.c_roompurge = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_logpages"))                 SET_CFGSTRBUF(c_logpages, migr_chardata);
+       else if (!strcasecmp(el, "c_createax"))                 config.c_createax = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_maxmsglen"))                config.c_maxmsglen = atol(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_min_workers"))              config.c_min_workers = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_max_workers"))              config.c_max_workers = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_pop3_port"))                config.c_pop3_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_smtp_port"))                config.c_smtp_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_rfc822_strict_from"))       config.c_rfc822_strict_from = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_aide_zap"))                 config.c_aide_zap = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_imap_port"))                config.c_imap_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_net_freq"))                 config.c_net_freq = atol(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_disable_newu"))             config.c_disable_newu = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_enable_fulltext"))          config.c_enable_fulltext = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_baseroom"))                 SET_CFGSTRBUF(c_baseroom, migr_chardata);
+       else if (!strcasecmp(el, "c_aideroom"))                 SET_CFGSTRBUF(c_aideroom, migr_chardata);
+       else if (!strcasecmp(el, "c_purge_hour"))               config.c_purge_hour = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_mbxep_expire_mode"))        config.c_mbxep.expire_mode = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_mbxep_expire_value"))       config.c_mbxep.expire_value = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_ldap_host"))                SET_CFGSTRBUF(c_ldap_host, migr_chardata);
+       else if (!strcasecmp(el, "c_ldap_port"))                config.c_ldap_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_ldap_base_dn"))             SET_CFGSTRBUF(c_ldap_base_dn, migr_chardata);
+       else if (!strcasecmp(el, "c_ldap_bind_dn"))             SET_CFGSTRBUF(c_ldap_bind_dn, migr_chardata);
+       else if (!strcasecmp(el, "c_ldap_bind_pw"))             SET_CFGSTRBUF(c_ldap_bind_pw, migr_chardata);
+       else if (!strcasecmp(el, "c_msa_port"))                 config.c_msa_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_imaps_port"))               config.c_imaps_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_pop3s_port"))               config.c_pop3s_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_smtps_port"))               config.c_smtps_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_auto_cull"))                config.c_auto_cull = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_allow_spoofing"))           config.c_allow_spoofing = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_journal_email"))            config.c_journal_email = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_journal_pubmsgs"))          config.c_journal_pubmsgs = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_journal_dest"))             SET_CFGSTRBUF(c_journal_dest, migr_chardata);
+       else if (!strcasecmp(el, "c_default_cal_zone"))         SET_CFGSTRBUF(c_default_cal_zone, migr_chardata);
+       else if (!strcasecmp(el, "c_pftcpdict_port"))           config.c_pftcpdict_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_managesieve_port"))         config.c_managesieve_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_auth_mode"))                config.c_auth_mode = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_funambol_host"))            SET_CFGSTRBUF(c_funambol_host, migr_chardata);
+       else if (!strcasecmp(el, "c_funambol_port"))            config.c_funambol_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_funambol_source"))          SET_CFGSTRBUF(c_funambol_source, migr_chardata);
+       else if (!strcasecmp(el, "c_funambol_auth"))            SET_CFGSTRBUF(c_funambol_auth, migr_chardata);
+       else if (!strcasecmp(el, "c_rbl_at_greeting"))          config.c_rbl_at_greeting = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_master_user"))              SET_CFGSTRBUF(c_master_user, migr_chardata);
+       else if (!strcasecmp(el, "c_master_pass"))              SET_CFGSTRBUF(c_master_pass, migr_chardata);
+       else if (!strcasecmp(el, "c_pager_program"))            SET_CFGSTRBUF(c_pager_program, migr_chardata);
+       else if (!strcasecmp(el, "c_imap_keep_from"))           config.c_imap_keep_from = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_xmpp_c2s_port"))            config.c_xmpp_c2s_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_xmpp_s2s_port"))            config.c_xmpp_s2s_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_pop3_fetch"))               config.c_pop3_fetch = atol(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_pop3_fastest"))             config.c_pop3_fastest = atol(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_spam_flag_only"))           config.c_spam_flag_only = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_nntp_port"))                config.c_nntp_port = atoi(ChrPtr(migr_chardata));
+       else if (!strcasecmp(el, "c_nntps_port"))               config.c_nntps_port = atoi(ChrPtr(migr_chardata));
+       else return 0;
+       return 1; /* Found above...*/
 }
 
-
 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_version"))            CitControl.version = atoi(ChrPtr(migr_chardata));
 
        else if (!strcasecmp(el, "control")) {
                CitControl.MMfulltext = (-1L);  /* always flush */
@@ -656,8 +794,6 @@ int migr_visitrecord(void *data, const char *el)
        else return 0;
        return 1;
 }
-
-
 void migr_xml_end(void *data, const char *el)
 {
        const char *ptr;
@@ -681,17 +817,15 @@ void migr_xml_end(void *data, const char *el)
 
        /*** CONFIG ***/
 
-       if (!strcasecmp(el, "config"))
-       {
-               CtdlSetConfigInt("c_enable_fulltext", 0);       /* always disable */
-               we_are_currently_importing_config = 0;
+       if (!strcasecmp(el, "config")) {
+               config.c_enable_fulltext = 0;   /* always disable */
+               put_config();
                syslog(LOG_INFO, "Completed import of server configuration\n");
        }
 
-       else if (we_are_currently_importing_config)
-       {
-               migr_config(data, el);
-       }
+       else if ((!strncasecmp(el, HKEY("c_"))) && 
+                migr_config(data, el))
+               ; /* Nothing to do anymore */
                
        /*** CONTROL ***/
        else if ((!strncasecmp(el, HKEY("control"))) && 
index cff00a7ae883a02aa09672df92f74f3c959fa787..6abd80cf10a80bb82a46cc3fa3f6b4540bff27ee 100644 (file)
@@ -5,15 +5,21 @@
  * is available at http://www.mrtg.org that can fetch data using external
  * scripts.  This module supplies data in the format expected by MRTG.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
+ *  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.
+ *  
+ *  
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  
+ *  
+ *  
  */
 
 #include "sysdep.h"
@@ -72,7 +78,7 @@ void mrtg_output(long value1, long value2) {
        cprintf("%ld\n", value2);
        cprintf("%d days, %d hours, %d minutes\n",
                uptime_days, uptime_hours, uptime_minutes);
-       cprintf("%s\n", CtdlGetConfigStr("c_humannode"));
+       cprintf("%s\n", config.c_humannode);
        cprintf("000\n");
 }
 
index 30b92b7203c89e4e6d7b84eb726fb8754551cade..c4038869f7613a414fad4ab8de92bbfd62cf41bc 100644 (file)
@@ -2,7 +2,7 @@
  * This module handles shared rooms, inter-Citadel mail, and outbound
  * mailing list processing.
  *
- * Copyright (c) 2000-2015 by the citadel.org team
+ * Copyright (c) 2000-2012 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.
@@ -218,7 +218,7 @@ void network_deliver_digest(SpoolControl *sc)
 
        /* Where do we want bounces and other noise to be heard?
         * Surely not the list members! */
-       snprintf(bounce_to, sizeof bounce_to, "room_aide@%s", CtdlGetConfigStr("c_fqdn"));
+       snprintf(bounce_to, sizeof bounce_to, "room_aide@%s", config.c_fqdn);
 
        /* Now submit the message */
        valid = validate_recipients(ChrPtr(sc->Users[digestrecp]), NULL, 0);
@@ -366,7 +366,7 @@ void network_deliver_list(struct CtdlMessage *msg, SpoolControl *sc, const char
 
        /* Where do we want bounces and other noise to be heard?
         *  Surely not the list members! */
-       snprintf(bounce_to, sizeof bounce_to, "room_aide@%s", CtdlGetConfigStr("c_fqdn"));
+       snprintf(bounce_to, sizeof bounce_to, "room_aide@%s", config.c_fqdn);
 
        /* Now submit the message */
        valid = validate_recipients(ChrPtr(sc->Users[listrecp]), NULL, 0);
@@ -403,8 +403,8 @@ void network_process_participate(SpoolControl *sc, struct CtdlMessage *omsg, lon
         */
        ok_to_participate = 0;
        if (!CM_IsEmpty(msg, eNodeName)) {
-               if (!strcasecmp(msg->cm_fields[eNodeName], CtdlGetConfigStr("c_nodename")))
-               {
+               if (!strcasecmp(msg->cm_fields[eNodeName],
+                               config.c_nodename)) {
                        ok_to_participate = 1;
                }
                
index 9698c3694f1f3aceb4f3100459a539505601f4f5..0edb1f11efa0e240bcf7c7c3d79ead11d21b3934 100644 (file)
@@ -2,15 +2,15 @@
  * This module handles shared rooms, inter-Citadel mail, and outbound
  * mailing list processing.
  *
- * Copyright (c) 2000-2015 by the citadel.org team
+ * Copyright (c) 2000-2012 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.
+ *  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.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  *
  * ** NOTE **   A word on the S_NETCONFIGS semaphore:
  * This is a fairly high-level type of critical section.  It ensures that no
@@ -168,10 +168,10 @@ void Netmap_AddMe(struct CtdlMessage *msg, const char *defl, long defllen)
        if (CM_IsEmpty(msg, eMessagePath)) {
                CM_SetField(msg, eMessagePath, defl, defllen);
        }
-       node_len = strlen(CtdlGetConfigStr("c_nodename"));
+       node_len = configlen.c_nodename;
        if (node_len >= SIZ) 
                node_len = SIZ - 1;
-       memcpy(buf, CtdlGetConfigStr("c_nodename"), node_len);
+       memcpy(buf, config.c_nodename, node_len);
        buf[node_len] = '!';
        buf[node_len + 1] = '\0';
        CM_PrependToField(msg, eMessagePath, buf, node_len + 1);
@@ -307,7 +307,7 @@ void CalcListID(SpoolControl *sc)
                StrBufAppendBufPlain(sc->ListID, HKEY("room_"), 0);
                StrBufAppendBuf(sc->ListID, RoomName, 0);
                StrBufAppendBufPlain(sc->ListID, HKEY("."), 0);
-               StrBufAppendBufPlain(sc->ListID, CtdlGetConfigStr("c_fqdn"), -1, 0);
+               StrBufAppendBufPlain(sc->ListID, config.c_fqdn, -1, 0);
                /*
                 * this used to be:
                 * roomname <Room-Number.list-id.fqdn>
@@ -325,7 +325,7 @@ void CalcListID(SpoolControl *sc)
                StrBufAppendBufPlain(sc->Users[roommailalias], HKEY("room_"), 0);
                StrBufAppendBuf(sc->Users[roommailalias], RoomName, 0);
                StrBufAppendBufPlain(sc->Users[roommailalias], HKEY("@"), 0);
-               StrBufAppendBufPlain(sc->Users[roommailalias], CtdlGetConfigStr("c_fqdn"), -1, 0);
+               StrBufAppendBufPlain(sc->Users[roommailalias], config.c_fqdn, -1, 0);
 
                StrBufLowerCase(sc->Users[roommailalias]);
        }
@@ -374,7 +374,8 @@ void network_spoolout_room(SpoolControl *sc)
        }
        else
        {
-               snprintf(buf, sizeof buf, "room_%s@%s", CCC->room.QRname, CtdlGetConfigStr("c_fqdn"));
+               snprintf(buf, sizeof buf, "room_%s@%s",
+                        CCC->room.QRname, config.c_fqdn);
        }
 
        for (i=0; buf[i]; ++i) {
@@ -484,7 +485,7 @@ void network_process_buffer(char *buffer, long size, HashList *working_ignetcfg,
 
        /* Check for message routing */
        if (!CM_IsEmpty(msg, eDestination)) {
-               if (strcasecmp(msg->cm_fields[eDestination], CtdlGetConfigStr("c_nodename"))) {
+               if (strcasecmp(msg->cm_fields[eDestination], config.c_nodename)) {
 
                        /* route the message */
                        Buf = NewStrBufPlain(CM_KEY(msg,eDestination));
index 58d2094afc13cedaf8de96e4f0f7928c7a7bdd13..9fa82734e8a278d52ba71bf5669164250177b36c 100644 (file)
@@ -2,15 +2,15 @@
  * This module handles shared rooms, inter-Citadel mail, and outbound
  * mailing list processing.
  *
- * Copyright (c) 2000-2015 by the citadel.org team
+ * Copyright (c) 2000-2012 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.
+ *  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.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  *
  * ** NOTE **   A word on the S_NETCONFIGS semaphore:
  * This is a fairly high-level type of critical section.  It ensures that no
@@ -359,7 +359,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason)
 
        if (msg == NULL) return;
 
-       snprintf(bouncesource, sizeof bouncesource, "%s@%s", BOUNCESOURCE, CtdlGetConfigStr("c_nodename"));
+       snprintf(bouncesource, sizeof bouncesource, "%s@%s", BOUNCESOURCE, config.c_nodename);
 
        /* 
         * Give it a fresh message ID
@@ -369,8 +369,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason)
                       (long)time(NULL),
                       (long)getpid(),
                       ++serialnum,
-                      CtdlGetConfigStr("c_fqdn")
-       );
+                      config.c_fqdn);
 
        CM_SetField(msg, emessageId, buf, len);
 
@@ -392,7 +391,7 @@ void network_bounce(struct CtdlMessage *msg, char *reason)
                       msg->cm_fields[eNodeName]);
 
        CM_SetField(msg, eAuthor, HKEY(BOUNCESOURCE));
-       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+       CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
        CM_SetField(msg, eMsgSubject, HKEY("Delivery Status Notification (Failure)"));
 
        Netmap_AddMe(msg, HKEY("unknown_user"));
@@ -403,15 +402,14 @@ void network_bounce(struct CtdlMessage *msg, char *reason)
                free_recipients(valid);
                valid = NULL;
        }
-       if ( (valid == NULL) || (!strcasecmp(recipient, bouncesource)) )
-       {
-               strcpy(force_room, CtdlGetConfigStr("c_aideroom"));
+       if ( (valid == NULL) || (!strcasecmp(recipient, bouncesource)) ) {
+               strcpy(force_room, config.c_aideroom);
        }
        else {
                strcpy(force_room, "");
        }
        if ( (valid == NULL) && IsEmptyStr(force_room) ) {
-               strcpy(force_room, CtdlGetConfigStr("c_aideroom"));
+               strcpy(force_room, config.c_aideroom);
        }
        CtdlSubmitMsg(msg, valid, force_room, 0);
 
@@ -444,11 +442,10 @@ void network_do_queue(void)
         * Run the full set of processing tasks no more frequently
         * than once every n seconds
         */
-       if ( (time(NULL) - last_run) < CtdlGetConfigLong("c_net_freq") )
-       {
+       if ( (time(NULL) - last_run) < config.c_net_freq ) {
                full_processing = 0;
                syslog(LOG_DEBUG, "Network full processing in %ld seconds.\n",
-                      CtdlGetConfigLong("c_net_freq") - (time(NULL)- last_run)
+                      config.c_net_freq - (time(NULL)- last_run)
                );
        }
 
index 0fe749d337a8a2aef81e3f653a32eb3ad24dda39..34ea669e5d6e8edf357f816fffad9dc65e57e621 100644 (file)
@@ -2,15 +2,15 @@
  * This module handles shared rooms, inter-Citadel mail, and outbound
  * mailing list processing.
  *
- * Copyright (c) 2000-2015 by the citadel.org team
+ * Copyright (c) 2000-2012 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.
+ *  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.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  *
  * ** NOTE **   A word on the S_NETCONFIGS semaphore:
  * This is a fairly high-level type of critical section.  It ensures that no
@@ -256,7 +256,7 @@ eNextState NWC_SendAuth(AsyncNetworker *NW)
        SetNWCState(IO, eNWCVSAuth);
        /* We're talking to the correct node.  Now identify ourselves. */
        StrBufPrintf(NW->IO.SendBuf.Buf, "NETP %s|%s\n", 
-                    CtdlGetConfigStr("c_nodename")
+                    config.c_nodename
                     ChrPtr(NW->secret));
        NWC_DBG_SEND();
        return eSendReply;
@@ -1117,11 +1117,10 @@ void network_do_clientqueue(void)
         * Run the full set of processing tasks no more frequently
         * than once every n seconds
         */
-       if ( (time(NULL) - last_run) < CtdlGetConfigLong("c_net_freq") )
-       {
+       if ( (time(NULL) - last_run) < config.c_net_freq ) {
                full_processing = 0;
                syslog(LOG_DEBUG, "Network full processing in %ld seconds.\n",
-                       CtdlGetConfigLong("c_net_freq") - (time(NULL)- last_run)
+                       config.c_net_freq - (time(NULL)- last_run)
                );
        }
 
index 15f91d466a9e6c3c6c680252b3ce8a78623e0260..b5b91db791b8d02a1bb98212088a60005266633d 100644 (file)
@@ -1,7 +1,7 @@
 //
 // NNTP server module (RFC 3977)
 //
-// Copyright (c) 2014-2015 by the citadel.org team
+// Copyright (c) 2014 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.
@@ -200,7 +200,7 @@ void nntp_greeting(void)
        }
 
        // Display the standard greeting
-       cprintf("200 %s NNTP Citadel server is not finished yet\r\n", CtdlGetConfigStr("c_fqdn"));
+       cprintf("200 %s NNTP Citadel server is not finished yet\r\n", config.c_fqdn);
 }
 
 
@@ -284,7 +284,7 @@ void nntp_authinfo_user(const char *username)
                cprintf("482 Already logged in\r\n");
                return;
        case login_too_many_users:
-               cprintf("481 Too many users are already online (maximum is %d)\r\n", CtdlGetConfigInt("c_maxsessions"));
+               cprintf("481 Too many users are already online (maximum is %d)\r\n", config.c_maxsessions);
                return;
        case login_ok:
                cprintf("381 Password required for %s\r\n", CC->curr_user);
@@ -1178,7 +1178,7 @@ CTDL_MODULE_INIT(nntp)
 {
        if (!threading)
        {
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_nntp_port"),
+               CtdlRegisterServiceHook(config.c_nntp_port,
                                        NULL,
                                        nntp_greeting,
                                        nntp_command_loop,
@@ -1186,7 +1186,7 @@ CTDL_MODULE_INIT(nntp)
                                        CitadelServiceNNTP);
 
 #ifdef HAVE_OPENSSL
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_nntps_port"),
+               CtdlRegisterServiceHook(config.c_nntps_port,
                                        NULL,
                                        nntps_greeting,
                                        nntp_command_loop,
index 748da3bed81af4be1ee30a0e849bb4275ec343d5..d43448d8d1eb4fd7f80201475e994c3771d1406c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This is an implementation of OpenID 2.0 relying party support in stateless mode.
  *
- * Copyright (c) 2007-2015 by the citadel.org team
+ * Copyright (c) 2007-2012 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 as published by
@@ -211,7 +211,7 @@ void cmd_oidl(char *argbuf) {
        struct cdbdata *cdboi;
        long usernum = 0L;
 
-       if (CtdlGetConfigInt("c_disable_newu"))
+       if (config.c_disable_newu)
        {
                cprintf("%d this system does not support openid.\n",
                        ERROR + CMD_NOT_SUPPORTED);
@@ -243,7 +243,7 @@ void cmd_oida(char *argbuf) {
        long usernum;
        struct ctdluser usbuf;
 
-       if (CtdlGetConfigInt("c_disable_newu"))
+       if (config.c_disable_newu)
        {
                cprintf("%d this system does not support openid.\n",
                        ERROR + CMD_NOT_SUPPORTED);
@@ -278,7 +278,7 @@ void cmd_oida(char *argbuf) {
 void cmd_oidc(char *argbuf) {
        ctdl_openid *oiddata = (ctdl_openid *) CC->openid_data;
 
-       if (CtdlGetConfigInt("c_disable_newu"))
+       if (config.c_disable_newu)
        {
                cprintf("%d this system does not support openid.\n",
                        ERROR + CMD_NOT_SUPPORTED);
@@ -311,7 +311,7 @@ void cmd_oidd(char *argbuf) {
        int this_is_mine = 0;
        long usernum = 0L;
 
-       if (CtdlGetConfigInt("c_disable_newu"))
+       if (config.c_disable_newu)
        {
                cprintf("%d this system does not support openid.\n",
                        ERROR + CMD_NOT_SUPPORTED);
@@ -358,8 +358,8 @@ int openid_create_user_via_ax(StrBuf *claimed_id, HashList *sreg_keys)
        const char *Key;
        void *Value;
 
-       if (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) return(1);
-       if (CtdlGetConfigInt("c_disable_newu")) return(2);
+       if (config.c_auth_mode != AUTHMODE_NATIVE) return(1);
+       if (config.c_disable_newu) return(2);
        if (CC->logged_in) return(3);
 
        HashPos *HashPos = GetNewHashPos(sreg_keys, 0);
@@ -553,12 +553,12 @@ CURL *ctdl_openid_curl_easy_init(char *errmsg) {
        curl_easy_setopt(curl, CURLOPT_TIMEOUT, 30);            /* die after 30 seconds */
 
        if (
-               (!IsEmptyStr(CtdlGetConfigStr("c_ip_addr")))
-               && (strcmp(CtdlGetConfigStr("c_ip_addr"), "*"))
-               && (strcmp(CtdlGetConfigStr("c_ip_addr"), "::"))
-               && (strcmp(CtdlGetConfigStr("c_ip_addr"), "0.0.0.0"))
+               (!IsEmptyStr(config.c_ip_addr))
+               && (strcmp(config.c_ip_addr, "*"))
+               && (strcmp(config.c_ip_addr, "::"))
+               && (strcmp(config.c_ip_addr, "0.0.0.0"))
        ) {
-               curl_easy_setopt(curl, CURLOPT_INTERFACE, CtdlGetConfigStr("c_ip_addr"));
+               curl_easy_setopt(curl, CURLOPT_INTERFACE, config.c_ip_addr);
        }
 
        return(curl);
@@ -832,7 +832,7 @@ void cmd_oids(char *argbuf) {
        ctdl_openid *oiddata;
        int discovery_succeeded = 0;
 
-       if (CtdlGetConfigInt("c_disable_newu"))
+       if (config.c_disable_newu)
        {
                cprintf("%d this system does not support openid.\n",
                        ERROR + CMD_NOT_SUPPORTED);
@@ -963,7 +963,7 @@ void cmd_oidf(char *argbuf) {
        void *Value;
        ctdl_openid *oiddata = (ctdl_openid *) CC->openid_data;
 
-       if (CtdlGetConfigInt("c_disable_newu"))
+       if (config.c_disable_newu)
        {
                cprintf("%d this system does not support openid.\n",
                        ERROR + CMD_NOT_SUPPORTED);
@@ -1108,7 +1108,7 @@ void cmd_oidf(char *argbuf) {
                         * If this system does not allow self-service new user registration, the
                         * remaining modes do not apply, so fail here and now.
                         */
-                       else if (CtdlGetConfigInt("c_disable_newu")) {
+                       else if (config.c_disable_newu) {
                                cprintf("fail\n");
                                syslog(LOG_DEBUG, "Creating user failed due to local policy");
                        }
@@ -1169,7 +1169,7 @@ CTDL_MODULE_INIT(openid_rp)
 // evcurl call this for us. curl_global_init(CURL_GLOBAL_ALL);
 
                /* Only enable the OpenID command set when native mode authentication is in use. */
-               if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_NATIVE) {
+               if (config.c_auth_mode == AUTHMODE_NATIVE) {
                        CtdlRegisterProtoHook(cmd_oids, "OIDS", "Setup OpenID authentication");
                        CtdlRegisterProtoHook(cmd_oidf, "OIDF", "Finalize OpenID authentication");
                        CtdlRegisterProtoHook(cmd_oidl, "OIDL", "List OpenIDs associated with an account");
index 13230126320254368a75848633b13f2487d1a2a4..d3e3e0b50efea70002f649b28b3d4fdea1e0ffb5 100644 (file)
@@ -1,15 +1,21 @@
 /*
  * POP3 service for the Citadel system
  *
- * Copyright (c) 1998-2015 by the citadel.org team
+ * Copyright (c) 1998-2012 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.
+ *  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.
+ *  
+ *  
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  
+ *  
+ *  
  *
  * Current status of standards conformance:
  *
@@ -715,14 +721,14 @@ CTDL_MODULE_INIT(pop3)
        {
                CtdlRegisterDebugFlagHook(HKEY("pop3srv"), SetPOP3DebugEnabled, &POP3DebugEnabled);
 
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_pop3_port"),
+               CtdlRegisterServiceHook(config.c_pop3_port,
                                        NULL,
                                        pop3_greeting,
                                        pop3_command_loop,
                                        NULL,
                                        CitadelServicePop3);
 #ifdef HAVE_OPENSSL
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_pop3s_port"),
+               CtdlRegisterServiceHook(config.c_pop3s_port,
                                        NULL,
                                        pop3s_greeting,
                                        pop3_command_loop,
index f7587b7f27a9c95c9012fec225f84f59183805ab..950436dd8ed65d5eaa4954b5cdbba915efc9af56 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Consolidate mail from remote POP3 accounts.
  *
- * Copyright (c) 2007-2015 by the citadel.org team
+ * Copyright (c) 2007-2011 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 as published
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
 #include <stdlib.h>
@@ -568,7 +572,7 @@ eNextState POP3C_ReadMessageBodyFollowing(pop3aggr *RecvMsg)
        if (!POP3C_OK) return eTerminateConnection;
        RecvMsg->IO.ReadMsg = NewAsyncMsg(HKEY("."),
                                          RecvMsg->CurrMsg->MSGSize,
-                                         CtdlGetConfigLong("c_maxmsglen"),
+                                         config.c_maxmsglen,
                                          NULL, -1,
                                          1);
 
@@ -1144,10 +1148,10 @@ void pop3client_scan(void) {
 
        become_session(&pop3_client_CC);
 
-       if (CtdlGetConfigLong("c_pop3_fastest") < CtdlGetConfigLong("c_pop3_fetch"))
-               fastest_scan = CtdlGetConfigLong("c_pop3_fastest");
+       if (config.c_pop3_fastest < config.c_pop3_fetch)
+               fastest_scan = config.c_pop3_fastest;
        else
-               fastest_scan = CtdlGetConfigLong("c_pop3_fetch");
+               fastest_scan = config.c_pop3_fetch;
 
        /*
         * Run POP3 aggregation no more frequently than once every n seconds
@@ -1180,7 +1184,7 @@ void pop3client_scan(void) {
 
 /*
        if ((palist->interval && time(NULL) > (last_run + palist->interval))
-                       || (time(NULL) > last_run + CtdlGetConfigLong("c_pop3_fetch")))
+                       || (time(NULL) > last_run + config.c_pop3_fetch))
                        pop3_do_fetching(palist->roomname, palist->pop3host,
                        palist->pop3user, palist->pop3pass, palist->keep);
                pptr = palist;
index ac4e7da7d0e35c27e3b520f29abfdf871c31ffa3..cc03230c9bccc3c3fcaa0dd22327b274477804f4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Bring external RSS feeds into rooms.
  *
- * Copyright (c) 2007-2015 by the citadel.org team
+ * Copyright (c) 2007-2012 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.
@@ -365,7 +365,7 @@ int rss_format_item(AsyncIO *IO, networker_save_message *SaveMsg)
                CM_SetField(&SaveMsg->Msg, eAuthor, HKEY("rss"));
        }
 
-       CM_SetField(&SaveMsg->Msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+       CM_SetField(&SaveMsg->Msg, eNodeName, CFG_KEY(c_nodename));
        if (SaveMsg->title != NULL) {
                long len;
                char *Sbj;
index ddb1e99ba06afd2e3ef40016dee3aa21e1f48a8b..ed69de8587f600d5cb00a265cc63d3085a7f9b32 100644 (file)
@@ -2,7 +2,7 @@
  * This module glues libSieve to the Citadel server in order to implement
  * the Sieve mailbox filtering language (RFC 3028).
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
@@ -626,7 +626,7 @@ void sieve_do_msg(long msgnum, void *userdata) {
        }
        if (haschar(my.envelope_from, '@') == 0) {
                strcat(my.envelope_from, "@");
-               strcat(my.envelope_from, CtdlGetConfigStr("c_fqdn"));
+               strcat(my.envelope_from, config.c_fqdn);
        }
 
        /* Keep track of the envelope-to address (use body-to if not found) */
@@ -652,7 +652,7 @@ void sieve_do_msg(long msgnum, void *userdata) {
        }
        if (haschar(my.envelope_to, '@') == 0) {
                strcat(my.envelope_to, "@");
-               strcat(my.envelope_to, CtdlGetConfigStr("c_fqdn"));
+               strcat(my.envelope_to, config.c_fqdn);
        }
 
        CM_Free(msg);
@@ -1185,7 +1185,7 @@ void cmd_msiv(char *argbuf) {
                extract_token(script_name, argbuf, 1, '|', sizeof script_name);
                if (!IsEmptyStr(script_name)) {
                        cprintf("%d Transmit script now\n", SEND_LISTING);
-                       script_content = CtdlReadMessageBody(HKEY("000"), CtdlGetConfigLong("c_maxmsglen"), NULL, 0, 0);
+                       script_content = CtdlReadMessageBody(HKEY("000"), config.c_maxmsglen, NULL, 0, 0);
                        msiv_putscript(&u, script_name, script_content);
                        changes_made = 1;
                }
index 63422fbdcfd92127f52e57d2e2ce62ea79e8ad57..a93bb438e384231052681d5ac4346aba074e8feb 100644 (file)
@@ -20,7 +20,7 @@
  * The VRFY and EXPN commands have been removed from this implementation
  * because nobody uses these commands anymore, except for spammers.
  *
- * Copyright (c) 1998-2015 by the citadel.org team
+ * Copyright (c) 1998-2013 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.
@@ -154,7 +154,7 @@ void smtp_greeting(int is_msa)
        /* If this config option is set, reject connections from problem
         * addresses immediately instead of after they execute a RCPT
         */
-       if ( (CtdlGetConfigInt("c_rbl_at_greeting")) && (sSMTP->is_msa == 0) ) {
+       if ( (config.c_rbl_at_greeting) && (sSMTP->is_msa == 0) ) {
                if (rbl_check(message_to_spammer)) {
                        if (server_shutting_down)
                                cprintf("421 %s\r\n", message_to_spammer);
@@ -178,7 +178,7 @@ void smtp_greeting(int is_msa)
        /* Note: the FQDN *must* appear as the first thing after the 220 code.
         * Some clients (including citmail.c) depend on it being there.
         */
-       cprintf("220 %s ESMTP Citadel server ready.\r\n", CtdlGetConfigStr("c_fqdn"));
+       cprintf("220 %s ESMTP Citadel server ready.\r\n", config.c_fqdn);
 }
 
 
@@ -284,7 +284,7 @@ void smtp_hello(long offset, long which_command)
                        cprintf("250-Greetings and joyous salutations.\r\n");
                }
                cprintf("250-HELP\r\n");
-               cprintf("250-SIZE %ld\r\n", CtdlGetConfigLong("c_maxmsglen"));
+               cprintf("250-SIZE %ld\r\n", config.c_maxmsglen);
 
 #ifdef HAVE_OPENSSL
                /*
@@ -674,7 +674,7 @@ void smtp_mail(long offset, long flags) {
        /* Otherwise, make sure outsiders aren't trying to forge mail from
         * this system (unless, of course, c_allow_spoofing is enabled)
         */
-       else if (CtdlGetConfigInt("c_allow_spoofing") == 0) {
+       else if (config.c_allow_spoofing == 0) {
                process_rfc822_addr(ChrPtr(sSMTP->from), user, node, name);
                syslog(LOG_DEBUG, "Claimed envelope sender is '%s' == '%s' @ '%s' ('%s')",
                        ChrPtr(sSMTP->from), user, node, name
@@ -730,7 +730,7 @@ void smtp_rcpt(long offset, long flags)
        /* RBL check */
        if ( (!CCC->logged_in)  /* Don't RBL authenticated users */
           && (!sSMTP->is_lmtp) ) {     /* Don't RBL LMTP clients */
-               if (CtdlGetConfigInt("c_rbl_at_greeting") == 0) {       /* Don't RBL again if we already did it */
+               if (config.c_rbl_at_greeting == 0) {    /* Don't RBL again if we already did it */
                        if (rbl_check(message_to_spammer)) {
                                if (server_shutting_down)
                                        cprintf("421 %s\r\n", message_to_spammer);
@@ -826,7 +826,7 @@ void smtp_data(long offset, long flags)
                                "       by %s; %s\n",
                                ChrPtr(sSMTP->helo_node),
                                (long int) CCC->cs_UDSclientUID,
-                               CtdlGetConfigStr("c_fqdn"),
+                               config.c_fqdn,
                                nowstamp);
                }
                else {
@@ -837,11 +837,11 @@ void smtp_data(long offset, long flags)
                                ChrPtr(sSMTP->helo_node),
                                CCC->cs_host,
                                CCC->cs_addr,
-                               CtdlGetConfigStr("c_fqdn"),
+                               config.c_fqdn,
                                nowstamp);
                }
        }
-       body = CtdlReadMessageBodyBuf(HKEY("."), CtdlGetConfigLong("c_maxmsglen"), defbody, 1, NULL);
+       body = CtdlReadMessageBodyBuf(HKEY("."), config.c_maxmsglen, defbody, 1, NULL);
        FreeStrBuf(&defbody);
        if (body == NULL) {
                cprintf("550 Unable to save message: internal error.\r\n");
@@ -861,12 +861,12 @@ void smtp_data(long offset, long flags)
         * to something ugly like "0000058008.Sent Items>" when the message
         * is read with a Citadel client.
         */
-       if ( (CCC->logged_in) && (CtdlGetConfigInt("c_rfc822_strict_from") != CFG_SMTP_FROM_NOFILTER) ) {
+       if ( (CCC->logged_in) && (config.c_rfc822_strict_from != CFG_SMTP_FROM_NOFILTER) ) {
                int validemail = 0;
                
                if (!CM_IsEmpty(msg, erFc822Addr)       &&
-                   ((CtdlGetConfigInt("c_rfc822_strict_from") == CFG_SMTP_FROM_CORRECT) || 
-                    (CtdlGetConfigInt("c_rfc822_strict_from") == CFG_SMTP_FROM_REJECT)    )  )
+                   ((config.c_rfc822_strict_from == CFG_SMTP_FROM_CORRECT) || 
+                    (config.c_rfc822_strict_from == CFG_SMTP_FROM_REJECT)    )  )
                {
                        if (!IsEmptyStr(CCC->cs_inet_email))
                                validemail = strcmp(CCC->cs_inet_email, msg->cm_fields[erFc822Addr]) == 0;
@@ -884,14 +884,14 @@ void smtp_data(long offset, long flags)
                        }
                }
 
-               if (!validemail && (CtdlGetConfigInt("c_rfc822_strict_from") == CFG_SMTP_FROM_REJECT)) {
+               if (!validemail && (config.c_rfc822_strict_from == CFG_SMTP_FROM_REJECT)) {
                        syslog(LOG_ERR, "invalid sender '%s' - rejecting this message", msg->cm_fields[erFc822Addr]);
                        cprintf("550 Invalid sender '%s' - rejecting this message.\r\n", msg->cm_fields[erFc822Addr]);
                        return;
                }
 
-               CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
-               CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode")));
+               CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
+               CM_SetField(msg, eHumanNode, CFG_KEY(c_humannode));
                CM_SetField(msg, eOriginalRoom, HKEY(MAILROOM));
                if (sSMTP->preferred_sender_name != NULL)
                        CM_SetField(msg, eAuthor, SKEY(sSMTP->preferred_sender_name));
@@ -1143,7 +1143,7 @@ CTDL_MODULE_INIT(smtp)
 #endif
 
 
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_smtp_port"),        /* SMTP MTA */
+               CtdlRegisterServiceHook(config.c_smtp_port,     /* SMTP MTA */
                                        NULL,
                                        smtp_mta_greeting,
                                        smtp_command_loop,
@@ -1151,7 +1151,7 @@ CTDL_MODULE_INIT(smtp)
                                        CitadelServiceSMTP_MTA);
 
 #ifdef HAVE_OPENSSL
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_smtps_port"),       /* SMTPS MTA */
+               CtdlRegisterServiceHook(config.c_smtps_port,
                                        NULL,
                                        smtps_greeting,
                                        smtp_command_loop,
@@ -1159,7 +1159,7 @@ CTDL_MODULE_INIT(smtp)
                                        CitadelServiceSMTPS_MTA);
 #endif
 
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_msa_port"),         /* SMTP MSA */
+               CtdlRegisterServiceHook(config.c_msa_port,      /* SMTP MSA */
                                        NULL,
                                        smtp_msa_greeting,
                                        smtp_command_loop,
index a38dbe74262bf71c9ae7c3b3b42ca4aa9e46af74..df04bdcc5f713f66ebdb138c9d2bc73ab1067458 100644 (file)
  * The VRFY and EXPN commands have been removed from this implementation
  * because nobody uses these commands anymore, except for spammers.
  *
- * Copyright (c) 1998-2015 by the citadel.org team
+ * Copyright (c) 1998-2012 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.
+ *  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.
+ *  
+ *  
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  
+ *  
+ *  
  */
 
 #include "sysdep.h"
@@ -600,7 +606,7 @@ void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
        boundary = NewStrBufPlain(HKEY("=_Citadel_Multipart_"));
        StrBufAppendPrintf(boundary,
                           "%s_%04x%04x",
-                          CtdlGetConfigStr("c_fqdn"),
+                          config.c_fqdn,
                           getpid(),
                           ++seq);
 
@@ -697,7 +703,7 @@ void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
 
        CM_SetField(bmsg, eOriginalRoom, HKEY(MAILROOM));
        CM_SetField(bmsg, eAuthor, HKEY("Citadel"));
-       CM_SetField(bmsg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+       CM_SetField(bmsg, eNodeName, CFG_KEY(c_nodename));
        CM_SetField(bmsg, eMsgSubject, HKEY("Delivery Status Notification (Failure)"));
        CM_SetAsFieldSB(bmsg, eMesageText, &BounceMB);
 
@@ -719,7 +725,7 @@ void smtpq_do_bounce(OneQueItem *MyQItem, StrBuf *OMsgTxt, ParsedURL *Relay)
 
        /* If not, post it in the Aide> room */
        if (successful_bounce == 0) {
-               CtdlSubmitMsg(bmsg, NULL, CtdlGetConfigStr("c_aideroom"), QP_EADDR);
+               CtdlSubmitMsg(bmsg, NULL, config.c_aideroom, QP_EADDR);
        }
 
        /* Free up the memory we used */
index 960a6e0258a7ff8be83deb99daf87041df1093f7..198649e1f2c00522b2f738b7ee04cbf15e1840ef 100644 (file)
  * RFC 2822 - Internet Message Format
  * RFC 2920 - SMTP Service Extension for Command Pipelining
  *
- * Copyright (c) 1998-2015 by the citadel.org team
+ * Copyright (c) 1998-2012 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.
+ *  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.
+ *  
+ *  
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  
+ *  
+ *  
  */
 
 #include "sysdep.h"
@@ -138,7 +144,8 @@ 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", config.c_fqdn);
 
        SMTP_DBG_SEND();
        return eReadMessage;
@@ -173,7 +180,8 @@ 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", config.c_fqdn);
 
        SMTP_DBG_SEND();
        return eReadMessage;
index 1cca96e3afced7b091e5c96a7c65d051c3c1e209..8609f91133bcd86e71d7c0f73ebeec569fe7fc8e 100644 (file)
  * The VRFY and EXPN commands have been removed from this implementation
  * because nobody uses these commands anymore, except for spammers.
  *
- * Copyright (c) 1998-2015 by the citadel.org team
+ * Copyright (c) 1998-2012 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.
+ *  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.
+ *  
+ *  
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  
+ *  
+ *  
  */
 
 #include "sysdep.h"
@@ -123,7 +129,11 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt)
        strcpy(bounceto, "");
        boundary = NewStrBufPlain(HKEY("=_Citadel_Multipart_"));
 
-       StrBufAppendPrintf(boundary, "%s_%04x%04x", CtdlGetConfigStr("c_fqdn"), getpid(), ++seq);
+       StrBufAppendPrintf(boundary,
+                          "%s_%04x%04x",
+                          config.c_fqdn,
+                          getpid(),
+                          ++seq);
 
        lines = num_tokens(instr, '\n');
 
@@ -153,9 +163,11 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt)
        bmsg->cm_format_type = FMT_RFC822;
        CM_SetField(bmsg, eAuthor, HKEY("Citadel"));
        CM_SetField(bmsg, eOriginalRoom, HKEY(MAILROOM));
-       CM_SetField(bmsg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+       CM_SetField(bmsg, eNodeName, CFG_KEY(c_nodename));
        CM_SetField(bmsg, eMsgSubject, HKEY("Delivery Status Notification (Failure)"));
-       StrBufAppendBufPlain(BounceMB, HKEY("Content-type: multipart/mixed; boundary=\""), 0);
+       StrBufAppendBufPlain(
+               BounceMB,
+               HKEY("Content-type: multipart/mixed; boundary=\""), 0);
        StrBufAppendBuf(BounceMB, boundary, 0);
        StrBufAppendBufPlain(BounceMB, HKEY("\"\r\n"), 0);
        StrBufAppendBufPlain(BounceMB, HKEY("MIME-Version: 1.0\r\n"), 0);
@@ -298,7 +310,7 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt)
 
                /* If not, post it in the Aide> room */
                if (successful_bounce == 0) {
-                       CtdlSubmitMsg(bmsg, NULL, CtdlGetConfigStr("c_aideroom"), QP_EADDR);
+                       CtdlSubmitMsg(bmsg, NULL, config.c_aideroom, QP_EADDR);
                }
 
                /* Free up the memory we used */
index df7f97e77d9a92f96f2c5e35d76218b343dc767d..f9a823d9ed5466994f25500ba924fd253effa8e6 100644 (file)
@@ -4,15 +4,21 @@
  * http://www.spamassassin.org (the SpamAssassin project is not in any way
  * affiliated with the Citadel project).
  *
- * Copyright (c) 1998-2015 by the citadel.org team
+ * Copyright (c) 1998-2012 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.
+ * 
+ * 
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
+ *
+ * 
+ * 
+ * 
  */
 
 #define SPAMASSASSIN_PORT       "783"
@@ -135,8 +141,8 @@ int spam_assassin(struct CtdlMessage *msg, recptypes *recp) {
                 goto bail;
         }
         syslog(LOG_DEBUG, "<%s\n", buf);
-        syslog(LOG_DEBUG, "c_spam_flag_only setting %d\n", CtdlGetConfigInt("c_spam_flag_only"));
-        if (CtdlGetConfigInt("c_spam_flag_only")) {
+        syslog(LOG_DEBUG, "c_spam_flag_only setting %d\n", config.c_spam_flag_only);
+        if (config.c_spam_flag_only) {
                int headerlen;
                char *cur;
                char sastatus[10];
index eadfefb3086a18af2c5d989626f14c10423682e8..085f5f046d1ebca105e936a0ab0ef61e237cf79a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Transparently handle the upgrading of server data formats.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2014 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.
@@ -245,8 +245,8 @@ void guess_time_zone(void) {
        if (fp) {
                if (fgets(buf, sizeof buf, fp) && (strlen(buf) > 2)) {
                        buf[strlen(buf)-1] = 0;
-                       CtdlSetConfigStr("c_default_cal_zone", buf);
-                       syslog(LOG_INFO, "Configuring timezone: %s", buf);
+                       safestrncpy(config.c_default_cal_zone, buf, sizeof config.c_default_cal_zone);
+                       syslog(LOG_INFO, "Configuring timezone: %s", config.c_default_cal_zone);
                }
                fclose(fp);
        }
@@ -260,46 +260,47 @@ void guess_time_zone(void) {
  * Note that if the previous version was 0 then this is a new installation running for the first time.
  */
 void update_config(void) {
+       get_config();
 
-       int oldver = CitControl.MM_hosted_upgrade_level;
-
-       if (oldver < 606) {
-               CtdlSetConfigInt("c_rfc822_strict_from", 0);
+       if (CitControl.version < 606) {
+               config.c_rfc822_strict_from = 0;
        }
 
-       if (oldver < 609) {
-               CtdlSetConfigInt("c_purge_hour", 3);
+       if (CitControl.version < 609) {
+               config.c_purge_hour = 3;
        }
 
-       if (oldver < 615) {
-               CtdlSetConfigInt("c_ldap_port", 389);
+       if (CitControl.version < 615) {
+               config.c_ldap_port = 389;
        }
 
-       if (oldver < 623) {
-               CtdlSetConfigStr("c_ip_addr", "*");
+       if (CitControl.version < 623) {
+               strcpy(config.c_ip_addr, "*");
        }
 
-       if (oldver < 650) {
-               CtdlSetConfigInt("c_enable_fulltext", 1);
+       if (CitControl.version < 650) {
+               config.c_enable_fulltext = 1;
        }
 
-       if (oldver < 652) {
-               CtdlSetConfigInt("c_auto_cull", 1);
+       if (CitControl.version < 652) {
+               config.c_auto_cull = 1;
        }
 
-       if (oldver < 725) {
-               CtdlSetConfigInt("c_xmpp_c2s_port", 5222);
-               CtdlSetConfigInt("c_xmpp_s2s_port", 5269);
+       if (CitControl.version < 725) {
+               config.c_xmpp_c2s_port = 5222;
+               config.c_xmpp_s2s_port = 5269;
        }
 
-       if (oldver < 830) {
-               CtdlSetConfigInt("c_nntp_port", 119);
-               CtdlSetConfigInt("c_nntps_port", 563);
+       if (CitControl.version < 830) {
+               config.c_nntp_port = 119;
+               config.c_nntps_port = 563;
        }
 
-       if (IsEmptyStr(CtdlGetConfigStr("c_default_cal_zone"))) {
+       if (IsEmptyStr(config.c_default_cal_zone)) {
                guess_time_zone();
        }
+
+       put_config();
 }
 
 
@@ -312,11 +313,11 @@ 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)
+               (CitControl.version / 100),
+               (CitControl.version % 100)
        );
 
-       if (CitControl.MM_hosted_upgrade_level < REV_LEVEL) {
+       if (CitControl.version < REV_LEVEL) {
                syslog(LOG_WARNING,
                        "Server hosted updates need to be processed at this time.  Please wait..."
                );
@@ -327,29 +328,29 @@ void check_server_upgrades(void) {
 
        update_config();
 
-       if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 555)) {
+       if ((CitControl.version > 000) && (CitControl.version < 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 ((CitControl.version > 000) && (CitControl.version < 591)) {
                bump_mailbox_generation_numbers();
        }
-       if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 608)) {
+       if ((CitControl.version > 000) && (CitControl.version < 608)) {
                convert_ctdluid_to_minusone();
        }
-       if ((CitControl.MM_hosted_upgrade_level > 000) && (CitControl.MM_hosted_upgrade_level < 659)) {
+       if ((CitControl.version > 000) && (CitControl.version < 659)) {
                rebuild_euid_index();
        }
-       if (CitControl.MM_hosted_upgrade_level < 735) {
+       if (CitControl.version < 735) {
                fix_sys_user_name();
        }
-       if (CitControl.MM_hosted_upgrade_level < 736) {
+       if (CitControl.version < 736) {
                rebuild_usersbynumber();
        }
-       if (CitControl.MM_hosted_upgrade_level < 790) {
+       if (CitControl.version < 790) {
                remove_thread_users();
        }
-       if (CitControl.MM_hosted_upgrade_level < 810) {
+       if (CitControl.version < 810) {
                struct ctdlroom QRoom;
                if (!CtdlGetRoom(&QRoom, SMTP_SPOOLOUT_ROOM)) {
                        QRoom.QRdefaultview = VIEW_QUEUE;
@@ -361,22 +362,22 @@ void check_server_upgrades(void) {
                }
        }
 
-       CitControl.MM_hosted_upgrade_level = REV_LEVEL;
+       CitControl.version = REV_LEVEL;
 
        /*
         * Negative values for maxsessions are not allowed.
         */
-       if (CtdlGetConfigInt("c_maxsessions") < 0) {
-               CtdlSetConfigInt("c_maxsessions", 0);
+       if (config.c_maxsessions < 0) {
+               config.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 (CtdlGetConfigInt("c_ep_mode") == 0) {
-               CtdlSetConfigInt("c_ep_mode", EXPIRE_MANUAL);
-               CtdlSetConfigInt("c_ep_value", 0);
+       if (config.c_ep.expire_mode == 0) {
+               config.c_ep.expire_mode = EXPIRE_MANUAL;
+               config.c_ep.expire_value = 0;
        }
 
        put_control();
index 12e39696d4a9c2554d33a6af8273057a6d94aca2..39820f7762dc7a821609c060995ec6ecb99c77c0 100644 (file)
@@ -2,7 +2,7 @@
  * A server-side module for Citadel which supports address book information
  * using the standard vCard format.
  * 
- * Copyright (c) 1999-2015 by the citadel.org team
+ * Copyright (c) 1999-2012 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.
@@ -385,7 +385,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) {
 
        /* If users cannot create their own accounts, they cannot re-register either. */
        if ( (yes_my_citadel_config) &&
-            (CtdlGetConfigInt("c_disable_newu")) &&
+            (config.c_disable_newu) &&
             (CCC->user.axlevel < AxAideU) &&
             (CCC->vcard_updated_by_ldap==0) )
        {
@@ -433,7 +433,7 @@ int vcard_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) {
        /* Insert or replace RFC2739-compliant free/busy URL */
        if (yes_my_citadel_config) {
                sprintf(buf, "http://%s/%s.vfb",
-                       CtdlGetConfigStr("c_fqdn"),
+                       config.c_fqdn,
                        usbuf.fullname);
                for (i=0; buf[i]; ++i) {
                        if (buf[i] == ' ') buf[i] = '_';
@@ -723,7 +723,7 @@ void cmd_regi(char *argbuf) {
        }
 
        /* If users cannot create their own accounts, they cannot re-register either. */
-       if ( (CtdlGetConfigInt("c_disable_newu")) && (CCC->user.axlevel < AxAideU) ) {
+       if ( (config.c_disable_newu) && (CCC->user.axlevel < AxAideU) ) {
                cprintf("%d Self-service registration is not allowed here.\n",
                        ERROR + HIGHER_ACCESS_REQUIRED);
        }
@@ -865,7 +865,7 @@ void vcard_newuser(struct ctdluser *usbuf) {
 
 #ifdef HAVE_GETPWUID_R
        /* If using host auth mode, we add an email address based on the login */
-       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
+       if (config.c_auth_mode == AUTHMODE_HOST) {
                struct passwd pwd;
                char pwd_buffer[SIZ];
                
@@ -876,7 +876,7 @@ void vcard_newuser(struct ctdluser *usbuf) {
                syslog(LOG_DEBUG, "Searching for uid %d", usbuf->uid);
                if (getpwuid_r(usbuf->uid, &pwd, pwd_buffer, sizeof pwd_buffer, &result) == 0) {
 #endif // HAVE_GETPWUID_R
-                       snprintf(buf, sizeof buf, "%s@%s", pwd.pw_name, CtdlGetConfigStr("c_fqdn"));
+                       snprintf(buf, sizeof buf, "%s@%s", pwd.pw_name, config.c_fqdn);
                        vcard_add_prop(v, "email;internet", buf);
                        need_default_vcard=0;
                }
@@ -889,7 +889,7 @@ void vcard_newuser(struct ctdluser *usbuf) {
         * Is this an LDAP session?  If so, copy various LDAP attributes from the directory entry
         * into the user's vCard.
         */
-       if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
+       if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
             //uid_t ldap_uid;
            int found_user;
             char ldap_cn[512];
@@ -907,7 +907,7 @@ void vcard_newuser(struct ctdluser *usbuf) {
 #endif
        if (need_default_vcard!=0) {
          /* Everyone gets an email address based on their display name */
-         snprintf(buf, sizeof buf, "%s@%s", usbuf->fullname, CtdlGetConfigStr("c_fqdn"));
+         snprintf(buf, sizeof buf, "%s@%s", usbuf->fullname, config.c_fqdn);
          for (i=0; buf[i]; ++i) {
                if (buf[i] == ' ') buf[i] = '_';
          }
@@ -938,7 +938,7 @@ void vcard_purge(struct ctdluser *usbuf) {
        msg->cm_format_type = 0;
        CM_SetField(msg, eAuthor, usbuf->fullname, strlen(usbuf->fullname));
        CM_SetField(msg, eOriginalRoom, HKEY(ADDRESS_BOOK_ROOM));
-       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+       CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
        CM_SetField(msg, eMesageText, HKEY("Purge this vCard\n"));
 
        len = snprintf(buf, sizeof buf, VCARD_EXT_FORMAT,
@@ -1281,7 +1281,7 @@ void vcard_session_login_hook(void) {
         * Is this an LDAP session?  If so, copy various LDAP attributes from the directory entry
         * into the user's vCard.
         */
-       if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
+       if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
                v = vcard_get_user(&CCC->user);
                if (v) {
                        if (Ctdl_LDAP_to_vCard(CCC->ldap_dn, v)) {
@@ -1553,7 +1553,7 @@ CTDL_MODULE_INIT(vcard)
                }
 
                /* for postfix tcpdict */
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_pftcpdict_port"),   /* Postfix */
+               CtdlRegisterServiceHook(config.c_pftcpdict_port,        /* Postfix */
                                        NULL,
                                        check_get_greeting,
                                        check_get,
index 269777c944419fedd52b17db1009bba002c56c7a..79845fa8a341d0d25cbc24521b8138bbac54f1b5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Server-side module for Wiki rooms.  This handles things like version control. 
  * 
- * Copyright (c) 2009-2015 by the citadel.org team
+ * Copyright (c) 2009-2012 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.
@@ -303,7 +303,7 @@ int wiki_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) {
                                           uuid,
                                           Now,
                                           CCC->user.fullname,
-                                          CtdlGetConfigStr("c_nodename"));
+                                          config.c_nodename);
 
                        memolen = CtdlEncodeBase64(encoded_memo, memo, memolen, 0);
 
@@ -643,7 +643,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
                        CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
                        CM_SetField(msg, erFc822Addr, CCC->cs_inet_email, strlen(CCC->cs_inet_email));
                        CM_SetField(msg, eOriginalRoom, CCC->room.QRname, strlen(CCC->room.QRname));
-                       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+                       CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
                        CM_SetField(msg, eExclusiveID, pagename, strlen(pagename));
                        msgnum = CtdlSubmitMsg(msg, NULL, "", 0);       /* Replace the current revision */
                }
index 36b1d33ce998be92d06b708a6272cbaac6f13954..64dc8b7aa2f4e723a1d8a75be85e536506a546b1 100644 (file)
@@ -668,7 +668,7 @@ extern void xmpp_cleanup_events(void);
 CTDL_MODULE_INIT(xmpp)
 {
        if (!threading) {
-               CtdlRegisterServiceHook(CtdlGetConfigInt("c_xmpp_c2s_port"),
+               CtdlRegisterServiceHook(config.c_xmpp_c2s_port,
                                        NULL,
                                        xmpp_greeting,
                                        xmpp_command_loop,
index b36228e273791b158af6a14be93ad96d5f305fc2..d716d4b1a3b39b9bd4f35e3be040653dd51e23c9 100644 (file)
@@ -158,7 +158,7 @@ void xmpp_destroy_buddy(char *presence_jid, int aggressively) {
        );
        cprintf("<query xmlns=\"jabber:iq:roster\">");
        cprintf("<item jid=\"%s\" subscription=\"remove\">", xmlesc(xmlbuf1, presence_jid, sizeof xmlbuf1));
-       cprintf("<group>%s</group>", xmlesc(xmlbuf1, CtdlGetConfigStr("c_humannode"), sizeof xmlbuf1));
+       cprintf("<group>%s</group>", xmlesc(xmlbuf1, config.c_humannode, sizeof xmlbuf1));
        cprintf("</item>");
        cprintf("</query>"
                "</iq>"
index 848fcc735897a79eceeab0c876098c399638155b..df7671798a280cbccf6f04756c08fb5845315ca0 100644 (file)
@@ -61,7 +61,7 @@ void xmpp_roster_item(struct CitContext *cptr) {
                xmlesc(xmlbuf1, cptr->cs_inet_email, sizeof xmlbuf1),
                xmlesc(xmlbuf2, cptr->user.fullname, sizeof xmlbuf2)
        );
-       cprintf("<group>%s</group>", xmlesc(xmlbuf1, CtdlGetConfigStr("c_humannode"), sizeof xmlbuf1));
+       cprintf("<group>%s</group>", xmlesc(xmlbuf1, config.c_humannode, sizeof xmlbuf1));
        cprintf("</item>");
 }
 
index 494dbeea9b8fdc196e1404b30584edc3488e57d4..ddc12aafdba517bfa33030a5873582455138d836 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Implements the message store.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
@@ -22,7 +22,6 @@
 #include "ctdl_module.h"
 #include "citserver.h"
 #include "control.h"
-#include "config.h"
 #include "clientsocket.h"
 #include "genstamp.h"
 #include "room_ops.h"
@@ -1819,7 +1818,7 @@ void OutputRFC822MsgHeaders(
                                if (haschar(mptr, '@') == 0)
                                {
                                        sanitize_truncated_recipient(mptr);
-                                       cprintf("To: %s@%s", mptr, CtdlGetConfigStr("c_fqdn"));
+                                       cprintf("To: %s@%s", mptr, config.c_fqdn);
                                        cprintf("%s", nl);
                                }
                                else
@@ -2167,7 +2166,7 @@ int CtdlOutputPreLoadedMsg(
        strcpy(suser, "");
        strcpy(luser, "");
        strcpy(fuser, "");
-       memcpy(snode, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")) + 1);
+       memcpy(snode, CFG_KEY(c_nodename) + 1);
        if (mode == MT_RFC822) 
                OutputRFC822MsgHeaders(
                        TheMessage,
@@ -2508,7 +2507,7 @@ long send_message(struct CtdlMessage *msg) {
        msgidbuflen = snprintf(msgidbuf, sizeof msgidbuf, "%08lX-%08lX@%s",
                               (long unsigned int) time(NULL),
                               (long unsigned int) newmsgid,
-                              CtdlGetConfigStr("c_fqdn")
+                              config.c_fqdn
                );
 
        /* Generate an ID if we don't have one already */
@@ -2768,7 +2767,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        if (TWITDETECT) {
                if (CCC->user.axlevel == AxProbU) {
                        strcpy(hold_rm, actual_rm);
-                       strcpy(actual_rm, CtdlGetConfigStr("c_twitroom"));
+                       strcpy(actual_rm, config.c_twitroom);
                        MSGM_syslog(LOG_DEBUG, "Diverting to twit room\n");
                }
        }
@@ -2851,7 +2850,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        if ((!CCC->internal_pgm) || (recps == NULL)) {
                if (CtdlSaveMsgPointerInRoom(actual_rm, newmsgid, 1, msg) != 0) {
                        MSGM_syslog(LOG_ERR, "ERROR saving message pointer!\n");
-                       CtdlSaveMsgPointerInRoom(CtdlGetConfigStr("c_aideroom"), newmsgid, 0, msg);
+                       CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
                }
        }
 
@@ -2880,7 +2879,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
        {
                if (CCC->logged_in) 
                        snprintf(bounce_to, sizeof bounce_to, "%s@%s",
-                                CCC->user.fullname, CtdlGetConfigStr("c_nodename"));
+                                CCC->user.fullname, config.c_nodename);
                else 
                        snprintf(bounce_to, sizeof bounce_to, "%s@%s",
                                 msg->cm_fields[eAuthor], msg->cm_fields[eNodeName]);
@@ -2913,7 +2912,7 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,       /* message to save */
                        }
                        else {
                                MSG_syslog(LOG_DEBUG, "No user <%s>\n", recipient);
-                               CtdlSaveMsgPointerInRoom(CtdlGetConfigStr("c_aideroom"), newmsgid, 0, msg);
+                               CtdlSaveMsgPointerInRoom(config.c_aideroom, newmsgid, 0, msg);
                        }
                }
                recps->recp_local = pch;
@@ -2958,13 +2957,13 @@ long CtdlSubmitMsg(struct CtdlMessage *msg,     /* message to save */
        }
        else {
                if (recps == NULL) {
-                       qualified_for_journaling = CtdlGetConfigInt("c_journal_pubmsgs");
+                       qualified_for_journaling = config.c_journal_pubmsgs;
                }
                else if (recps->num_local + recps->num_ignet + recps->num_internet > 0) {
-                       qualified_for_journaling = CtdlGetConfigInt("c_journal_email");
+                       qualified_for_journaling = config.c_journal_email;
                }
                else {
-                       qualified_for_journaling = CtdlGetConfigInt("c_journal_pubmsgs");
+                       qualified_for_journaling = config.c_journal_pubmsgs;
                }
        }
 
@@ -3027,7 +3026,7 @@ void quickie_message(const char *from,
 
        if (fromaddr != NULL) CM_SetField(msg, erFc822Addr, fromaddr, strlen(fromaddr));
        if (room != NULL) CM_SetField(msg, eOriginalRoom, room, strlen(room));
-       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
+       CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
        if (to != NULL) {
                CM_SetField(msg, eRecipient, to, strlen(to));
                recp = validate_recipients(to, NULL, 0);
@@ -3500,8 +3499,8 @@ struct CtdlMessage *CtdlMakeMessageLen(
                CM_SetField(msg, eOriginalRoom, CCC->room.QRname, strlen(CCC->room.QRname));
        }
 
-       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
-       CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode")));
+       CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
+       CM_SetField(msg, eHumanNode, CFG_KEY(c_humannode));
 
        if (rcplen > 0) {
                CM_SetField(msg, eRecipient, recipient, rcplen);
@@ -3553,7 +3552,7 @@ struct CtdlMessage *CtdlMakeMessageLen(
        }
        else {
                StrBuf *MsgBody;
-               MsgBody = CtdlReadMessageBodyBuf(HKEY("000"), CtdlGetConfigLong("c_maxmsglen"), NULL, 0, 0);
+               MsgBody = CtdlReadMessageBodyBuf(HKEY("000"), config.c_maxmsglen, NULL, 0, 0);
                if (MsgBody != NULL) {
                        CM_SetAsFieldSB(msg, eMesageText, &MsgBody);
                }
@@ -4034,8 +4033,8 @@ void CtdlWriteObject(char *req_room,                      /* Room to stuff it in */
        msg->cm_format_type = 4;
        CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
        CM_SetField(msg, eOriginalRoom, req_room, strlen(req_room));
-       CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename")));
-       CM_SetField(msg, eHumanNode, CtdlGetConfigStr("c_humannode"), strlen(CtdlGetConfigStr("c_humannode")));
+       CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
+       CM_SetField(msg, eHumanNode, CFG_KEY(c_humannode));
        msg->cm_flags = flags;
        
        CM_SetAsFieldSB(msg, eMesageText, &encoded_message);
index 14fe8be507fd25cfa7e262e68dde1f92820426e2..3161b11003bbff3ad471401f3536b179fc459f22 100644 (file)
@@ -262,7 +262,7 @@ int SaveRoomNetConfigFile(OneRoomNetCfg *OneRNCfg, char *filename)
        else {
                OutBuffer = NewStrBuf();
                CfgIt = GetNewHashPos(CfgTypeHash, 1);
-               fchown(TmpFD, ctdluid, 0);
+               fchown(TmpFD, config.c_ctdluid, 0);
                for (eCfg = subpending; eCfg < maxRoomNetCfg; eCfg ++)
                {
                        const CfgLineType *pCfg;
index f26fd4a4b052a259617b7fadb8c2611e66ac36a3..85440207731cf32d74a5c4cc83d42a12dcc4f7ab 100644 (file)
@@ -1,19 +1,19 @@
-/* A Bison parser, made by GNU Bison 3.0.2.  */
+/* A Bison parser, made by GNU Bison 2.5.  */
 
 /* Bison implementation for Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989-1990, 2000-2013 Free Software Foundation, Inc.
-
+   
+      Copyright (C) 1984, 1989-1990, 2000-2011 Free Software Foundation, Inc.
+   
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
-
+   
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-
+   
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
@@ -26,7 +26,7 @@
    special exception, which will cause the skeleton and the resulting
    Bison output files to be licensed under the GNU General Public
    License without this special exception.
-
+   
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
@@ -44,7 +44,7 @@
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.0.2"
+#define YYBISON_VERSION "2.5"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
 /* Pull parsers.  */
 #define YYPULL 1
 
+/* Using locations.  */
+#define YYLSP_NEEDED 0
 
 
 
 /* Copy the first part of user declarations.  */
-#line 1 "parsedate.y" /* yacc.c:339  */
+
+/* Line 268 of yacc.c  */
+#line 1 "parsedate.y"
 
 /* $Revision$
 **
@@ -175,15 +179,14 @@ static time_t     yyRelSeconds;
 
 static void            date_error(char *);
 
-#line 179 "y.tab.c" /* yacc.c:339  */
 
-# ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
-#  else
-#   define YY_NULLPTR 0
-#  endif
-# endif
+/* Line 268 of yacc.c  */
+#line 185 "y.tab.c"
+
+/* Enabling traces.  */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
 
 /* Enabling verbose error messages.  */
 #ifdef YYERROR_VERBOSE
@@ -193,30 +196,28 @@ static void               date_error(char *);
 # define YYERROR_VERBOSE 0
 #endif
 
-
-/* Debug traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int yydebug;
+/* Enabling the token table.  */
+#ifndef YYTOKEN_TABLE
+# define YYTOKEN_TABLE 0
 #endif
 
-/* Token type.  */
+
+/* Tokens.  */
 #ifndef YYTOKENTYPE
 # define YYTOKENTYPE
-  enum yytokentype
-  {
-    tDAY = 258,
-    tDAYZONE = 259,
-    tMERIDIAN = 260,
-    tMONTH = 261,
-    tMONTH_UNIT = 262,
-    tSEC_UNIT = 263,
-    tSNUMBER = 264,
-    tUNUMBER = 265,
-    tZONE = 266
-  };
+   /* Put the tokens into the symbol table, so that GDB and other debuggers
+      know about them.  */
+   enum yytokentype {
+     tDAY = 258,
+     tDAYZONE = 259,
+     tMERIDIAN = 260,
+     tMONTH = 261,
+     tMONTH_UNIT = 262,
+     tSEC_UNIT = 263,
+     tSNUMBER = 264,
+     tUNUMBER = 265,
+     tZONE = 266
+   };
 #endif
 /* Tokens.  */
 #define tDAY 258
@@ -229,32 +230,35 @@ extern int yydebug;
 #define tUNUMBER 265
 #define tZONE 266
 
-/* Value type.  */
+
+
+
 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE YYSTYPE;
-union YYSTYPE
+typedef union YYSTYPE
 {
-#line 114 "parsedate.y" /* yacc.c:355  */
+
+/* Line 293 of yacc.c  */
+#line 114 "parsedate.y"
 
     time_t             Number;
     enum _MERIDIAN     Meridian;
 
-#line 243 "y.tab.c" /* yacc.c:355  */
-};
+
+
+/* Line 293 of yacc.c  */
+#line 250 "y.tab.c"
+} YYSTYPE;
 # define YYSTYPE_IS_TRIVIAL 1
+# define yystype YYSTYPE /* obsolescent; will be withdrawn */
 # define YYSTYPE_IS_DECLARED 1
 #endif
 
 
-extern YYSTYPE yylval;
-
-int yyparse (void);
-
-
-
 /* Copy the second part of user declarations.  */
 
-#line 258 "y.tab.c" /* yacc.c:358  */
+
+/* Line 343 of yacc.c  */
+#line 262 "y.tab.c"
 
 #ifdef short
 # undef short
@@ -268,8 +272,11 @@ typedef unsigned char yytype_uint8;
 
 #ifdef YYTYPE_INT8
 typedef YYTYPE_INT8 yytype_int8;
-#else
+#elif (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 typedef signed char yytype_int8;
+#else
+typedef short int yytype_int8;
 #endif
 
 #ifdef YYTYPE_UINT16
@@ -289,7 +296,8 @@ typedef short int yytype_int16;
 #  define YYSIZE_T __SIZE_TYPE__
 # elif defined size_t
 #  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
+# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 #  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
@@ -303,68 +311,39 @@ typedef short int yytype_int16;
 # if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(Msgid) dgettext ("bison-runtime", Msgid)
+#   define YY_(msgid) dgettext ("bison-runtime", msgid)
 #  endif
 # endif
 # ifndef YY_
-#  define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__                                               \
-      && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__)))  \
-     || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-#  define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-#  define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE   YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
+#  define YY_(msgid) msgid
 # endif
 #endif
 
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
+# define YYUSE(e) ((void) (e))
 #else
-# define YYUSE(E) /* empty */
+# define YYUSE(e) /* empty */
 #endif
 
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized.  */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
-    _Pragma ("GCC diagnostic push") \
-    _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
-    _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
-    _Pragma ("GCC diagnostic pop")
+/* Identity function, used to suppress warnings about constant conditions.  */
+#ifndef lint
+# define YYID(n) (n)
 #else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+static int
+YYID (int yyi)
+#else
+static int
+YYID (yyi)
+    int yyi;
 #endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+{
+  return yyi;
+}
 #endif
 
-
 #if ! defined yyoverflow || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
@@ -382,9 +361,9 @@ typedef short int yytype_int16;
 #    define alloca _alloca
 #   else
 #    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
+#    if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 #     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-      /* Use EXIT_SUCCESS as a witness for stdlib.h.  */
 #     ifndef EXIT_SUCCESS
 #      define EXIT_SUCCESS 0
 #     endif
@@ -394,8 +373,8 @@ typedef short int yytype_int16;
 # endif
 
 # ifdef YYSTACK_ALLOC
-   /* Pacify GCC's 'empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+   /* Pacify GCC's `empty if-body' warning.  */
+#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
 #  ifndef YYSTACK_ALLOC_MAXIMUM
     /* The OS might guarantee only one guard page at the bottom of the stack,
        and a page size can be as small as 4096 bytes.  So we cannot safely
@@ -411,7 +390,7 @@ typedef short int yytype_int16;
 #  endif
 #  if (defined __cplusplus && ! defined EXIT_SUCCESS \
        && ! ((defined YYMALLOC || defined malloc) \
-             && (defined YYFREE || defined free)))
+            && (defined YYFREE || defined free)))
 #   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
 #   ifndef EXIT_SUCCESS
 #    define EXIT_SUCCESS 0
@@ -419,13 +398,15 @@ typedef short int yytype_int16;
 #  endif
 #  ifndef YYMALLOC
 #   define YYMALLOC malloc
-#   if ! defined malloc && ! defined EXIT_SUCCESS
+#   if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
 #  ifndef YYFREE
 #   define YYFREE free
-#   if ! defined free && ! defined EXIT_SUCCESS
+#   if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 void free (void *); /* INFRINGES ON USER NAME SPACE */
 #   endif
 #  endif
@@ -435,7 +416,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */
 
 #if (! defined yyoverflow \
      && (! defined __cplusplus \
-         || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+        || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
 
 /* A type that is properly aligned for any stack member.  */
 union yyalloc
@@ -460,35 +441,35 @@ union yyalloc
    elements in the stack, and YYPTR gives the new location of the
    stack.  Advance YYPTR to a properly aligned location for the next
    stack.  */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack)                           \
-    do                                                                  \
-      {                                                                 \
-        YYSIZE_T yynewbytes;                                            \
-        YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
-        Stack = &yyptr->Stack_alloc;                                    \
-        yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-        yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                 \
-    while (0)
+# define YYSTACK_RELOCATE(Stack_alloc, Stack)                          \
+    do                                                                 \
+      {                                                                        \
+       YYSIZE_T yynewbytes;                                            \
+       YYCOPY (&yyptr->Stack_alloc, Stack, yysize);                    \
+       Stack = &yyptr->Stack_alloc;                                    \
+       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
+       yyptr += yynewbytes / sizeof (*yyptr);                          \
+      }                                                                        \
+    while (YYID (0))
 
 #endif
 
 #if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST.  The source and destination do
+/* Copy COUNT objects from FROM to TO.  The source and destination do
    not overlap.  */
 # ifndef YYCOPY
 #  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(Dst, Src, Count) \
-      __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
+#   define YYCOPY(To, From, Count) \
+      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
 #  else
-#   define YYCOPY(Dst, Src, Count)              \
-      do                                        \
-        {                                       \
-          YYSIZE_T yyi;                         \
-          for (yyi = 0; yyi < (Count); yyi++)   \
-            (Dst)[yyi] = (Src)[yyi];            \
-        }                                       \
-      while (0)
+#   define YYCOPY(To, From, Count)             \
+      do                                       \
+       {                                       \
+         YYSIZE_T yyi;                         \
+         for (yyi = 0; yyi < (Count); yyi++)   \
+           (To)[yyi] = (From)[yyi];            \
+       }                                       \
+      while (YYID (0))
 #  endif
 # endif
 #endif /* !YYCOPY_NEEDED */
@@ -504,19 +485,17 @@ union yyalloc
 #define YYNNTS  9
 /* YYNRULES -- Number of rules.  */
 #define YYNRULES  30
-/* YYNSTATES -- Number of states.  */
+/* YYNRULES -- Number of states.  */
 #define YYNSTATES  44
 
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
+/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
 #define YYMAXUTOK   266
 
-#define YYTRANSLATE(YYX)                                                \
+#define YYTRANSLATE(YYX)                                               \
   ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
+/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
 static const yytype_uint8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -549,7 +528,32 @@ static const yytype_uint8 yytranslate[] =
 };
 
 #if YYDEBUG
-  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
+/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
+   YYRHS.  */
+static const yytype_uint8 yyprhs[] =
+{
+       0,     0,     3,     4,     7,     9,    12,    14,    16,    19,
+      24,    29,    36,    43,    45,    47,    50,    52,    54,    58,
+      64,    67,    72,    75,    79,    85,    88,    91,    94,    97,
+      98
+};
+
+/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
+static const yytype_int8 yyrhs[] =
+{
+      16,     0,    -1,    -1,    16,    17,    -1,    18,    -1,    18,
+      19,    -1,    21,    -1,    22,    -1,    10,    23,    -1,    10,
+      12,    10,    23,    -1,    10,    12,    10,    20,    -1,    10,
+      12,    10,    12,    10,    23,    -1,    10,    12,    10,    12,
+      10,    20,    -1,    11,    -1,     4,    -1,    11,    20,    -1,
+      20,    -1,     9,    -1,    10,    13,    10,    -1,    10,    13,
+      10,    13,    10,    -1,     6,    10,    -1,     6,    10,    14,
+      10,    -1,    10,     6,    -1,    10,     6,    10,    -1,     3,
+      14,    10,     6,    10,    -1,     9,     8,    -1,    10,     8,
+      -1,     9,     7,    -1,    10,     7,    -1,    -1,     5,    -1
+};
+
+/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
        0,   128,   128,   129,   132,   141,   145,   148,   153,   165,
@@ -559,7 +563,7 @@ static const yytype_uint16 yyrline[] =
 };
 #endif
 
-#if YYDEBUG || YYERROR_VERBOSE || 0
+#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
 /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
    First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
 static const char *const yytname[] =
@@ -567,13 +571,13 @@ static const char *const yytname[] =
   "$end", "error", "$undefined", "tDAY", "tDAYZONE", "tMERIDIAN",
   "tMONTH", "tMONTH_UNIT", "tSEC_UNIT", "tSNUMBER", "tUNUMBER", "tZONE",
   "':'", "'/'", "','", "$accept", "spec", "item", "time", "zone",
-  "numzone", "date", "rel", "o_merid", YY_NULLPTR
+  "numzone", "date", "rel", "o_merid", 0
 };
 #endif
 
 # ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
-   (internal) symbol number NUM (which must be that of a token).  */
+/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
+   token YYLEX-NUM.  */
 static const yytype_uint16 yytoknum[] =
 {
        0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
@@ -581,30 +585,27 @@ static const yytype_uint16 yytoknum[] =
 };
 # endif
 
-#define YYPACT_NINF -29
-
-#define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-29)))
-
-#define YYTABLE_NINF -1
-
-#define yytable_value_is_error(Yytable_value) \
-  0
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
+static const yytype_uint8 yyr1[] =
+{
+       0,    15,    16,    16,    17,    17,    17,    17,    18,    18,
+      18,    18,    18,    19,    19,    19,    19,    20,    21,    21,
+      21,    21,    21,    21,    21,    22,    22,    22,    22,    23,
+      23
+};
 
-  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-     STATE-NUM.  */
-static const yytype_int8 yypact[] =
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
+static const yytype_uint8 yyr2[] =
 {
-     -29,     1,   -29,   -11,    11,    20,    12,   -29,     4,   -29,
-     -29,    13,    16,   -29,   -29,   -29,    21,   -29,   -29,    22,
-      23,   -29,   -29,   -29,     5,   -29,   -29,    28,    25,   -29,
-      17,    24,   -29,    26,   -29,    29,   -29,   -29,    30,   -29,
-       0,   -29,   -29,   -29
+       0,     2,     0,     2,     1,     2,     1,     1,     2,     4,
+       4,     6,     6,     1,     1,     2,     1,     1,     3,     5,
+       2,     4,     2,     3,     5,     2,     2,     2,     2,     0,
+       1
 };
 
-  /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
-     Performed when YYTABLE does not specify something else to do.  Zero
-     means the default is an error.  */
+/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
+   Performed when YYTABLE doesn't specify something else to do.  Zero
+   means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
        2,     0,     1,     0,     0,     0,    29,     3,     4,     6,
@@ -614,21 +615,34 @@ static const yytype_uint8 yydefact[] =
       29,    19,    12,    11
 };
 
-  /* YYPGOTO[NTERM-NUM].  */
-static const yytype_int8 yypgoto[] =
+/* YYDEFGOTO[NTERM-NUM].  */
+static const yytype_int8 yydefgoto[] =
 {
-     -29,   -29,   -29,   -29,   -29,   -24,   -29,   -29,   -28
+      -1,     1,     7,     8,    25,    26,     9,    10,    21
 };
 
-  /* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int8 yydefgoto[] =
+/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
+   STATE-NUM.  */
+#define YYPACT_NINF -29
+static const yytype_int8 yypact[] =
 {
-      -1,     1,     7,     8,    25,    26,     9,    10,    21
+     -29,     1,   -29,   -11,    11,    20,    12,   -29,     4,   -29,
+     -29,    13,    16,   -29,   -29,   -29,    21,   -29,   -29,    22,
+      23,   -29,   -29,   -29,     5,   -29,   -29,    28,    25,   -29,
+      17,    24,   -29,    26,   -29,    29,   -29,   -29,    30,   -29,
+       0,   -29,   -29,   -29
 };
 
-  /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
-     positive, shift that token.  If negative, reduce the rule whose
-     number is the opposite.  If YYTABLE_NINF, syntax error.  */
+/* YYPGOTO[NTERM-NUM].  */
+static const yytype_int8 yypgoto[] =
+{
+     -29,   -29,   -29,   -29,   -29,   -24,   -29,   -29,   -28
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
+   positive, shift that token.  If negative, reduce the rule which
+   number is the opposite.  If YYTABLE_NINF, syntax error.  */
+#define YYTABLE_NINF -1
 static const yytype_uint8 yytable[] =
 {
       32,     2,    37,    11,     3,    15,    36,     4,    22,    23,
@@ -638,6 +652,12 @@ static const yytype_uint8 yytable[] =
       41
 };
 
+#define yypact_value_is_default(yystate) \
+  ((yystate) == (-29))
+
+#define yytable_value_is_error(yytable_value) \
+  YYID (0)
+
 static const yytype_int8 yycheck[] =
 {
       24,     0,    30,    14,     3,     5,    30,     6,     4,     9,
@@ -647,8 +667,8 @@ static const yytype_int8 yycheck[] =
       10
 };
 
-  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-     symbol of state STATE-NUM.  */
+/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
+   symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
        0,    16,     0,     3,     6,     9,    10,    17,    18,    21,
@@ -658,59 +678,94 @@ static const yytype_uint8 yystos[] =
       10,    10,    20,    23
 };
 
-  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    15,    16,    16,    17,    17,    17,    17,    18,    18,
-      18,    18,    18,    19,    19,    19,    19,    20,    21,    21,
-      21,    21,    21,    21,    21,    22,    22,    22,    22,    23,
-      23
-};
-
-  /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     0,     2,     1,     2,     1,     1,     2,     4,
-       4,     6,     6,     1,     1,     2,     1,     1,     3,     5,
-       2,     4,     2,     3,     5,     2,     2,     2,     2,     0,
-       1
-};
-
+#define yyerrok                (yyerrstatus = 0)
+#define yyclearin      (yychar = YYEMPTY)
+#define YYEMPTY                (-2)
+#define YYEOF          0
+
+#define YYACCEPT       goto yyacceptlab
+#define YYABORT                goto yyabortlab
+#define YYERROR                goto yyerrorlab
+
+
+/* Like YYERROR except do call yyerror.  This remains here temporarily
+   to ease the transition to the new meaning of YYERROR, for GCC.
+   Once GCC version 2 has supplanted version 1, this can go.  However,
+   YYFAIL appears to be in use.  Nevertheless, it is formally deprecated
+   in Bison 2.4.2's NEWS entry, where a plan to phase it out is
+   discussed.  */
+
+#define YYFAIL         goto yyerrlab
+#if defined YYFAIL
+  /* This is here to suppress warnings from the GCC cpp's
+     -Wunused-macros.  Normally we don't worry about that warning, but
+     some users do, and we want to make it easy for users to remove
+     YYFAIL uses, which will produce warnings from Bison 2.5.  */
+#endif
 
-#define yyerrok         (yyerrstatus = 0)
-#define yyclearin       (yychar = YYEMPTY)
-#define YYEMPTY         (-2)
-#define YYEOF           0
+#define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYACCEPT        goto yyacceptlab
-#define YYABORT         goto yyabortlab
-#define YYERROR         goto yyerrorlab
+#define YYBACKUP(Token, Value)                                 \
+do                                                             \
+  if (yychar == YYEMPTY && yylen == 1)                         \
+    {                                                          \
+      yychar = (Token);                                                \
+      yylval = (Value);                                                \
+      YYPOPSTACK (1);                                          \
+      goto yybackup;                                           \
+    }                                                          \
+  else                                                         \
+    {                                                          \
+      yyerror (YY_("syntax error: cannot back up")); \
+      YYERROR;                                                 \
+    }                                                          \
+while (YYID (0))
+
+
+#define YYTERROR       1
+#define YYERRCODE      256
+
+
+/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
+   If N is 0, then set CURRENT to the empty location which ends
+   the previous symbol: RHS[0] (always defined).  */
+
+#define YYRHSLOC(Rhs, K) ((Rhs)[K])
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N)                               \
+    do                                                                 \
+      if (YYID (N))                                                    \
+       {                                                               \
+         (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
+         (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
+         (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
+         (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
+       }                                                               \
+      else                                                             \
+       {                                                               \
+         (Current).first_line   = (Current).last_line   =              \
+           YYRHSLOC (Rhs, 0).last_line;                                \
+         (Current).first_column = (Current).last_column =              \
+           YYRHSLOC (Rhs, 0).last_column;                              \
+       }                                                               \
+    while (YYID (0))
+#endif
 
 
-#define YYRECOVERING()  (!!yyerrstatus)
+/* This macro is provided for backward compatibility. */
 
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
+#ifndef YY_LOCATION_PRINT
+# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+#endif
 
-/* Error token number */
-#define YYTERROR        1
-#define YYERRCODE       256
 
+/* YYLEX -- calling `yylex' with the right arguments.  */
 
+#ifdef YYLEX_PARAM
+# define YYLEX yylex (YYLEX_PARAM)
+#else
+# define YYLEX yylex ()
+#endif
 
 /* Enable debugging if requested.  */
 #if YYDEBUG
@@ -720,46 +775,54 @@ while (0)
 #  define YYFPRINTF fprintf
 # endif
 
-# define YYDPRINTF(Args)                        \
-do {                                            \
-  if (yydebug)                                  \
-    YYFPRINTF Args;                             \
-} while (0)
+# define YYDPRINTF(Args)                       \
+do {                                           \
+  if (yydebug)                                 \
+    YYFPRINTF Args;                            \
+} while (YYID (0))
 
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
+# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                   \
+do {                                                                     \
+  if (yydebug)                                                           \
+    {                                                                    \
+      YYFPRINTF (stderr, "%s ", Title);                                          \
+      yy_symbol_print (stderr,                                           \
+                 Type, Value); \
+      YYFPRINTF (stderr, "\n");                                                  \
+    }                                                                    \
+} while (YYID (0))
 
 
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                    \
-do {                                                                      \
-  if (yydebug)                                                            \
-    {                                                                     \
-      YYFPRINTF (stderr, "%s ", Title);                                   \
-      yy_symbol_print (stderr,                                            \
-                  Type, Value); \
-      YYFPRINTF (stderr, "\n");                                           \
-    }                                                                     \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
+/*--------------------------------.
+| Print this symbol on YYOUTPUT.  |
+`--------------------------------*/
 
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_value_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
 {
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
   if (!yyvaluep)
     return;
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
     YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+# else
+  YYUSE (yyoutput);
 # endif
-  YYUSE (yytype);
+  switch (yytype)
+    {
+      default:
+       break;
+    }
 }
 
 
@@ -767,11 +830,22 @@ yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvalue
 | Print this symbol on YYOUTPUT.  |
 `--------------------------------*/
 
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+#else
+static void
+yy_symbol_print (yyoutput, yytype, yyvaluep)
+    FILE *yyoutput;
+    int yytype;
+    YYSTYPE const * const yyvaluep;
+#endif
 {
-  YYFPRINTF (yyoutput, "%s %s (",
-             yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
+  if (yytype < YYNTOKENS)
+    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
+  else
+    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
 
   yy_symbol_value_print (yyoutput, yytype, yyvaluep);
   YYFPRINTF (yyoutput, ")");
@@ -782,8 +856,16 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
 | TOP (included).                                                   |
 `------------------------------------------------------------------*/
 
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 static void
 yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
+#else
+static void
+yy_stack_print (yybottom, yytop)
+    yytype_int16 *yybottom;
+    yytype_int16 *yytop;
+#endif
 {
   YYFPRINTF (stderr, "Stack now");
   for (; yybottom <= yytop; yybottom++)
@@ -794,42 +876,49 @@ yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
   YYFPRINTF (stderr, "\n");
 }
 
-# define YY_STACK_PRINT(Bottom, Top)                            \
-do {                                                            \
-  if (yydebug)                                                  \
-    yy_stack_print ((Bottom), (Top));                           \
-} while (0)
+# define YY_STACK_PRINT(Bottom, Top)                           \
+do {                                                           \
+  if (yydebug)                                                 \
+    yy_stack_print ((Bottom), (Top));                          \
+} while (YYID (0))
 
 
 /*------------------------------------------------.
 | Report that the YYRULE is going to be reduced.  |
 `------------------------------------------------*/
 
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
+yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
+#else
+static void
+yy_reduce_print (yyvsp, yyrule)
+    YYSTYPE *yyvsp;
+    int yyrule;
+#endif
 {
-  unsigned long int yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
+  unsigned long int yylno = yyrline[yyrule];
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-             yyrule - 1, yylno);
+            yyrule - 1, yylno);
   /* The symbols being reduced.  */
   for (yyi = 0; yyi < yynrhs; yyi++)
     {
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr,
-                       yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
-                                              );
+      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
+                      &(yyvsp[(yyi + 1) - (yynrhs)])
+                                      );
       YYFPRINTF (stderr, "\n");
     }
 }
 
-# define YY_REDUCE_PRINT(Rule)          \
-do {                                    \
-  if (yydebug)                          \
-    yy_reduce_print (yyssp, yyvsp, Rule); \
-} while (0)
+# define YY_REDUCE_PRINT(Rule)         \
+do {                                   \
+  if (yydebug)                         \
+    yy_reduce_print (yyvsp, Rule); \
+} while (YYID (0))
 
 /* Nonzero means print parse trace.  It is left uninitialized so that
    multiple parsers can coexist.  */
@@ -843,7 +932,7 @@ int yydebug;
 
 
 /* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef YYINITDEPTH
+#ifndef        YYINITDEPTH
 # define YYINITDEPTH 200
 #endif
 
@@ -866,8 +955,15 @@ int yydebug;
 #   define yystrlen strlen
 #  else
 /* Return the length of YYSTR.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 static YYSIZE_T
 yystrlen (const char *yystr)
+#else
+static YYSIZE_T
+yystrlen (yystr)
+    const char *yystr;
+#endif
 {
   YYSIZE_T yylen;
   for (yylen = 0; yystr[yylen]; yylen++)
@@ -883,8 +979,16 @@ yystrlen (const char *yystr)
 #  else
 /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
    YYDEST.  */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 static char *
 yystpcpy (char *yydest, const char *yysrc)
+#else
+static char *
+yystpcpy (yydest, yysrc)
+    char *yydest;
+    const char *yysrc;
+#endif
 {
   char *yyd = yydest;
   const char *yys = yysrc;
@@ -914,27 +1018,27 @@ yytnamerr (char *yyres, const char *yystr)
       char const *yyp = yystr;
 
       for (;;)
-        switch (*++yyp)
-          {
-          case '\'':
-          case ',':
-            goto do_not_strip_quotes;
-
-          case '\\':
-            if (*++yyp != '\\')
-              goto do_not_strip_quotes;
-            /* Fall through.  */
-          default:
-            if (yyres)
-              yyres[yyn] = *yyp;
-            yyn++;
-            break;
-
-          case '"':
-            if (yyres)
-              yyres[yyn] = '\0';
-            return yyn;
-          }
+       switch (*++yyp)
+         {
+         case '\'':
+         case ',':
+           goto do_not_strip_quotes;
+
+         case '\\':
+           if (*++yyp != '\\')
+             goto do_not_strip_quotes;
+           /* Fall through.  */
+         default:
+           if (yyres)
+             yyres[yyn] = *yyp;
+           yyn++;
+           break;
+
+         case '"':
+           if (yyres)
+             yyres[yyn] = '\0';
+           return yyn;
+         }
     do_not_strip_quotes: ;
     }
 
@@ -957,11 +1061,12 @@ static int
 yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yytype_int16 *yyssp, int yytoken)
 {
-  YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
+  YYSIZE_T yysize0 = yytnamerr (0, yytname[yytoken]);
   YYSIZE_T yysize = yysize0;
+  YYSIZE_T yysize1;
   enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
   /* Internationalized format string. */
-  const char *yyformat = YY_NULLPTR;
+  const char *yyformat = 0;
   /* Arguments of yyformat. */
   char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
   /* Number of reported tokens (one for the "unexpected", one per
@@ -969,6 +1074,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
   int yycount = 0;
 
   /* There are many possibilities here to consider:
+     - Assume YYFAIL is not used.  It's too flawed to consider.  See
+       <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
+       for details.  YYERROR is fine as it does not invoke this
+       function.
      - If this state is a consistent state with a default action, then
        the only way this function was invoked is if the default action
        is an error action.  In that case, don't check for expected
@@ -1017,13 +1126,11 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                     break;
                   }
                 yyarg[yycount++] = yytname[yyx];
-                {
-                  YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (! (yysize <= yysize1
-                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-                    return 2;
-                  yysize = yysize1;
-                }
+                yysize1 = yysize + yytnamerr (0, yytname[yyx]);
+                if (! (yysize <= yysize1
+                       && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                  return 2;
+                yysize = yysize1;
               }
         }
     }
@@ -1043,12 +1150,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 # undef YYCASE_
     }
 
-  {
-    YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
-    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
-      return 2;
-    yysize = yysize1;
-  }
+  yysize1 = yysize + yystrlen (yyformat);
+  if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+    return 2;
+  yysize = yysize1;
 
   if (*yymsg_alloc < yysize)
     {
@@ -1085,20 +1190,48 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 | Release the memory associated to this symbol.  |
 `-----------------------------------------------*/
 
+/*ARGSUSED*/
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 static void
 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#else
+static void
+yydestruct (yymsg, yytype, yyvaluep)
+    const char *yymsg;
+    int yytype;
+    YYSTYPE *yyvaluep;
+#endif
 {
   YYUSE (yyvaluep);
+
   if (!yymsg)
     yymsg = "Deleting";
   YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
 
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-  YYUSE (yytype);
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
+  switch (yytype)
+    {
+
+      default:
+       break;
+    }
 }
 
 
+/* Prevent warnings from -Wmissing-prototypes.  */
+#ifdef YYPARSE_PARAM
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void *YYPARSE_PARAM);
+#else
+int yyparse ();
+#endif
+#else /* ! YYPARSE_PARAM */
+#if defined __STDC__ || defined __cplusplus
+int yyparse (void);
+#else
+int yyparse ();
+#endif
+#endif /* ! YYPARSE_PARAM */
 
 
 /* The lookahead symbol.  */
@@ -1106,6 +1239,7 @@ int yychar;
 
 /* The semantic value of the lookahead symbol.  */
 YYSTYPE yylval;
+
 /* Number of syntax errors so far.  */
 int yynerrs;
 
@@ -1114,18 +1248,37 @@ int yynerrs;
 | yyparse.  |
 `----------*/
 
+#ifdef YYPARSE_PARAM
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
+int
+yyparse (void *YYPARSE_PARAM)
+#else
+int
+yyparse (YYPARSE_PARAM)
+    void *YYPARSE_PARAM;
+#endif
+#else /* ! YYPARSE_PARAM */
+#if (defined __STDC__ || defined __C99__FUNC__ \
+     || defined __cplusplus || defined _MSC_VER)
 int
 yyparse (void)
+#else
+int
+yyparse ()
+
+#endif
+#endif
 {
     int yystate;
     /* Number of tokens to shift before error messages enabled.  */
     int yyerrstatus;
 
     /* The stacks and their tools:
-       'yyss': related to states.
-       'yyvs': related to semantic values.
+       `yyss': related to states.
+       `yyvs': related to semantic values.
 
-       Refer to the stacks through separate pointers, to allow yyoverflow
+       Refer to the stacks thru separate pointers, to allow yyoverflow
        to reallocate them elsewhere.  */
 
     /* The state stack.  */
@@ -1143,7 +1296,7 @@ yyparse (void)
   int yyn;
   int yyresult;
   /* Lookahead token as an internal (translated) token number.  */
-  int yytoken = 0;
+  int yytoken;
   /* The variables used to return semantic value and location from the
      action routines.  */
   YYSTYPE yyval;
@@ -1161,8 +1314,9 @@ yyparse (void)
      Keep to zero when no symbol should be popped.  */
   int yylen = 0;
 
-  yyssp = yyss = yyssa;
-  yyvsp = yyvs = yyvsa;
+  yytoken = 0;
+  yyss = yyssa;
+  yyvs = yyvsa;
   yystacksize = YYINITDEPTH;
 
   YYDPRINTF ((stderr, "Starting parse\n"));
@@ -1171,6 +1325,14 @@ yyparse (void)
   yyerrstatus = 0;
   yynerrs = 0;
   yychar = YYEMPTY; /* Cause a token to be read.  */
+
+  /* Initialize stack pointers.
+     Waste one element of value and location stack
+     so that they stay on the same level as the state stack.
+     The wasted elements are never initialized.  */
+  yyssp = yyss;
+  yyvsp = yyvs;
+
   goto yysetstate;
 
 /*------------------------------------------------------------.
@@ -1191,23 +1353,23 @@ yyparse (void)
 
 #ifdef yyoverflow
       {
-        /* Give user a chance to reallocate the stack.  Use copies of
-           these so that the &'s don't force the real ones into
-           memory.  */
-        YYSTYPE *yyvs1 = yyvs;
-        yytype_int16 *yyss1 = yyss;
-
-        /* Each stack pointer address is followed by the size of the
-           data in use in that stack, in bytes.  This used to be a
-           conditional around just the two extra args, but that might
-           be undefined if yyoverflow is a macro.  */
-        yyoverflow (YY_("memory exhausted"),
-                    &yyss1, yysize * sizeof (*yyssp),
-                    &yyvs1, yysize * sizeof (*yyvsp),
-                    &yystacksize);
-
-        yyss = yyss1;
-        yyvs = yyvs1;
+       /* Give user a chance to reallocate the stack.  Use copies of
+          these so that the &'s don't force the real ones into
+          memory.  */
+       YYSTYPE *yyvs1 = yyvs;
+       yytype_int16 *yyss1 = yyss;
+
+       /* Each stack pointer address is followed by the size of the
+          data in use in that stack, in bytes.  This used to be a
+          conditional around just the two extra args, but that might
+          be undefined if yyoverflow is a macro.  */
+       yyoverflow (YY_("memory exhausted"),
+                   &yyss1, yysize * sizeof (*yyssp),
+                   &yyvs1, yysize * sizeof (*yyvsp),
+                   &yystacksize);
+
+       yyss = yyss1;
+       yyvs = yyvs1;
       }
 #else /* no yyoverflow */
 # ifndef YYSTACK_RELOCATE
@@ -1215,22 +1377,22 @@ yyparse (void)
 # else
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
-        goto yyexhaustedlab;
+       goto yyexhaustedlab;
       yystacksize *= 2;
       if (YYMAXDEPTH < yystacksize)
-        yystacksize = YYMAXDEPTH;
+       yystacksize = YYMAXDEPTH;
 
       {
-        yytype_int16 *yyss1 = yyss;
-        union yyalloc *yyptr =
-          (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-        if (! yyptr)
-          goto yyexhaustedlab;
-        YYSTACK_RELOCATE (yyss_alloc, yyss);
-        YYSTACK_RELOCATE (yyvs_alloc, yyvs);
+       yytype_int16 *yyss1 = yyss;
+       union yyalloc *yyptr =
+         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
+       if (! yyptr)
+         goto yyexhaustedlab;
+       YYSTACK_RELOCATE (yyss_alloc, yyss);
+       YYSTACK_RELOCATE (yyvs_alloc, yyvs);
 #  undef YYSTACK_RELOCATE
-        if (yyss1 != yyssa)
-          YYSTACK_FREE (yyss1);
+       if (yyss1 != yyssa)
+         YYSTACK_FREE (yyss1);
       }
 # endif
 #endif /* no yyoverflow */
@@ -1239,10 +1401,10 @@ yyparse (void)
       yyvsp = yyvs + yysize - 1;
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                  (unsigned long int) yystacksize));
+                 (unsigned long int) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
-        YYABORT;
+       YYABORT;
     }
 
   YYDPRINTF ((stderr, "Entering state %d\n", yystate));
@@ -1271,7 +1433,7 @@ yybackup:
   if (yychar == YYEMPTY)
     {
       YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = yylex ();
+      yychar = YYLEX;
     }
 
   if (yychar <= YYEOF)
@@ -1311,9 +1473,7 @@ yybackup:
   yychar = YYEMPTY;
 
   yystate = yyn;
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
   goto yynewstate;
 
@@ -1336,7 +1496,7 @@ yyreduce:
   yylen = yyr2[yyn];
 
   /* If YYLEN is nonzero, implement the default value of the action:
-     '$$ = $1'.
+     `$$ = $1'.
 
      Otherwise, the following line sets YYVAL to garbage.
      This behavior is undocumented and Bison
@@ -1350,7 +1510,9 @@ yyreduce:
   switch (yyn)
     {
         case 4:
-#line 132 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 132 "parsedate.y"
     {
            yyHaveTime++;
 #ifdef lint
@@ -1360,286 +1522,313 @@ yyreduce:
            }
 #endif /* lint */
        }
-#line 1364 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 5:
-#line 141 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 141 "parsedate.y"
     {
            yyHaveTime++;
-           yyTimezone = (yyvsp[0].Number);
+           yyTimezone = (yyvsp[(2) - (2)].Number);
        }
-#line 1373 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 6:
-#line 145 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 145 "parsedate.y"
     {
            yyHaveDate++;
        }
-#line 1381 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 7:
-#line 148 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 148 "parsedate.y"
     {
            yyHaveRel = 1;
        }
-#line 1389 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 8:
-#line 153 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 153 "parsedate.y"
     {
-           if ((yyvsp[-1].Number) < 100) {
-               yyHour = (yyvsp[-1].Number);
+           if ((yyvsp[(1) - (2)].Number) < 100) {
+               yyHour = (yyvsp[(1) - (2)].Number);
                yyMinutes = 0;
            }
            else {
-               yyHour = (yyvsp[-1].Number) / 100;
-               yyMinutes = (yyvsp[-1].Number) % 100;
+               yyHour = (yyvsp[(1) - (2)].Number) / 100;
+               yyMinutes = (yyvsp[(1) - (2)].Number) % 100;
            }
            yySeconds = 0;
-           yyMeridian = (yyvsp[0].Meridian);
+           yyMeridian = (yyvsp[(2) - (2)].Meridian);
        }
-#line 1406 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 9:
-#line 165 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 165 "parsedate.y"
     {
-           yyHour = (yyvsp[-3].Number);
-           yyMinutes = (yyvsp[-1].Number);
+           yyHour = (yyvsp[(1) - (4)].Number);
+           yyMinutes = (yyvsp[(3) - (4)].Number);
            yySeconds = 0;
-           yyMeridian = (yyvsp[0].Meridian);
+           yyMeridian = (yyvsp[(4) - (4)].Meridian);
        }
-#line 1417 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 10:
-#line 171 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 171 "parsedate.y"
     {
-           yyHour = (yyvsp[-3].Number);
-           yyMinutes = (yyvsp[-1].Number);
-           yyTimezone = (yyvsp[0].Number);
+           yyHour = (yyvsp[(1) - (4)].Number);
+           yyMinutes = (yyvsp[(3) - (4)].Number);
+           yyTimezone = (yyvsp[(4) - (4)].Number);
            yyMeridian = MER24;
            yyDSTmode = DSToff;
        }
-#line 1429 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 11:
-#line 178 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 178 "parsedate.y"
     {
-           yyHour = (yyvsp[-5].Number);
-           yyMinutes = (yyvsp[-3].Number);
-           yySeconds = (yyvsp[-1].Number);
-           yyMeridian = (yyvsp[0].Meridian);
+           yyHour = (yyvsp[(1) - (6)].Number);
+           yyMinutes = (yyvsp[(3) - (6)].Number);
+           yySeconds = (yyvsp[(5) - (6)].Number);
+           yyMeridian = (yyvsp[(6) - (6)].Meridian);
        }
-#line 1440 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 12:
-#line 184 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 184 "parsedate.y"
     {
-           yyHour = (yyvsp[-5].Number);
-           yyMinutes = (yyvsp[-3].Number);
-           yySeconds = (yyvsp[-1].Number);
-           yyTimezone = (yyvsp[0].Number);
+           yyHour = (yyvsp[(1) - (6)].Number);
+           yyMinutes = (yyvsp[(3) - (6)].Number);
+           yySeconds = (yyvsp[(5) - (6)].Number);
+           yyTimezone = (yyvsp[(6) - (6)].Number);
            yyMeridian = MER24;
            yyDSTmode = DSToff;
        }
-#line 1453 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 13:
-#line 194 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 194 "parsedate.y"
     {
-           (yyval.Number) = (yyvsp[0].Number);
+           (yyval.Number) = (yyvsp[(1) - (1)].Number);
            yyDSTmode = DSToff;
        }
-#line 1462 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 14:
-#line 198 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 198 "parsedate.y"
     {
-           (yyval.Number) = (yyvsp[0].Number);
+           (yyval.Number) = (yyvsp[(1) - (1)].Number);
            yyDSTmode = DSTon;
        }
-#line 1471 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 15:
-#line 202 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 202 "parsedate.y"
     {
            /* Only allow "GMT+300" and "GMT-0800" */
-           if ((yyvsp[-1].Number) != 0) {
+           if ((yyvsp[(1) - (2)].Number) != 0) {
                YYABORT;
            }
-           (yyval.Number) = (yyvsp[0].Number);
+           (yyval.Number) = (yyvsp[(2) - (2)].Number);
            yyDSTmode = DSToff;
        }
-#line 1484 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 16:
-#line 210 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 210 "parsedate.y"
     {
-           (yyval.Number) = (yyvsp[0].Number);
+           (yyval.Number) = (yyvsp[(1) - (1)].Number);
            yyDSTmode = DSToff;
        }
-#line 1493 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 17:
-#line 216 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 216 "parsedate.y"
     {
            int         i;
 
            /* Unix and GMT and numeric timezones -- a little confusing. */
-           if ((yyvsp[0].Number) < 0) {
+           if ((yyvsp[(1) - (1)].Number) < 0) {
                /* Don't work with negative modulus. */
-               (yyvsp[0].Number) = -(yyvsp[0].Number);
-               if ((yyvsp[0].Number) > 9999 || (i = (yyvsp[0].Number) % 100) >= 60) {
+               (yyvsp[(1) - (1)].Number) = -(yyvsp[(1) - (1)].Number);
+               if ((yyvsp[(1) - (1)].Number) > 9999 || (i = (yyvsp[(1) - (1)].Number) % 100) >= 60) {
                    YYABORT;
                }
-               (yyval.Number) = ((yyvsp[0].Number) / 100) * 60 + i;
+               (yyval.Number) = ((yyvsp[(1) - (1)].Number) / 100) * 60 + i;
            }
            else {
-               if ((yyvsp[0].Number) > 9999 || (i = (yyvsp[0].Number) % 100) >= 60) {
+               if ((yyvsp[(1) - (1)].Number) > 9999 || (i = (yyvsp[(1) - (1)].Number) % 100) >= 60) {
                    YYABORT;
                }
-               (yyval.Number) = -(((yyvsp[0].Number) / 100) * 60 + i);
+               (yyval.Number) = -(((yyvsp[(1) - (1)].Number) / 100) * 60 + i);
            }
        }
-#line 1517 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 18:
-#line 237 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 237 "parsedate.y"
     {
-           yyMonth = (yyvsp[-2].Number);
-           yyDay = (yyvsp[0].Number);
+           yyMonth = (yyvsp[(1) - (3)].Number);
+           yyDay = (yyvsp[(3) - (3)].Number);
        }
-#line 1526 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 19:
-#line 241 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 241 "parsedate.y"
     {
-           if ((yyvsp[-4].Number) > 100) {
-               yyYear = (yyvsp[-4].Number);
-               yyMonth = (yyvsp[-2].Number);
-               yyDay = (yyvsp[0].Number);
+           if ((yyvsp[(1) - (5)].Number) > 100) {
+               yyYear = (yyvsp[(1) - (5)].Number);
+               yyMonth = (yyvsp[(3) - (5)].Number);
+               yyDay = (yyvsp[(5) - (5)].Number);
            }
            else {
-               yyMonth = (yyvsp[-4].Number);
-               yyDay = (yyvsp[-2].Number);
-               yyYear = (yyvsp[0].Number);
+               yyMonth = (yyvsp[(1) - (5)].Number);
+               yyDay = (yyvsp[(3) - (5)].Number);
+               yyYear = (yyvsp[(5) - (5)].Number);
            }
        }
-#line 1543 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 20:
-#line 253 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 253 "parsedate.y"
     {
-           yyMonth = (yyvsp[-1].Number);
-           yyDay = (yyvsp[0].Number);
+           yyMonth = (yyvsp[(1) - (2)].Number);
+           yyDay = (yyvsp[(2) - (2)].Number);
        }
-#line 1552 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 21:
-#line 257 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 257 "parsedate.y"
     {
-           yyMonth = (yyvsp[-3].Number);
-           yyDay = (yyvsp[-2].Number);
-           yyYear = (yyvsp[0].Number);
+           yyMonth = (yyvsp[(1) - (4)].Number);
+           yyDay = (yyvsp[(2) - (4)].Number);
+           yyYear = (yyvsp[(4) - (4)].Number);
        }
-#line 1562 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 22:
-#line 262 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 262 "parsedate.y"
     {
-           yyDay = (yyvsp[-1].Number);
-           yyMonth = (yyvsp[0].Number);
+           yyDay = (yyvsp[(1) - (2)].Number);
+           yyMonth = (yyvsp[(2) - (2)].Number);
        }
-#line 1571 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 23:
-#line 266 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 266 "parsedate.y"
     {
-           yyDay = (yyvsp[-2].Number);
-           yyMonth = (yyvsp[-1].Number);
-           yyYear = (yyvsp[0].Number);
+           yyDay = (yyvsp[(1) - (3)].Number);
+           yyMonth = (yyvsp[(2) - (3)].Number);
+           yyYear = (yyvsp[(3) - (3)].Number);
        }
-#line 1581 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 24:
-#line 271 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 271 "parsedate.y"
     {
-           yyDay = (yyvsp[-2].Number);
-           yyMonth = (yyvsp[-1].Number);
-           yyYear = (yyvsp[0].Number);
+           yyDay = (yyvsp[(3) - (5)].Number);
+           yyMonth = (yyvsp[(4) - (5)].Number);
+           yyYear = (yyvsp[(5) - (5)].Number);
        }
-#line 1591 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 25:
-#line 278 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 278 "parsedate.y"
     {
-           yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number);
+           yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
        }
-#line 1599 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 26:
-#line 281 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 281 "parsedate.y"
     {
-           yyRelSeconds += (yyvsp[-1].Number) * (yyvsp[0].Number);
+           yyRelSeconds += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
        }
-#line 1607 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 27:
-#line 284 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 284 "parsedate.y"
     {
-           yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number);
+           yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
        }
-#line 1615 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 28:
-#line 287 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 287 "parsedate.y"
     {
-           yyRelMonth += (yyvsp[-1].Number) * (yyvsp[0].Number);
+           yyRelMonth += (yyvsp[(1) - (2)].Number) * (yyvsp[(2) - (2)].Number);
        }
-#line 1623 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 29:
-#line 292 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 292 "parsedate.y"
     {
            (yyval.Meridian) = MER24;
        }
-#line 1631 "y.tab.c" /* yacc.c:1646  */
     break;
 
   case 30:
-#line 295 "parsedate.y" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 295 "parsedate.y"
     {
-           (yyval.Meridian) = (yyvsp[0].Meridian);
+           (yyval.Meridian) = (yyvsp[(1) - (1)].Meridian);
        }
-#line 1639 "y.tab.c" /* yacc.c:1646  */
     break;
 
 
-#line 1643 "y.tab.c" /* yacc.c:1646  */
+
+/* Line 1806 of yacc.c  */
+#line 1832 "y.tab.c"
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -1661,7 +1850,7 @@ yyreduce:
 
   *++yyvsp = yyval;
 
-  /* Now 'shift' the result of the reduction.  Determine what state
+  /* Now `shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
 
@@ -1676,9 +1865,9 @@ yyreduce:
   goto yynewstate;
 
 
-/*--------------------------------------.
-| yyerrlab -- here on detecting error |
-`--------------------------------------*/
+/*------------------------------------.
+| yyerrlab -- here on detecting error |
+`------------------------------------*/
 yyerrlab:
   /* Make sure we have latest lookahead translation.  See comments at
      user semantic actions for why this is necessary.  */
@@ -1729,20 +1918,20 @@ yyerrlab:
   if (yyerrstatus == 3)
     {
       /* If just tried and failed to reuse lookahead token after an
-         error, discard it.  */
+        error, discard it.  */
 
       if (yychar <= YYEOF)
-        {
-          /* Return failure if at end of input.  */
-          if (yychar == YYEOF)
-            YYABORT;
-        }
+       {
+         /* Return failure if at end of input.  */
+         if (yychar == YYEOF)
+           YYABORT;
+       }
       else
-        {
-          yydestruct ("Error: discarding",
-                      yytoken, &yylval);
-          yychar = YYEMPTY;
-        }
+       {
+         yydestruct ("Error: discarding",
+                     yytoken, &yylval);
+         yychar = YYEMPTY;
+       }
     }
 
   /* Else will try to reuse lookahead token after shifting the error
@@ -1761,7 +1950,7 @@ yyerrorlab:
   if (/*CONSTCOND*/ 0)
      goto yyerrorlab;
 
-  /* Do not reclaim the symbols of the rule whose action triggered
+  /* Do not reclaim the symbols of the rule which action triggered
      this YYERROR.  */
   YYPOPSTACK (yylen);
   yylen = 0;
@@ -1774,37 +1963,35 @@ yyerrorlab:
 | yyerrlab1 -- common code for both syntax error and YYERROR.  |
 `-------------------------------------------------------------*/
 yyerrlab1:
-  yyerrstatus = 3;      /* Each real token shifted decrements this.  */
+  yyerrstatus = 3;     /* Each real token shifted decrements this.  */
 
   for (;;)
     {
       yyn = yypact[yystate];
       if (!yypact_value_is_default (yyn))
-        {
-          yyn += YYTERROR;
-          if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-            {
-              yyn = yytable[yyn];
-              if (0 < yyn)
-                break;
-            }
-        }
+       {
+         yyn += YYTERROR;
+         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
+           {
+             yyn = yytable[yyn];
+             if (0 < yyn)
+               break;
+           }
+       }
 
       /* Pop the current state because it cannot handle the error token.  */
       if (yyssp == yyss)
-        YYABORT;
+       YYABORT;
 
 
       yydestruct ("Error: popping",
-                  yystos[yystate], yyvsp);
+                 yystos[yystate], yyvsp);
       YYPOPSTACK (1);
       yystate = *yyssp;
       YY_STACK_PRINT (yyss, yyssp);
     }
 
-  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
-  YY_IGNORE_MAYBE_UNINITIALIZED_END
 
 
   /* Shift the error token.  */
@@ -1828,7 +2015,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
-#if !defined yyoverflow || YYERROR_VERBOSE
+#if !defined(yyoverflow) || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
 `-------------------------------------------------*/
@@ -1847,14 +2034,14 @@ yyreturn:
       yydestruct ("Cleanup: discarding lookahead",
                   yytoken, &yylval);
     }
-  /* Do not reclaim the symbols of the rule whose action triggered
+  /* Do not reclaim the symbols of the rule which action triggered
      this YYABORT or YYACCEPT.  */
   YYPOPSTACK (yylen);
   YY_STACK_PRINT (yyss, yyssp);
   while (yyssp != yyss)
     {
       yydestruct ("Cleanup: popping",
-                  yystos[*yyssp], yyvsp);
+                 yystos[*yyssp], yyvsp);
       YYPOPSTACK (1);
     }
 #ifndef yyoverflow
@@ -1865,9 +2052,14 @@ yyreturn:
   if (yymsg != yymsgbuf)
     YYSTACK_FREE (yymsg);
 #endif
-  return yyresult;
+  /* Make sure YYID is used.  */
+  return YYID (yyresult);
 }
-#line 300 "parsedate.y" /* yacc.c:1906  */
+
+
+
+/* Line 2067 of yacc.c  */
+#line 300 "parsedate.y"
 
 
 /* Month and day table. */
@@ -2375,3 +2567,4 @@ main(int ac, char *av[])
     /* NOTREACHED */
 }
 #endif /* TEST */
+
index 9979e03ea0658e486425b5c7cd2915702b16d217..729846d3eb0e12010935922a1cc2ad3e67a66e5b 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Server functions which perform operations on room objects.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2012 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.
@@ -32,7 +32,7 @@ struct floor *floorcache[MAXFLOORS];
 int CtdlDoIHavePermissionToReadMessagesInThisRoom(void) {
        if (    (!(CC->logged_in))
                && (!(CC->internal_pgm))
-               && (!CtdlGetConfigInt("c_guest_logins"))
+               && (!config.c_guest_logins)
        ) {
                return(om_not_logged_in);
        }
@@ -139,7 +139,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
                is_me = 1;
        }
 
-       if ((is_me) && (CtdlGetConfigInt("c_guest_logins")) && (!CC->logged_in)) {
+       if ((is_me) && (config.c_guest_logins) && (!CC->logged_in)) {
                is_guest = 1;
        }
 
@@ -166,7 +166,7 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf,
        }
 
        /* Force the properties of the Aide room */
-       if (!strcasecmp(roombuf->QRname, CtdlGetConfigStr("c_aideroom"))) {
+       if (!strcasecmp(roombuf->QRname, config.c_aideroom)) {
                if (userbuf->axlevel >= AxAideU) {
                        retval = UA_KNOWN | UA_GOTOALLOWED | UA_POSTALLOWED | UA_DELETEALLOWED | UA_REPLYALLOWED;
                } else {
@@ -339,9 +339,9 @@ void room_sanity_check(struct ctdlroom *qrbuf)
        /* Listing order of 0 is illegal except for base rooms */
        if (qrbuf->QRorder == 0)
                if (!(qrbuf->QRflags & QR_MAILBOX) &&
-                   strncasecmp(qrbuf->QRname, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN)
+                   strncasecmp(qrbuf->QRname, config.c_baseroom, ROOMNAMELEN)
                    &&
-                   strncasecmp(qrbuf->QRname, CtdlGetConfigStr("c_aideroom"), ROOMNAMELEN))
+                   strncasecmp(qrbuf->QRname, config.c_aideroom, ROOMNAMELEN))
                        qrbuf->QRorder = 64;
 }
 
@@ -819,7 +819,7 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
        /* Know the room ... but not if it's the page log room, or if the
         * caller specified that we're only entering this room transiently.
         */
-       if ((strcasecmp(CCC->room.QRname, CtdlGetConfigStr("c_logpages")))
+       if ((strcasecmp(CCC->room.QRname, config.c_logpages))
           && (transiently == 0) ) {
                vbuf.v_flags = vbuf.v_flags & ~V_FORGET & ~V_LOCKOUT;
                vbuf.v_flags = vbuf.v_flags | V_ACCESS;
@@ -945,7 +945,7 @@ void CtdlUserGoto(char *where, int display_result, int transiently,
  */
 void convert_room_name_macros(char *towhere, size_t maxlen) {
        if (!strcasecmp(towhere, "_BASEROOM_")) {
-               safestrncpy(towhere, CtdlGetConfigStr("c_baseroom"), maxlen);
+               safestrncpy(towhere, config.c_baseroom, maxlen);
        }
        else if (!strcasecmp(towhere, "_MAIL_")) {
                safestrncpy(towhere, MAILROOM, maxlen);
@@ -957,7 +957,7 @@ void convert_room_name_macros(char *towhere, size_t maxlen) {
                safestrncpy(towhere, USERDRAFTROOM, maxlen);
        }
        else if (!strcasecmp(towhere, "_BITBUCKET_")) {
-               safestrncpy(towhere, CtdlGetConfigStr("c_twitroom"), maxlen);
+               safestrncpy(towhere, config.c_twitroom, maxlen);
        }
        else if (!strcasecmp(towhere, "_CALENDAR_")) {
                safestrncpy(towhere, USERCALENDARROOM, maxlen);
@@ -1039,8 +1039,8 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
                }
 
                /* Reject change of floor for baseroom/aideroom */
-               if (!strncasecmp(old_name, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN) ||
-                   !strncasecmp(old_name, CtdlGetConfigStr("c_aideroom"), ROOMNAMELEN)) {
+               if (!strncasecmp(old_name, config.c_baseroom, ROOMNAMELEN) ||
+                   !strncasecmp(old_name, config.c_aideroom, ROOMNAMELEN)) {
                        new_floor = 0;
                }
 
@@ -1055,11 +1055,13 @@ int CtdlRenameRoom(char *old_name, char *new_name, int new_floor) {
                begin_critical_section(S_CONFIG);
        
                /* If baseroom/aideroom name changes, update config */
-               if (!strncasecmp(old_name, CtdlGetConfigStr("c_baseroom"), ROOMNAMELEN)) {
-                       CtdlSetConfigStr("c_baseroom", new_name);
+               if (!strncasecmp(old_name, config.c_baseroom, ROOMNAMELEN)) {
+                       safestrncpy(config.c_baseroom, new_name, ROOMNAMELEN);
+                       put_config();
                }
-               if (!strncasecmp(old_name, CtdlGetConfigStr("c_aideroom"), ROOMNAMELEN)) {
-                       CtdlSetConfigStr("c_aideroom", new_name);
+               if (!strncasecmp(old_name, config.c_aideroom, ROOMNAMELEN)) {
+                       safestrncpy(config.c_aideroom, new_name, ROOMNAMELEN);
+                       put_config();
                }
        
                end_critical_section(S_CONFIG);
index 568d9a3ae0275032f977296793b288dabe8aa912..4b4e44c08ab958bdb32478fa6e1629dbaaf3cd8b 100644 (file)
@@ -1,8 +1,8 @@
 /*
- * Citadel Extension Loader
+ * Citadel Dynamic Loading Module
  * Written by Brian Costello <btx@calyx.net>
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2011 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.
@@ -21,7 +21,6 @@
 
 #include "serv_extensions.h"
 #include "ctdl_module.h"
-#include "config.h"
 
 
 int DebugModules = 0;
@@ -1132,7 +1131,7 @@ void CtdlRegisterServiceHook(int tcp_port,
        newfcn->ServiceName = ServiceName;
 
        if (sockpath != NULL) {
-               newfcn->msock = ctdl_uds_server(sockpath, CtdlGetConfigInt("c_maxsessions"), error);
+               newfcn->msock = ctdl_uds_server(sockpath, config.c_maxsessions, error);
                snprintf(message, SIZ, "Unix domain socket '%s': ", sockpath);
        }
        else if (tcp_port <= 0) {       /* port -1 to disable */
@@ -1142,12 +1141,12 @@ void CtdlRegisterServiceHook(int tcp_port,
                return;
        }
        else {
-               newfcn->msock = ctdl_tcp_server(CtdlGetConfigStr("c_ip_addr"),
+               newfcn->msock = ctdl_tcp_server(config.c_ip_addr,
                                              tcp_port,
-                                             CtdlGetConfigInt("c_maxsessions")
+                                             config.c_maxsessions
                                              error);
                snprintf(message, SIZ, "TCP port %s:%d: (%s) ", 
-                        CtdlGetConfigStr("c_ip_addr"), tcp_port, ServiceName);
+                        config.c_ip_addr, tcp_port, ServiceName);
        }
 
        if (newfcn->msock > 0) {
index 0eff9fdc4408e1864cf4d11629f7f80794560709..6aedb546393124cce3a72d7e6259eea3740404c5 100644 (file)
@@ -1,17 +1,3 @@
-/* 
- * Main declarations file for the Citadel server
- *
- * Copyright (c) 1987-2015 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.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
 #ifndef SERVER_H
 #define SERVER_H
 
@@ -80,7 +66,6 @@ typedef struct __recptypes {
 #define CTDLEXIT_DB            105     /* Unable to initialize database */
 #define CTDLEXIT_LIBCITADEL    106     /* Incorrect version of libcitadel */
 #define CTDL_EXIT_UNSUP_AUTH   107     /* Unsupported auth mode configured */
-#define CTDLEXIT_UNUSER                108     /* Could not determine uid to run as */
 
 /*
  * Reasons why a session would be terminated (set CC->kill_me to these values)
@@ -124,15 +109,14 @@ struct CitControl {
        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         */
+       int version;                    /* Server-hosted upgrade level      */
+       int 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 {
        struct ExpressMessage *next;
@@ -226,7 +210,6 @@ enum {
        CDB_EUIDINDEX,          /* locate msgs by EUID           */
        CDB_USERSBYNUMBER,      /* index of users by number      */
        CDB_OPENID,             /* associates OpenIDs with users */
-       CDB_CONFIG,             /* system configuration database */
        MAXCDB                  /* total number of CDB's defined */
 };
 
index a8e272978d4f2904fa8f4447513b0bbc0618cc69..6a7d293fb8ef7cf6265fa3b4e4d044b1d117a339 100644 (file)
 #include "user_ops.h"
 #include "ecrash.h"
 
-uid_t ctdluid = 0;
 const char *CitadelServiceUDS="citadel-UDS";
 const char *CitadelServiceTCP="citadel-TCP";
+
+
+
 void go_threading(void);
 
 /*
@@ -49,8 +51,6 @@ int main(int argc, char **argv)
        char ctdldir[PATH_MAX]=CTDLDIR;
        int syslog_facility = LOG_DAEMON;
        const char *eDebuglist[] = {NULL, NULL};
-       uid_t u = 0;
-       struct passwd *p = NULL;
 #ifdef HAVE_RUN_DIR
        struct stat filestats;
 #endif
@@ -64,7 +64,7 @@ int main(int argc, char **argv)
        InitializeMasterTSD();
 
        /* parse command-line arguments */
-       while ((a=getopt(argc, argv, "l:dh:x:t:B:Dru:")) != EOF) switch(a) {
+       while ((a=getopt(argc, argv, "l:dh:x:t:B:Dr")) != EOF) switch(a) {
 
                case 'l':
                        safestrncpy(facility, optarg, sizeof(facility));
@@ -108,57 +108,16 @@ int main(int argc, char **argv)
                        drop_root_perms = 0;
                        break;
 
-               /* -u tells the server what uid to run under... */
-               case 'u':
-                       u = atoi(optarg);
-                       if (u > 0) {
-                               ctdluid = u;
-                       }
-                       else {
-                               p = getpwnam(optarg);
-                               if (p) {
-                                       u = p->pw_uid;
-                               }
-                       }
-                       if (u > 0) {
-                               ctdluid = u;
-                       }
-                       break;
-
                default:
                /* any other parameter makes it crash and burn */
                        fprintf(stderr, "citserver: usage: "
                                        "citserver "
                                        "[-l LogFacility] "
                                        "[-d] [-D] [-r] "
-                                       "[-u user] "
                                        "[-h HomeDir]\n"
                        );
                        exit(1);
        }
-
-       /* Last ditch effort to determine the user name ... if there's a user called "citadel" then use that */
-       if (ctdluid == 0) {
-               p = getpwnam("citadel");
-               if (!p) {
-                       p = getpwnam("bbs");
-               }
-               if (!p) {
-                       p = getpwnam("guest");
-               }
-               if (p) {
-                       u = p->pw_uid;
-               }
-               if (u > 0) {
-                       ctdluid = u;
-               }
-       }
-
-       if ((ctdluid == 0) && (drop_root_perms == 0)) {
-               fprintf(stderr, "citserver: cannot determine user to run as; please specify -r or -u options\n");
-               exit(CTDLEXIT_UNUSER);
-       }
-
        StartLibCitadel(basesize);
        openlog("citserver",
                ( running_as_daemon ? (LOG_PID) : (LOG_PID | LOG_PERROR) ),
@@ -202,15 +161,25 @@ int main(int argc, char **argv)
        syslog(LOG_DEBUG, "Called as: %s", argv[0]);
        syslog(LOG_INFO, "%s", libcitadel_version_string());
 
+       /* Load site-specific configuration */
+       syslog(LOG_INFO, "Loading citadel.config");
+       get_config();
+
+       /* get_control() MUST MUST MUST be called BEFORE the databases are opened!! */
+       syslog(LOG_INFO, "Acquiring control record");
+       get_control();
+
+       put_config();
+
 #ifdef HAVE_RUN_DIR
        /* on some dists rundir gets purged on startup. so we need to recreate it. */
 
        if (stat(ctdl_run_dir, &filestats)==-1){
 #ifdef HAVE_GETPWUID_R
 #ifdef SOLARIS_GETPWUID
-               pwp = getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf));
+               pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
 #else // SOLARIS_GETPWUID
-               getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
+               getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
 #endif // SOLARIS_GETPWUID
 #else // HAVE_GETPWUID_R
                pwp = NULL;
@@ -221,7 +190,7 @@ int main(int argc, char **argv)
                                      "unable to create run directory [%s]: %s", 
                                      ctdl_run_dir, strerror(errno));
 
-               if (chown(ctdl_run_dir, ctdluid, (pwp==NULL)?-1:pw.pw_gid) != 0)
+               if (chown(ctdl_run_dir, config.c_ctdluid, (pwp==NULL)?-1:pw.pw_gid) != 0)
                        syslog(LOG_EMERG, 
                                      "unable to set the access rights for [%s]: %s", 
                                      ctdl_run_dir, strerror(errno));
@@ -284,7 +253,7 @@ int main(int argc, char **argv)
        /*
         * Bind the server to our favorite TCP port (usually 504).
         */
-       CtdlRegisterServiceHook(CtdlGetConfigInt("c_port_number"),
+       CtdlRegisterServiceHook(config.c_port_number,
                                NULL,
                                citproto_begin_session,
                                do_command_loop,
@@ -307,7 +276,7 @@ int main(int argc, char **argv)
        /*
         * If we need host auth, start our chkpwd daemon.
         */
-       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
+       if (config.c_auth_mode == AUTHMODE_HOST) {
                start_chkpwd_daemon();
        }
 
@@ -328,9 +297,9 @@ int main(int argc, char **argv)
 
 #ifdef HAVE_GETPWUID_R
 #ifdef SOLARIS_GETPWUID
-               pwp = getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf));
+               pwp = getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf));
 #else // SOLARIS_GETPWUID
-               getpwuid_r(ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
+               getpwuid_r(config.c_ctdluid, &pw, pwbuf, sizeof(pwbuf), &pwp);
 #endif // SOLARIS_GETPWUID
 #else // HAVE_GETPWUID_R
                pwp = NULL;
index 0dda5bd55425d676a375b931635a416d6e6d361a..787a93a3df8eae8cb16b3ab76232e1af009f8fea 100644 (file)
@@ -7,7 +7,7 @@
  * If we ever port to a different platform and either have multiple
  * variants of this file or simply load it up with #ifdefs.
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2011 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.
@@ -39,7 +39,6 @@
 #include <libcitadel.h>
 
 #include "citserver.h"
-#include "config.h"
 #include "ctdl_module.h"
 
 #include "sysdep_decls.h"
@@ -732,7 +731,7 @@ int HaveMoreLinesWaiting(CitContext *CCC)
  */
 INLINE int client_read(char *buf, int bytes)
 {
-       return(client_read_to(buf, bytes, CtdlGetConfigInt("c_sleeping")));
+       return(client_read_to(buf, bytes, config.c_sleeping));
 }
 
 int CtdlClientGetLine(StrBuf *Target)
@@ -1476,8 +1475,8 @@ SKIP_SELECT:
 
                pthread_mutex_lock(&ThreadCountMutex);
                --active_workers;
-               if ((active_workers + CtdlGetConfigInt("c_min_workers") < num_workers) &&
-                   (num_workers > CtdlGetConfigInt("c_min_workers")))
+               if ((active_workers + config.c_min_workers < num_workers) &&
+                   (num_workers > config.c_min_workers))
                {
                        num_workers--;
                        pthread_mutex_unlock(&ThreadCountMutex);
index 5cb70334c0b9fc13703045236de963ac55c899de..228a5b0aa6f85b6e7f908481f6fe6ffe862b3daf 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Thread handling stuff for Citadel server
  *
- * Copyright (c) 1987-2015 by the citadel.org team
+ * Copyright (c) 1987-2011 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.
@@ -19,7 +19,6 @@
 #include "modules_init.h"
 #include "serv_extensions.h"
 #include "ctdl_module.h"
-#include "config.h"
 #include "context.h"
 #include "threads.h"
 
@@ -172,7 +171,7 @@ void go_threading(void)
         * they are all in use.
         */
        while (!server_shutting_down) {
-               if ((active_workers == num_workers) && (num_workers < CtdlGetConfigInt("c_max_workers"))) {
+               if ((active_workers == num_workers) && (num_workers < config.c_max_workers)) {
                        CtdlThreadCreate(worker_thread);
                }
                usleep(1000000);
index 4ae077862c857a8e0ef58770a017bacc205de25b..6cce2a15bdf7c8bff110a0d75d794b25a2695aa5 100644 (file)
@@ -19,7 +19,6 @@
 #include "control.h"
 #include "support.h"
 #include "citserver.h"
-#include "config.h"
 #include "citadel_ldap.h"
 #include "ctdl_module.h"
 #include "user_ops.h"
@@ -315,7 +314,7 @@ int CtdlCheckInternetMailPermission(struct ctdluser *who) {
        if (who->axlevel <= AxProbU) return(0);
 
        /* Globally enabled? */
-       if (CtdlGetConfigInt("c_restrict") == 0) return(1);
+       if (config.c_restrict == 0) return(1);
 
        /* User flagged ok? */
        if (who->flags & US_INTERNET) return(2);
@@ -339,7 +338,7 @@ int CtdlAccessCheck(int required_level)
                return(-1);
        }
 
-       if ((required_level >= ac_logged_in_or_guest) && (CC->logged_in == 0) && (CtdlGetConfigInt("c_guest_logins") == 0)) {
+       if ((required_level >= ac_logged_in_or_guest) && (CC->logged_in == 0) && (!config.c_guest_logins)) {
                cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
                return(-1);
        }
@@ -529,10 +528,10 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname)
 
        /* If a "master user" is defined, handle its authentication if specified */
        CC->is_master = 0;
-       if (    (strlen(CtdlGetConfigStr("c_master_user")) > 0) && 
-               (strlen(CtdlGetConfigStr("c_master_pass")) > 0) &&
-               (authname != NULL) &&
-               (!strcasecmp(authname, CtdlGetConfigStr("c_master_user"))) )
+       if ((configlen.c_master_user > 0) && 
+           (configlen.c_master_pass > 0) &&
+           (authname != NULL) &&
+           (!strcasecmp(authname, config.c_master_user)))
        {
                CC->is_master = 1;
        }
@@ -546,7 +545,7 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname)
                return login_not_found;
        }
 
-       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
+       if (config.c_auth_mode == AUTHMODE_HOST) {
 
                /* host auth mode */
 
@@ -587,7 +586,7 @@ int CtdlLoginExistingUser(char *authname, const char *trythisname)
        }
 
 #ifdef HAVE_LDAP
-       else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
+       else if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
        
                /* LDAP auth mode */
 
@@ -671,14 +670,14 @@ void do_login(void)
        /* If this user's name is the name of the system administrator
         * (as specified in setup), automatically assign access level 6.
         */
-       if (!strcasecmp(CCC->user.fullname, CtdlGetConfigStr("c_sysadm"))) {
+       if (!strcasecmp(CCC->user.fullname, config.c_sysadm)) {
                CCC->user.axlevel = AxAideU;
        }
 
        /* If we're authenticating off the host system, automatically give
         * root the highest level of access.
         */
-       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
+       if (config.c_auth_mode == AUTHMODE_HOST) {
                if (CCC->user.uid == 0) {
                        CCC->user.axlevel = AxAideU;
                }
@@ -692,7 +691,7 @@ void do_login(void)
         * the vCard module's login hook runs.
         */
        snprintf(CCC->cs_inet_email, sizeof CCC->cs_inet_email, "%s@%s",
-               CCC->user.fullname, CtdlGetConfigStr("c_fqdn"));
+               CCC->user.fullname, config.c_fqdn);
        convert_spaces_to_underscores(CCC->cs_inet_email);
 
        /* Create any personal rooms required by the system.
@@ -707,7 +706,7 @@ void do_login(void)
        PerformSessionHooks(EVT_LOGIN);
 
        /* Enter the lobby */
-       CtdlUserGoto(CtdlGetConfigStr("c_baseroom"), 0, 0, NULL, NULL, NULL, NULL);
+       CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
 }
 
 
@@ -878,10 +877,10 @@ int CtdlTryPassword(const char *password, long len)
        }
 
        if (CCC->is_master) {
-               code = strcmp(password, CtdlGetConfigStr("c_master_pass"));
+               code = strcmp(password, config.c_master_pass);
        }
 
-       else if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
+       else if (config.c_auth_mode == AUTHMODE_HOST) {
 
                /* host auth mode */
 
@@ -911,7 +910,7 @@ int CtdlTryPassword(const char *password, long len)
        }
 
 #ifdef HAVE_LDAP
-       else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
+       else if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
 
                /* LDAP auth mode */
 
@@ -1053,7 +1052,7 @@ int internal_create_user (const char *username, long len, struct ctdluser *usbuf
 
        usbuf->timescalled = 0;
        usbuf->posted = 0;
-       usbuf->axlevel = CtdlGetConfigInt("c_initax");
+       usbuf->axlevel = config.c_initax;
        usbuf->lastcall = time(NULL);
 
        /* fetch a new user number */
@@ -1090,7 +1089,7 @@ int create_user(const char *newusername, long len, int become_user)
        strproc(username);
 
        
-       if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
+       if (config.c_auth_mode == AUTHMODE_HOST) {
 
                /* host auth mode */
 
@@ -1122,7 +1121,7 @@ int create_user(const char *newusername, long len, int become_user)
        }
 
 #ifdef HAVE_LDAP
-       if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
+       if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
                if (CtdlTryUserLDAP(username, NULL, 0, username, sizeof username, &uid, 0) != 0) {
                        return(ERROR + NO_SUCH_USER);
                }
@@ -1240,7 +1239,7 @@ int CtdlForgetThisRoom(void) {
        visit vbuf;
 
        /* On some systems, Admins are not allowed to forget rooms */
-       if (is_aide() && (CtdlGetConfigInt("c_aide_zap") == 0)
+       if (is_aide() && (config.c_aide_zap == 0)
           && ((CC->room.QRflags & QR_MAILBOX) == 0)  ) {
                return(1);
        }
@@ -1255,7 +1254,7 @@ int CtdlForgetThisRoom(void) {
        CtdlPutUserLock(&CC->user);
 
        /* Return to the Lobby, so we don't end up in an undefined room */
-       CtdlUserGoto(CtdlGetConfigStr("c_baseroom"), 0, 0, NULL, NULL, NULL, NULL);
+       CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
        return(0);
 
 }
index afb4bb56658b87e95c1484a906736f34a7d50488..eec27947fe5e7e5338c3d3ca8d67919540d382a6 100644 (file)
@@ -1312,6 +1312,7 @@ int main(int argc, char *argv[])
 
        activity = _("Setting file permissions");
        progress(activity, 0, 2);
+       //chown(file_citadel_config, config.c_ctdluid, gid);
        progress(activity, 1, 2);
        chmod(file_citadel_config, S_IRUSR | S_IWUSR);
        progress(activity, 2, 2);