#define VIEW_CALBRIEF 7 /* Brief Calendar view */
#define VIEW_JOURNAL 8 /* Journal view (not yet implemented in native clients) */
+/*
+ * Authentication modes
+ */
+#define AUTHMODE_NATIVE 0 /* native Citadel authentication */
+#define AUTHMODE_HOST 1 /* host integrated */
+
#ifdef __cplusplus
}
#endif
cprintf("0\n"); /* 1 = no, this server is not LDAP-enabled */
#endif
- if (config.c_auth_mode == 1) {
- cprintf("1\n"); /* "create new user" never works with host auth */
+ if (config.c_auth_mode == AUTHMODE_NATIVE) {
+ cprintf("%d\n", config.c_disable_newu);
}
else {
- cprintf("%d\n", config.c_disable_newu); /* otherwise, site defined */
+ cprintf("1\n"); /* "create new user" does not work with non-native auth modes */
}
cprintf("%s\n", config.c_default_cal_zone);
if (config.c_net_freq < 300L)
config.c_net_freq = 300L;
- /* "create new user" never works with host auth */
- if (config.c_auth_mode == 1)
+ /* "create new user" only works with native authentication mode */
+ if (config.c_auth_mode != AUTHMODE_NATIVE) {
config.c_disable_newu = 1;
+ }
}
lprintf(CTDL_DEBUG, "PurgeUsers() called\n");
users_not_purged = 0;
- if (config.c_auth_mode == 1) {
- /* host auth mode */
- ForEachUser(do_uid_user_purge, NULL);
- }
- else {
- /* native auth mode */
- if (config.c_userpurge > 0) {
- ForEachUser(do_user_purge, NULL);
- }
+ switch(config.c_auth_mode) {
+ case AUTHMODE_NATIVE:
+ if (config.c_userpurge > 0) {
+ ForEachUser(do_user_purge, NULL);
+ }
+ break;
+ case AUTHMODE_HOST:
+ ForEachUser(do_uid_user_purge, NULL);
+ break;
+ default:
+ lprintf(CTDL_DEBUG, "Unknown authentication mode!\n");
+ break;
}
transcript = malloc(SIZ);
/*
* If we need host auth, start our chkpwd daemon.
*/
- if (config.c_auth_mode == 1) {
+ if (config.c_auth_mode == AUTHMODE_HOST) {
start_chkpwd_daemon();
}
{
if (getenv("ENABLE_UNIX_AUTH")) {
if (!strcasecmp(getenv("ENABLE_UNIX_AUTH"), "yes")) {
- config.c_auth_mode = 1;
+ config.c_auth_mode = AUTHMODE_HOST;
}
else {
- config.c_auth_mode = 0;
+ config.c_auth_mode = AUTHMODE_NATIVE;
}
}
}
return login_not_found;
}
- if (config.c_auth_mode == 1) {
+ if (config.c_auth_mode == AUTHMODE_HOST) {
/* host auth mode */
/* If we're authenticating off the host system, automatically give
* root the highest level of access.
*/
- if (config.c_auth_mode == 1) {
+ if (config.c_auth_mode == AUTHMODE_HOST) {
if (CC->user.uid == 0) {
CC->user.axlevel = 6;
}
code = strcmp(password, config.c_master_pass);
}
- else if (config.c_auth_mode == 1) {
+ else if (config.c_auth_mode == AUTHMODE_HOST) {
/* host auth mode */
safestrncpy(username, newusername, sizeof username);
strproc(username);
- if (config.c_auth_mode == 1) {
+ if (config.c_auth_mode == AUTHMODE_HOST) {
/* host auth mode */
int a;
char username[26];
- if (config.c_auth_mode == 1) {
+ if (config.c_auth_mode != AUTHMODE_NATIVE) {
cprintf("%d This system does not use native mode authentication.\n",
ERROR + NOT_HERE);
return;
} else if (a == ERROR + ALREADY_EXISTS) {
cprintf("%d '%s' already exists.\n", ERROR + ALREADY_EXISTS, username);
return;
- } else if ( (config.c_auth_mode == 1) && (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;