/*
* Administrative screen for site-wide configuration
*
- * Copyright (c) 1996-2012 by the citadel.org team
+ * Copyright (c) 1996-2024 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.
+ * This program is open source software. Use, duplication, or disclosure
+ * are subject to the terms of the GNU General Public License version 3.
*/
#include "webcit.h"
#include "webserver.h"
+/*
+ * Expiry policy for the autopurger
+ */
+#define EXPIRE_NEXTLEVEL 0 /* Inherit expiration policy */
+#define EXPIRE_MANUAL 1 /* Don't expire messages at all */
+#define EXPIRE_NUMMSGS 2 /* Keep only latest n messages */
+#define EXPIRE_AGE 3 /* Expire messages after n days */
+
CtxType CTX_SRVLOG = CTX_NONE;
HashList *ZoneHash = NULL;
{ { CStrOf(mailboxespolicy)} , { strof(mailboxespolicy)"_value", sizeof(strof(mailboxespolicy)"_value") - 1 } }
};
-void LoadExpirePolicy(GPEXWhichPolicy which)
-{
+
+void LoadExpirePolicy(GPEXWhichPolicy which) {
StrBuf *Buf;
- wcsession *WCC = WC;
long State;
const char *Pos = NULL;
StrBuf_ServGetln(Buf);
if (GetServerStatus(Buf, &State) == 2) {
Pos = ChrPtr(Buf) + 4;
- WCC->Policy[which].expire_mode = StrBufExtractNext_long(Buf, &Pos, '|');
- WCC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|');
+ WC->Policy[which].expire_mode = StrBufExtractNext_long(Buf, &Pos, '|');
+ WC->Policy[which].expire_value = StrBufExtractNext_long(Buf, &Pos, '|');
}
else if (State == 550)
AppendImportantMessage(_("Higher access is required to access this function."), -1);
FreeStrBuf(&Buf);
}
-void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which)
-{
+
+void SaveExpirePolicyFromHTTP(GPEXWhichPolicy which) {
StrBuf *Buf;
long State;
FreeStrBuf(&Buf);
}
-int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
+
+int ConditionalExpire(StrBuf *Target, WCTemplputParams *TP) {
GPEXWhichPolicy which;
int CompareWith;
LoadExpirePolicy(which);
- return WCC->Policy[which].expire_mode == CompareWith;
+ return WC->Policy[which].expire_mode == CompareWith;
}
-void tmplput_ExpireValue(StrBuf *Target, WCTemplputParams *TP)
-{
+
+void tmplput_ExpireValue(StrBuf *Target, WCTemplputParams *TP) {
GPEXWhichPolicy which;
- wcsession *WCC = WC;
which = GetTemplateTokenNumber(Target, TP, 0, 0);
LoadExpirePolicy(which);
- StrBufAppendPrintf(Target, "%d", WCC->Policy[which].expire_value);
+ StrBufAppendPrintf(Target, "%d", WC->Policy[which].expire_value);
}
-void tmplput_ExpireMode(StrBuf *Target, WCTemplputParams *TP)
-{
+void tmplput_ExpireMode(StrBuf *Target, WCTemplputParams *TP) {
GPEXWhichPolicy which;
- wcsession *WCC = WC;
which = GetTemplateTokenNumber(Target, TP, 2, 0);
LoadExpirePolicy(which);
- StrBufAppendPrintf(Target, "%d", WCC->Policy[which].expire_mode);
+ StrBufAppendPrintf(Target, "%d", WC->Policy[which].expire_mode);
}
-void LoadZoneFiles(void)
-{
+void LoadZoneFiles(void) {
icalarray *zones;
int z;
long len;
Put(ZoneHash, HKEY("UTC"), ZName, HFreeStrBuf);
zones = icaltimezone_get_builtin_timezones();
for (z = 0; z < zones->num_elements; ++z) {
- /* syslog(9, "Location: %-40s tzid: %s\n",
+ /* syslog(LOG_DEBUG, "Location: %-40s tzid: %s\n",
icaltimezone_get_location(icalarray_element_at(zones, z)),
icaltimezone_get_tzid(icalarray_element_at(zones, z))
); */
{CFG_STR, 0, 0, "", HKEY("c_smtps_port")},
{CFG_YES, 0, 0, "", HKEY("c_enable_fulltext")},
{CFG_YES, 0, 0, "", HKEY("c_auto_cull")},
- {CFG_YES, 0, 0, "", HKEY("c_instant_expunge")},
+ {CFG_YES, 0, 0, "", HKEY("reserved3")},
{CFG_YES, 0, 0, "", HKEY("c_allow_spoofing")},
{CFG_YES, 0, 0, "", HKEY("c_journal_email")},
{CFG_YES, 0, 0, "", HKEY("c_journal_pubmsgs")},
{CFG_STR, 0, 0, "", HKEY("c_pop3_fetch")},
{CFG_STR, 0, 0, "", HKEY("c_pop3_fastest")},
{CFG_YES, 0, 0, "", HKEY("c_spam_flag_only")},
- {CFG_YES, 0, 0, "", HKEY("c_guest_logins")}
+ {CFG_YES, 0, 0, "", HKEY("c_guest_logins")},
+ {CFG_STR, 0, 0, "", HKEY("c_port_number")},
+ {CFG_STR, 0, 0, "", HKEY("c_ctdluid")},
+ {CFG_STR, 0, 0, "", HKEY("c_nntp_port")},
+ {CFG_STR, 0, 0, "", HKEY("c_nntps_port")},
+ {CFG_YES, 0, 0, "", HKEY("smtp_advertise_starttls")}
};
-
/*
* display all configuration items
*/
-void load_siteconfig(void)
-{
- wcsession *WCC = WC;
+void load_siteconfig(void) {
StrBuf *Buf;
HashList *Cfg;
long len;
int i, j;
- if (WCC->ServCfg == NULL)
- WCC->ServCfg = NewHash(1, NULL);
- Cfg = WCC->ServCfg;
+ if (WC->ServCfg == NULL)
+ WC->ServCfg = NewHash(1, NULL);
+ Cfg = WC->ServCfg;
Buf = NewStrBuf();
}
-
/*
* parse siteconfig changes
*/
-void siteconfig(void)
-{
- wcsession *WCC = WC;
+void siteconfig(void) {
int i, value;
StrBuf *Line;
SaveExpirePolicyFromHTTP(sitepolicy);
SaveExpirePolicyFromHTTP(mailboxespolicy);
- FreeStrBuf(&WCC->serv_info->serv_default_cal_zone);
- WCC->serv_info->serv_default_cal_zone = NewStrBufDup(sbstr("c_default_cal_zone"));
+ FreeStrBuf(&WC->serv_info->serv_default_cal_zone);
+ WC->serv_info->serv_default_cal_zone = NewStrBufDup(sbstr("c_default_cal_zone"));
AppendImportantMessage(_("Your system configuration has been updated."), -1);
- DeleteHash(&WCC->ServCfg);
+ DeleteHash(&WC->ServCfg);
display_aide_menu();
}
-void tmplput_servcfg(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
+
+// if WebCit Classic wasn't obsolete we would replace this with a "CONF GETVAL" type of thing
+void tmplput_servcfg(StrBuf *Target, WCTemplputParams *TP) {
void *vBuf;
StrBuf *Buf;
- if (WCC->is_aide) {
- if (WCC->ServCfg == NULL)
+ if (WC->is_aide) {
+ if (WC->ServCfg == NULL)
load_siteconfig();
- GetHash(WCC->ServCfg, TKEY(0), &vBuf);
+ GetHash(WC->ServCfg, TKEY(0), &vBuf);
Buf = (StrBuf*) vBuf;
StrBufAppendTemplate(Target, TP, Buf, 1);
}
}
-int ConditionalServCfg(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
+
+int ConditionalServCfg(StrBuf *Target, WCTemplputParams *TP) {
void *vBuf;
StrBuf *Buf;
- if (WCC->is_aide) {
- if (WCC->ServCfg == NULL)
+ if (WC->is_aide) {
+ if (WC->ServCfg == NULL)
load_siteconfig();
- GetHash(WCC->ServCfg, TKEY(2), &vBuf);
+ GetHash(WC->ServCfg, TKEY(2), &vBuf);
if (vBuf == NULL) return 0;
Buf = (StrBuf*) vBuf;
if (TP->Tokens->nParameters == 3) {
else return 0;
}
-int ConditionalServCfgCTXStrBuf(StrBuf *Target, WCTemplputParams *TP)
-{
- wcsession *WCC = WC;
+int ConditionalServCfgCTXStrBuf(StrBuf *Target, WCTemplputParams *TP) {
void *vBuf;
StrBuf *Buf;
StrBuf *ZoneToCheck = (StrBuf*) CTX(CTX_STRBUF);
- if ((WCC->is_aide) || (ZoneToCheck == NULL)) {
- if (WCC->ServCfg == NULL)
+ if ((WC->is_aide) || (ZoneToCheck == NULL)) {
+ if (WC->ServCfg == NULL)
load_siteconfig();
- GetHash(WCC->ServCfg, TKEY(2), &vBuf);
+ GetHash(WC->ServCfg, TKEY(2), &vBuf);
if (vBuf == NULL) return 0;
Buf = (StrBuf*) vBuf;
StrBufAppendTemplate(Target, TP, Stat->Name, 1);
}
+
+
int ConditionalServCfgThisLogEnabled(StrBuf *Target, WCTemplputParams *TP)
{
LogStatusStruct *Stat = (LogStatusStruct*) CTX(CTX_SRVLOG);
WebcitAddUrlHandler(HKEY("siteconfig"), "", 0, siteconfig, CTX_NONE);
RegisterNamespace("SERV:CFG", 1, 2, tmplput_servcfg, NULL, CTX_NONE);
- RegisterConditional(HKEY("COND:SERVCFG"), 3, ConditionalServCfg, CTX_NONE);
- RegisterConditional(HKEY("COND:SERVCFG:CTXSTRBUF"), 4, ConditionalServCfgCTXStrBuf, CTX_STRBUF);
+ RegisterConditional("COND:SERVCFG", 3, ConditionalServCfg, CTX_NONE);
+ RegisterConditional("COND:SERVCFG:CTXSTRBUF", 4, ConditionalServCfgCTXStrBuf, CTX_STRBUF);
RegisterIterator("PREF:ZONE", 0, ZoneHash, NULL, NULL, NULL, CTX_STRBUF, CTX_NONE, IT_NOFLAG);
REGISTERTokenParamDefine(roompolicy);
REGISTERTokenParamDefine(CFG_SMTP_FROM_CORRECT);
REGISTERTokenParamDefine(CFG_SMTP_FROM_REJECT);
- RegisterConditional(HKEY("COND:EXPIRE:MODE"), 2, ConditionalExpire, CTX_NONE);
+ RegisterConditional("COND:EXPIRE:MODE", 2, ConditionalExpire, CTX_NONE);
RegisterNamespace("EXPIRE:VALUE", 1, 2, tmplput_ExpireValue, NULL, CTX_NONE);
RegisterNamespace("EXPIRE:MODE", 1, 2, tmplput_ExpireMode, NULL, CTX_NONE);
-
- RegisterConditional(HKEY("COND:SERVCFG:THISLOGENABLE"), 4, ConditionalServCfgThisLogEnabled, CTX_SRVLOG);
+ RegisterConditional("COND:SERVCFG:THISLOGENABLE", 4, ConditionalServCfgThisLogEnabled, CTX_SRVLOG);
RegisterIterator("SERVCFG:LOGENABLE", 0, NULL, iterate_GetSrvLogEnable, NULL, DeleteHash, CTX_SRVLOG, CTX_NONE, IT_NOFLAG);
RegisterNamespace("SERVCFG:LOGNAME", 0, 1, tmplput_servcfg_LogName, NULL, CTX_SRVLOG);
}