From f2c07f3fa5c0904b970b6cc45416831f638a733f Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Tue, 7 Apr 2009 00:38:06 +0000 Subject: [PATCH] * Prepped portions of the code for imminent merge of LDAP auth module. --- citadel/citadel.h | 2 +- citadel/config.c | 8 ++++++++ citadel/server.h | 1 + citadel/user_ops.c | 16 ++++++++++++++++ 4 files changed, 26 insertions(+), 1 deletion(-) diff --git a/citadel/citadel.h b/citadel/citadel.h index e1248992a..92dfc5f6e 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -278,7 +278,7 @@ enum { */ #define AUTHMODE_NATIVE 0 /* Native (self-contained or "black box") */ #define AUTHMODE_HOST 1 /* Authenticate against the host OS user database */ -#define AUTHMODE_LDAP 2 /* External LDAP authentication (NOT IMPLEMENTED) */ +#define AUTHMODE_LDAP 2 /* Authenticate against an LDAP server */ #ifdef __cplusplus } diff --git a/citadel/config.c b/citadel/config.c index 309896742..948f03005 100644 --- a/citadel/config.c +++ b/citadel/config.c @@ -79,6 +79,14 @@ void get_config(void) { exit(CTDLEXIT_LIBCITADEL); } + /* Only allow LDAP auth mode if we actually have LDAP support */ +#ifndef HAVE_LDAP + if (config.c_auth_mode == AUTHMODE_LDAP) { + fprintf(stderr, "Your system is configured for LDAP authentication,\n" + "but you are running a server built without OpenLDAP support.\n"); + exit(CTDL_EXIT_UNSUP_AUTH); + } +#endif /* Check to see whether 'setup' must first be run to update data file formats */ if (config.c_setup_level < REV_MIN) { diff --git a/citadel/server.h b/citadel/server.h index 314c7ce25..13660559a 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -45,6 +45,7 @@ struct CtdlMessage { #define CTDLEXIT_OOD 104 /* Out Of Date config - rerun setup */ #define CTDLEXIT_DB 105 /* Unable to initialize database */ #define CTDLEXIT_LIBCITADEL 106 /* Incorrect version of libcitadel */ +#define CTDL_EXIT_UNSUP_AUTH 107 /* Unsupported auth mode configured */ diff --git a/citadel/user_ops.c b/citadel/user_ops.c index e9f5b6d11..60bce3fcc 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -541,6 +541,13 @@ int CtdlLoginExistingUser(char *authname, char *trythisname) } +#ifdef HAVE_LDAP + else if (config.c_auth_mode == AUTHMODE_LDAP) { + + /* LDAP auth mode FIXME_LDAP */ + } +#endif + else { /* native auth mode */ @@ -860,6 +867,13 @@ int CtdlTryPassword(char *password) } } +#ifdef HAVE_LDAP + else if (config.c_auth_mode == AUTHMODE_LDAP) { + + /* LDAP auth mode FIXME_LDAP */ + } +#endif + else { /* native auth mode */ @@ -1067,6 +1081,8 @@ int create_user(char *newusername, int become_user) return (ERROR + NO_SUCH_USER); } } + + /* FIXME_LDAP put something here */ if ((retval = internal_create_user(username, &usbuf, uid)) != 0) return retval; -- 2.30.2