From: Art Cancro Date: Tue, 5 May 2015 15:18:04 +0000 (-0400) Subject: config migration endless typing meow X-Git-Tag: Release_902~167^2~3 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=f44264c1dca8b7dfd5d4b113fc8e67059c3bc008 config migration endless typing meow --- diff --git a/citadel/modules/smtp/serv_smtpqueue.c b/citadel/modules/smtp/serv_smtpqueue.c index 56ab4356a..a38dbe742 100644 --- a/citadel/modules/smtp/serv_smtpqueue.c +++ b/citadel/modules/smtp/serv_smtpqueue.c @@ -697,7 +697,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, CFG_KEY(c_nodename)); + CM_SetField(bmsg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); CM_SetField(bmsg, eMsgSubject, HKEY("Delivery Status Notification (Failure)")); CM_SetAsFieldSB(bmsg, eMesageText, &BounceMB); diff --git a/citadel/modules/smtp/smtp_clienthandlers.c b/citadel/modules/smtp/smtp_clienthandlers.c index 198649e1f..bab1d7159 100644 --- a/citadel/modules/smtp/smtp_clienthandlers.c +++ b/citadel/modules/smtp/smtp_clienthandlers.c @@ -17,21 +17,15 @@ * RFC 2822 - Internet Message Format * RFC 2920 - SMTP Service Extension for Command Pipelining * - * Copyright (c) 1998-2012 by the citadel.org team + * Copyright (c) 1998-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 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" @@ -144,8 +138,7 @@ eNextState SMTPC_send_EHLO(SmtpOutMsg *Msg) /* At this point we know we are talking to a real SMTP server */ /* Do a EHLO command. If it fails, try the HELO command. */ - StrBufPrintf(Msg->IO.SendBuf.Buf, - "EHLO %s\r\n", config.c_fqdn); + StrBufPrintf(Msg->IO.SendBuf.Buf, "EHLO %s\r\n", CtdlGetconfigStr("c_fqdn")); SMTP_DBG_SEND(); return eReadMessage; @@ -180,8 +173,7 @@ eNextState SMTPC_read_EHLO_reply(SmtpOutMsg *Msg) eNextState STMPC_send_HELO(SmtpOutMsg *Msg) { AsyncIO *IO = &Msg->IO; - StrBufPrintf(Msg->IO.SendBuf.Buf, - "HELO %s\r\n", config.c_fqdn); + StrBufPrintf(Msg->IO.SendBuf.Buf, "HELO %s\r\n", CtdlGetconfigStr("c_fqdn")); SMTP_DBG_SEND(); return eReadMessage; diff --git a/citadel/modules/smtp/smtp_util.c b/citadel/modules/smtp/smtp_util.c index 8609f9113..1cca96e3a 100644 --- a/citadel/modules/smtp/smtp_util.c +++ b/citadel/modules/smtp/smtp_util.c @@ -20,21 +20,15 @@ * The VRFY and EXPN commands have been removed from this implementation * because nobody uses these commands anymore, except for spammers. * - * Copyright (c) 1998-2012 by the citadel.org team + * Copyright (c) 1998-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 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" @@ -129,11 +123,7 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) strcpy(bounceto, ""); boundary = NewStrBufPlain(HKEY("=_Citadel_Multipart_")); - StrBufAppendPrintf(boundary, - "%s_%04x%04x", - config.c_fqdn, - getpid(), - ++seq); + StrBufAppendPrintf(boundary, "%s_%04x%04x", CtdlGetConfigStr("c_fqdn"), getpid(), ++seq); lines = num_tokens(instr, '\n'); @@ -163,11 +153,9 @@ 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, CFG_KEY(c_nodename)); + CM_SetField(bmsg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("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); @@ -310,7 +298,7 @@ void smtp_do_bounce(char *instr, StrBuf *OMsgTxt) /* If not, post it in the Aide> room */ if (successful_bounce == 0) { - CtdlSubmitMsg(bmsg, NULL, config.c_aideroom, QP_EADDR); + CtdlSubmitMsg(bmsg, NULL, CtdlGetConfigStr("c_aideroom"), QP_EADDR); } /* Free up the memory we used */ diff --git a/citadel/modules/upgrade/serv_upgrade.c b/citadel/modules/upgrade/serv_upgrade.c index fc8c1d58e..7cd9c10b5 100644 --- a/citadel/modules/upgrade/serv_upgrade.c +++ b/citadel/modules/upgrade/serv_upgrade.c @@ -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; - safestrncpy(config.c_default_cal_zone, buf, sizeof config.c_default_cal_zone); - syslog(LOG_INFO, "Configuring timezone: %s", config.c_default_cal_zone); + CtdlSetConfigStr("c_default_cal_zone", buf); + syslog(LOG_INFO, "Configuring timezone: %s", buf); } fclose(fp); } @@ -261,36 +261,38 @@ void guess_time_zone(void) { */ void update_config(void) { - if (CitControl.MM_hosted_upgrade_level < 606) { + oldver = CitControl.MM_hosted_upgrade_level; + + if (oldver < 606) { config.c_rfc822_strict_from = 0; } - if (CitControl.MM_hosted_upgrade_level < 609) { + if (oldver < 609) { config.c_purge_hour = 3; } - if (CitControl.MM_hosted_upgrade_level < 615) { + if (oldver < 615) { config.c_ldap_port = 389; } - if (CitControl.MM_hosted_upgrade_level < 623) { + if (oldver < 623) { strcpy(config.c_ip_addr, "*"); } - if (CitControl.MM_hosted_upgrade_level < 650) { + if (oldver < 650) { config.c_enable_fulltext = 1; } - if (CitControl.MM_hosted_upgrade_level < 652) { + if (oldver < 652) { config.c_auto_cull = 1; } - if (CitControl.MM_hosted_upgrade_level < 725) { + if (oldver < 725) { config.c_xmpp_c2s_port = 5222; config.c_xmpp_s2s_port = 5269; } - if (CitControl.MM_hosted_upgrade_level < 830) { + if (oldver < 830) { config.c_nntp_port = 119; config.c_nntps_port = 563; } @@ -298,8 +300,6 @@ void update_config(void) { if (IsEmptyStr(config.c_default_cal_zone)) { guess_time_zone(); } - - put_config(); } diff --git a/citadel/modules/vcard/serv_vcard.c b/citadel/modules/vcard/serv_vcard.c index 39820f776..12e39696d 100644 --- a/citadel/modules/vcard/serv_vcard.c +++ b/citadel/modules/vcard/serv_vcard.c @@ -2,7 +2,7 @@ * A server-side module for Citadel which supports address book information * using the standard vCard format. * - * Copyright (c) 1999-2012 by the citadel.org team + * Copyright (c) 1999-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. @@ -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) && - (config.c_disable_newu) && + (CtdlGetConfigInt("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", - config.c_fqdn, + CtdlGetConfigStr("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 ( (config.c_disable_newu) && (CCC->user.axlevel < AxAideU) ) { + if ( (CtdlGetConfigInt("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 (config.c_auth_mode == AUTHMODE_HOST) { + if (CtdlGetConfigInt("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, config.c_fqdn); + snprintf(buf, sizeof buf, "%s@%s", pwd.pw_name, CtdlGetConfigStr("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 ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) { + if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("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, config.c_fqdn); + snprintf(buf, sizeof buf, "%s@%s", usbuf->fullname, CtdlGetConfigStr("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, CFG_KEY(c_nodename)); + CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("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 ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) { + if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("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(config.c_pftcpdict_port, /* Postfix */ + CtdlRegisterServiceHook(CtdlGetConfigInt("c_pftcpdict_port"), /* Postfix */ NULL, check_get_greeting, check_get, diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index 44a38153c..269777c94 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -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, CFG_KEY(c_nodename)); + CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("c_nodename"))); CM_SetField(msg, eExclusiveID, pagename, strlen(pagename)); msgnum = CtdlSubmitMsg(msg, NULL, "", 0); /* Replace the current revision */ }