/*
* Server functions which perform operations on user objects.
*
- * Copyright (c) 1987-2011 by the citadel.org team
+ * 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.
#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
*/
"Too many users are already online "
"(maximum is %d)\n",
ERROR + MAX_SESSIONS_EXCEEDED,
- config.c_nodename, config.c_maxsessions);
+ CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions"));
return;
case login_ok:
cprintf("%d Password required for %s\n",
long len;
char username[SIZ];
- if (config.c_auth_mode != AUTHMODE_NATIVE) {
+ if (CtdlGetConfigInt("c_auth_mode") != AUTHMODE_NATIVE) {
cprintf("%d This system does not use native mode authentication.\n",
ERROR + NOT_HERE);
return;
}
- if (config.c_disable_newu) {
+ if (CtdlGetConfigInt("c_disable_newu")) {
cprintf("%d Self-service user account creation "
"is disabled on this system.\n", ERROR + NOT_HERE);
return;
if (CC->nologin) {
cprintf("%d %s: Too many users are already online (maximum is %d)\n",
ERROR + MAX_SESSIONS_EXCEEDED,
- config.c_nodename, config.c_maxsessions);
+ CtdlGetConfigStr("c_nodename"), CtdlGetConfigInt("c_maxsessions"));
return;
}
extract_token(username, cmdbuf, 0, '|', sizeof username);
} else if (a == ERROR + ALREADY_EXISTS) {
cprintf("%d '%s' already exists.\n", ERROR + ALREADY_EXISTS, username);
return;
- } else if ( (config.c_auth_mode != AUTHMODE_NATIVE) && (a == ERROR + NO_SUCH_USER) ) {
+ } else if ( (CtdlGetConfigInt("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;
return;
}
- if (!strncasecmp(CC->room.QRname, config.c_baseroom,
+ if (!strncasecmp(CC->room.QRname, CtdlGetConfigStr("c_baseroom"),
ROOMNAMELEN)) {
cprintf("%d Can't add/remove users from this room.\n",
ERROR + NOT_HERE);
/*
- * 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"
#include "server.h"
#include "citserver.h"
#include "support.h"
-
#include "ctdl_module.h"
-
+#include "config.h"
#include "event_client.h"
#include "serv_curl.h"
OPT(WRITEDATA, (void *)IO);
OPT(ERRORBUFFER, IO->HttpReq.errdesc);
- 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"))
+ 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"))
)
{
- OPT(INTERFACE, config.c_ip_addr);
+ OPT(INTERFACE, CtdlGetConfigStr("c_ip_addr"));
}
#ifdef CURLOPT_HTTP_CONTENT_DECODING
/*
* Functions which manage expire policy for rooms
- * Copyright (c) 1987-2012 by the citadel.org team
+ * 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.
#include "support.h"
#include "msgbase.h"
#include "citserver.h"
-
+#include "config.h"
#include "ctdl_module.h"
#include "user_ops.h"
*/
if (qrbuf->QRflags & QR_MAILBOX) {
if (config.c_mbxep.expire_mode != 0) {
- memcpy(epbuf, &config.c_mbxep,
- sizeof(struct ExpirePolicy));
+ memcpy(epbuf, &config.c_mbxep, sizeof(struct ExpirePolicy));
return;
}
}
* Based on bits of serv_funambol
* Contact: <matt@mcbridematt.dhs.org> / <matt@comalies>
*
- * Copyright (c) 2008-2011
+ * Copyright (c) 2008-2015
*
* 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
*/
{
case eFunambol:
snprintf(remoteurl, SIZ, "http://%s@%s:%d/%s",
- config.c_funambol_auth,
- config.c_funambol_host,
- config.c_funambol_port,
+ CtdlGetConfigStr("c_funambol_auth"),
+ CtdlGetConfigStr("c_funambol_host"),
+ CtdlGetConfigInt("c_funambol_port"),
FUNAMBOL_WS);
notify_http_server(remoteurl,
int commandSiz;
char *command;
- commandSiz = sizeof(config.c_pager_program) +
+ commandSiz = sizeof(CtdlGetConfigStr("c_pager_program")) +
strlen(PagerNo) +
msg->cm_lengths[eExtnotify] + 5;
snprintf(command,
commandSiz,
"%s %s -u %s",
- config.c_pager_program,
+ CtdlGetConfigStr("c_pager_program"),
PagerNo,
msg->cm_fields[eExtnotify]);
* don't really require extremely fine granularity here, we'll do it
* with a static variable instead.
*/
- if (IsEmptyStr(config.c_pager_program) &&
- IsEmptyStr(config.c_funambol_host))
+ if (IsEmptyStr(CtdlGetConfigStr("c_pager_program")) &&
+ IsEmptyStr(CtdlGetConfigStr("c_funambol_host")))
{
syslog(LOG_ERR,
"No external notifiers configured on system/user\n");
/* If this is private, local mail, make a copy in the
* recipient's mailbox and bump the reference count.
*/
- if (!IsEmptyStr(config.c_funambol_host) || !IsEmptyStr(config.c_pager_program))
+ if (!IsEmptyStr(CtdlGetConfigStr("c_funambol_host")) || !IsEmptyStr(CtdlGetConfigStr("c_pager_program")))
{
/* Generate a instruction message for the Funambol notification
* server, in the same style as the SMTP queue
* Based on bits of the previous serv_funambol
* Contact: <matt@mcbridematt.dhs.org> / <matt@comalies>
*
- * Copyright (c) 2008-2010
+ * Copyright (c) 2008-2015
*
* 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>
// Do substitutions
help_subst(SOAPMessage, "^notifyuser", user);
- help_subst(SOAPMessage, "^syncsource",
- config.c_funambol_source);
+ help_subst(SOAPMessage, "^syncsource", CtdlGetConfigStr("c_funambol_source"));
help_subst(SOAPMessage, "^msgid", msgid);
help_subst(SOAPMessage, "^msgnum", msgnumstr);
}
else {
help_subst(remoteurl, "^notifyuser", user);
- help_subst(remoteurl, "^syncsource", config.c_funambol_source);
+ help_subst(remoteurl, "^syncsource", CtdlGetConfigStr("c_funambol_source"));
help_subst(remoteurl, "^msgid", msgid);
help_subst(remoteurl, "^msgnum", msgnumstr);
/*
* Don't do this if the site doesn't have it enabled.
*/
- if (!config.c_enable_fulltext) {
+ if (!CtdlGetConfigInt("c_enable_fulltext")) {
return;
}
if (CtdlAccessCheck(ac_logged_in)) return;
- if (!config.c_enable_fulltext) {
+ if (!CtdlGetConfigInt("c_enable_fulltext")) {
cprintf("%d Full text index is not enabled on this server.\n",
ERROR + CMD_NOT_SUPPORTED);
return;
if (room) return;
/* Remove from fulltext index */
- if (config.c_enable_fulltext) {
+ if (CtdlGetConfigInt("c_enable_fulltext")) {
ft_index_message(msgnum, 0);
}
}
* Implements the FETCH command in IMAP.
* This is a good example of the protocol's gratuitous complexity.
*
- * Copyright (c) 2001-2011 by the citadel.org team
+ * Copyright (c) 2001-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 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.
- *
- * 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
+ * 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.
*/
process_rfc822_addr(msg->cm_fields[erFc822Addr], user, node, name);
IPutStr(user, strlen(user)); /* mailbox name (user id) */
IAPuts(" ");
- if (!strcasecmp(node, config.c_nodename)) {
- IPutStr(CFG_KEY(c_fqdn));
+ if (!strcasecmp(node, CtdlGetConfigStr("c_nodename"))) {
+ IPutStr(CtdlGetConfigStr("c_fqdn"), strlen(CtdlGetConfigStr("c_fqdn")));
}
else {
IPutStr(node, strlen(node)); /* host name */
/*
- * Copyright (c) 1987-2011 by the citadel.org team
+ * 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 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
*/
IUnbuffer ();
- client_read_blob(Imap->TransmittedMessage, literal_length, config.c_sleeping);
+ client_read_blob(Imap->TransmittedMessage, literal_length, CtdlGetConfigInt("c_sleeping"));
if ((ret < 0) || (StrLength(Imap->TransmittedMessage) < literal_length)) {
IReply("NO Read failed.");
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. 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.
+ * show up as the real sender. (Configurable setting)
*/
if (CCC->logged_in) {
- 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));
- }
+ 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")));
+ }
}
/*
/*
* Implements IMAP's gratuitously complex SEARCH command.
*
- * Copyright (c) 2001-2012 by the citadel.org team
+ * Copyright (c) 2001-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 "ctdl_module.h"
/* If fulltext indexing is active, on this server,
* all messages have already been qualified.
*/
- if (config.c_enable_fulltext) {
+ if (CtdlGetConfigInt("c_enable_fulltext")) {
match = 1;
}
* text index to disqualify messages that don't have any chance of
* matching. (Only do this if the index is enabled!!)
*/
- if (config.c_enable_fulltext) for (i=0; i<(num_items-1); ++i) {
+ if (CtdlGetConfigInt("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) {
/*
* IMAP server for the Citadel system
*
- * Copyright (C) 2000-2011 by Art Cancro and others.
+ * Copyright (C) 2000-2015 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"
IAPuts("* OK [");
imap_output_capability_string();
- IAPrintf("] %s IMAP4rev1 %s ready\r\n", config.c_fqdn, CITADEL);
+ IAPrintf("] %s IMAP4rev1 %s ready\r\n", CtdlGetConfigStr("c_fqdn"), CITADEL);
IUnbuffer();
}
if (IMAP->selected) {
imap_do_expunge(); /* yes, we auto-expunge at logout */
}
- IAPrintf("* BYE %s logging out\r\n", config.c_fqdn);
+ IAPrintf("* BYE %s logging out\r\n", CtdlGetConfigStr("c_fqdn"));
IReply("OK Citadel IMAP session ended.");
CC->kill_me = KILLME_CLIENT_LOGGED_OUT;
return;
if (!threading)
{
CtdlRegisterDebugFlagHook(HKEY("imapsrv"), SetIMAPDebugEnabled, &IMAPDebugEnabled);
- CtdlRegisterServiceHook(config.c_imap_port,
+ CtdlRegisterServiceHook(CtdlGetConfigInt("c_imap_port"),
NULL, imap_greeting, imap_command_loop, NULL, CitadelServiceIMAP);
#ifdef HAVE_OPENSSL
- CtdlRegisterServiceHook(config.c_imaps_port,
+ CtdlRegisterServiceHook(CtdlGetConfigInt("c_imaps_port"),
NULL, imaps_greeting, imap_command_loop, NULL, CitadelServiceIMAPS);
#endif
CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP, PRIO_STOP + 30);
/*
* This module handles instant messaging between users.
*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * 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.
* 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>
(long)ptr->timestamp, /* time sent */
ptr->flags, /* flags */
ptr->sender, /* sender of msg */
- config.c_nodename, /* static for now (and possibly deprecated) */
+ CtdlGetConfigStr("c_nodename"), /* static for now (and possibly deprecated) */
ptr->sender_email /* email or jid of sender */
);
}
CM_SetField(msg, eOriginalRoom, HKEY(PAGELOGROOM));
- CM_SetField(msg, eNodeName, CFG_KEY(c_nodename));
+ CM_SetField(msg, eNodeName, CtdlGetConfigStr("c_nodename"), strlen(CtdlGetConfigStr("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],
}
/* Finally, if we're logging instant messages globally, do that now. */
- if (!IsEmptyStr(config.c_logpages)) {
- CtdlCreateRoom(config.c_logpages, 3, "", 0, 1, 1, VIEW_BBS);
- CtdlSaveMsgPointerInRoom(config.c_logpages, msgnum, 0, NULL);
+ if (!IsEmptyStr(CtdlGetConfigStr("c_logpages"))) {
+ CtdlCreateRoom(CtdlGetConfigStr("c_logpages"), 3, "", 0, 1, 1, VIEW_BBS);
+ CtdlSaveMsgPointerInRoom(CtdlGetConfigStr("c_logpages"), msgnum, 0, NULL);
}
}
* as this draft expires with this writing, you might need to search for
* the new one.
*
- * Copyright (c) 2007-2012 by the citadel.org team
+ * Copyright (c) 2007-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.
{
if (!threading)
{
- CtdlRegisterServiceHook(config.c_managesieve_port,
+ CtdlRegisterServiceHook(CtdlGetConfigInt("c_managesieve_port"),
NULL,
managesieve_greeting,
managesieve_command_loop,