* Prepped portions of the code for imminent merge of LDAP auth module.
authorArt Cancro <ajc@citadel.org>
Tue, 7 Apr 2009 00:38:06 +0000 (00:38 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 7 Apr 2009 00:38:06 +0000 (00:38 +0000)
citadel/citadel.h
citadel/config.c
citadel/server.h
citadel/user_ops.c

index e1248992a46f85599ccbb1220118f62e0feb86cd..92dfc5f6e6ec90dec7b20da6ef51cbed9373d3c6 100644 (file)
@@ -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
 }
index 30989674216419f9199770a92828db18bfacf3a8..948f030052f7e2d7ddba5512b9850889fc46019a 100644 (file)
@@ -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) {
index 314c7ce258020ced1a209d3127592b10a1091715..13660559aa807fd8b61b36e43156dee794829d8b 100644 (file)
@@ -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 */
 
 
 
index e9f5b6d11e41f410d4731520a798bf1ddf56747e..60bce3fcc6bf7b19b79be9d62b1aac1bab502027 100644 (file)
@@ -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;