Catch LDAP constraint violation
authorAlan T. DeKok <aland@freeradius.org>
Mon, 30 Aug 2010 13:18:48 +0000 (15:18 +0200)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 30 Aug 2010 13:36:31 +0000 (15:36 +0200)
closed bug #18

src/modules/rlm_ldap/rlm_ldap.c

index c5ef9f0..205bd3a 100644 (file)
@@ -1719,7 +1719,9 @@ static int ldap_authorize(void *instance, REQUEST * request)
        */
        if (debug_flag > 1) {
               if (!pairfind(request->config_items, PW_CLEARTEXT_PASSWORD, 0) &&
-                  !pairfind(request->config_items, PW_USER_PASSWORD, 0)) {
+                  !pairfind(request->config_items, PW_USER_PASSWORD, 0) &&
+                  !pairfind(request->config_items, PW_PASSWORD_WITH_HEADER, 0) &&
+                  !pairfind(request->config_items, PW_CRYPT_PASSWORD, 0)) {
                       DEBUG("WARNING: No \"known good\" password was found in LDAP.  Are you sure that the user is configured correctly?");
               }
        }
@@ -2488,6 +2490,14 @@ static LDAP *ldap_connect(void *instance, const char *dn, const char *password,
                }
                break;
 
+       case LDAP_CONSTRAINT_VIOLATION:
+               DEBUG("rlm_ldap: Bind failed with constraint violation");
+               *result = RLM_MODULE_REJECT;
+               if(err != NULL){
+                       ldap_get_option(ld, LDAP_OPT_ERROR_STRING, err);
+               }
+               break;
+
        default:
                if (inst->is_url) {
                        radlog(L_ERR,"  [%s] %s bind to %s failed %s", inst->xlat_name,