#include "control.h"
#include "support.h"
#include "citserver.h"
+#include "config.h"
#include "citadel_ldap.h"
#include "ctdl_module.h"
#include "user_ops.h"
if (who->axlevel <= AxProbU) return(0);
/* Globally enabled? */
- if (config.c_restrict == 0) return(1);
+ if (CtdlGetConfigInt("c_restrict") == 0) return(1);
/* User flagged ok? */
if (who->flags & US_INTERNET) return(2);
return(-1);
}
- if ((required_level >= ac_logged_in_or_guest) && (CC->logged_in == 0) && (!config.c_guest_logins)) {
+ if ((required_level >= ac_logged_in_or_guest) && (CC->logged_in == 0) && (CtdlGetConfigInt("c_guest_logins") == 0)) {
cprintf("%d Not logged in.\n", ERROR + NOT_LOGGED_IN);
return(-1);
}
/* If a "master user" is defined, handle its authentication if specified */
CC->is_master = 0;
- if ((configlen.c_master_user > 0) &&
- (configlen.c_master_pass > 0) &&
- (authname != NULL) &&
- (!strcasecmp(authname, config.c_master_user)))
+ if ( (!IsEmptyStr(CtdlGetConfigStr("c_master_user"))) &&
+ (!IsEmptyStr(CtdlGetConfigStr("c_master_pass"))) &&
+ (authname != NULL) &&
+ (!strcasecmp(authname, CtdlGetConfigStr("c_master_user"))) )
{
CC->is_master = 1;
}
return login_not_found;
}
- if (config.c_auth_mode == AUTHMODE_HOST) {
+ if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
/* host auth mode */
}
#ifdef HAVE_LDAP
- else if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
+ else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
/* LDAP auth mode */
char ldap_cn[256];
char ldap_dn[256];
- found_user = CtdlTryUserLDAP(username, ldap_dn, sizeof ldap_dn, ldap_cn, sizeof ldap_cn, &ldap_uid);
+ found_user = CtdlTryUserLDAP(username, ldap_dn, sizeof ldap_dn, ldap_cn, sizeof ldap_cn, &ldap_uid, 0);
if (found_user != 0) {
return login_not_found;
}
/* 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, config.c_sysadm)) {
+ if (!strcasecmp(CCC->user.fullname, CtdlGetConfigStr("c_sysadm"))) {
CCC->user.axlevel = AxAideU;
}
/* If we're authenticating off the host system, automatically give
* root the highest level of access.
*/
- if (config.c_auth_mode == AUTHMODE_HOST) {
+ if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
if (CCC->user.uid == 0) {
CCC->user.axlevel = AxAideU;
}
* the vCard module's login hook runs.
*/
snprintf(CCC->cs_inet_email, sizeof CCC->cs_inet_email, "%s@%s",
- CCC->user.fullname, config.c_fqdn);
+ CCC->user.fullname, CtdlGetConfigStr("c_fqdn"));
convert_spaces_to_underscores(CCC->cs_inet_email);
/* Create any personal rooms required by the system.
PerformSessionHooks(EVT_LOGIN);
/* Enter the lobby */
- CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
+ CtdlUserGoto(CtdlGetConfigStr("c_baseroom"), 0, 0, NULL, NULL, NULL, NULL);
}
}
if (CCC->is_master) {
- code = strcmp(password, config.c_master_pass);
+ code = strcmp(password, CtdlGetConfigStr("c_master_pass"));
}
- else if (config.c_auth_mode == AUTHMODE_HOST) {
+ else if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
/* host auth mode */
}
#ifdef HAVE_LDAP
- else if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
+ else if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
/* LDAP auth mode */
usbuf->timescalled = 0;
usbuf->posted = 0;
- usbuf->axlevel = config.c_initax;
+ usbuf->axlevel = CtdlGetConfigInt("c_initax");
usbuf->lastcall = time(NULL);
/* fetch a new user number */
strproc(username);
- if (config.c_auth_mode == AUTHMODE_HOST) {
+ if (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_HOST) {
/* host auth mode */
}
#ifdef HAVE_LDAP
- if ((config.c_auth_mode == AUTHMODE_LDAP) || (config.c_auth_mode == AUTHMODE_LDAP_AD)) {
- if (CtdlTryUserLDAP(username, NULL, 0, username, sizeof username, &uid) != 0) {
+ if ((CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP) || (CtdlGetConfigInt("c_auth_mode") == AUTHMODE_LDAP_AD)) {
+ if (CtdlTryUserLDAP(username, NULL, 0, username, sizeof username, &uid, 0) != 0) {
return(ERROR + NO_SUCH_USER);
}
}
visit vbuf;
/* On some systems, Admins are not allowed to forget rooms */
- if (is_aide() && (config.c_aide_zap == 0)
+ if (is_aide() && (CtdlGetConfigInt("c_aide_zap") == 0)
&& ((CC->room.QRflags & QR_MAILBOX) == 0) ) {
return(1);
}
CtdlPutUserLock(&CC->user);
/* Return to the Lobby, so we don't end up in an undefined room */
- CtdlUserGoto(config.c_baseroom, 0, 0, NULL, NULL, NULL, NULL);
+ CtdlUserGoto(CtdlGetConfigStr("c_baseroom"), 0, 0, NULL, NULL, NULL, NULL);
return(0);
}