]> granicus.if.org Git - apache/commitdiff
Merge r1497371 from trunk:
authorEric Covener <covener@apache.org>
Wed, 25 Jun 2014 21:58:31 +0000 (21:58 +0000)
committerEric Covener <covener@apache.org>
Wed, 25 Jun 2014 21:58:31 +0000 (21:58 +0000)
authnzldap: support "none" as a filter to suppress using a search filter,
which is required by some mainframe security products serving native
registry over LDAP.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1605618 13f79535-47bb-0310-9956-ffa450edef68

CHANGES
STATUS
docs/manual/mod/mod_authnz_ldap.html.en
docs/manual/mod/mod_authnz_ldap.xml
modules/aaa/mod_authnz_ldap.c

diff --git a/CHANGES b/CHANGES
index 2545574852cfc750995ee56a8eb1c6a62e979385..b00118a08dcbd3d858dc658a65b1d34ba90543f9 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@
 
 Changes with Apache 2.4.10
 
+  *) mod_authnz_ldap: Support primitive LDAP servers do not accept
+     filters, such as "SDBM-backed LDAP" on z/OS, by allowing a special
+     filter "none" to be specified in AuthLDAPURL. [Eric Covener]
+
   *) mod_deflate: Fix inflation of files larger than 4GB. PR 56062.
      [Lukas Bezdicka <social v3.sk>]
 
diff --git a/STATUS b/STATUS
index abbb4759448c3d5048f5a004c6db17eec067bbb0..5769a106240226fc908b4b079c23ef0643fcddcd 100644 (file)
--- a/STATUS
+++ b/STATUS
@@ -100,15 +100,6 @@ RELEASE SHOWSTOPPERS:
 PATCHES ACCEPTED TO BACKPORT FROM TRUNK:
   [ start all new proposals below, under PATCHES PROPOSED. ]
 
-   * mod_authnz_ldap: Support primitive LDAP servers do not accept
-     filters, such as "SDBM-backed LDAP" on z/OS, by allowing a special
-     filter "none" to be specified in AuthLDAPURL.
-     trunk patch: https://svn.apache.org/r1497371
-     2.4.x patch: trunk patch works other than CHANGES
-     +1: minfrin, covener, trawick
-     jailletc36: When merged, a compatibility note should be added in the doc stating when
-                 the none keyword has been added
-
    * event MPM: fix a race where a worker looks at a conn_rec after it might be
                 in use by another thread or may have been freed and 
                 re-allocated.
index ee34beffa38fa8e2aa0a9ad5ba7ff7c2704fe576..21e69f7af2adaba51cdda2fd32aeaefa7c4e072c 100644 (file)
@@ -1346,7 +1346,9 @@ You can of course use search parameters on each of these.</p>
         will search for all objects in the tree. Filters are
         limited to approximately 8000 characters (the definition of
         <code>MAX_STRING_LEN</code> in the Apache source code). This
-        should be more than sufficient for any application.</dd>
+        should be more than sufficient for any application. In 2.4.10 and later,
+        The word "none" may be used to not use any filter, which may be 
+        required by some primitive LDAP servers.</dd>
 </dl>
 
     <p>When doing searches, the attribute, filter and username passed
index 5f697e30eb736035c6a9d0b47dad9830de1b4b00..1513bd8cb007c7b5e6e40596b57b9d5f2cdc4d57 100644 (file)
@@ -1325,7 +1325,9 @@ You can of course use search parameters on each of these.</p>
         will search for all objects in the tree. Filters are
         limited to approximately 8000 characters (the definition of
         <code>MAX_STRING_LEN</code> in the Apache source code). This
-        should be more than sufficient for any application.</dd>
+        should be more than sufficient for any application. In 2.4.10 and later,
+        The word "none" may be used to not use any filter, which may be 
+        required by some primitive LDAP servers.</dd>
 </dl>
 
     <p>When doing searches, the attribute, filter and username passed
index 77644ca88e9397cdd596c3e3a5cb4ddf916795f7..211e4f74850d9e4e3839b483398bd200bb9cf5e8 100644 (file)
@@ -217,6 +217,7 @@ static void authn_ldap_build_filter(char *filtbuf,
     apr_size_t inbytes;
     apr_size_t outbytes;
     char *outbuf;
+    int nofilter = 0;
 
     if (sent_user != NULL) {
         user = apr_pstrdup (r->pool, sent_user);
@@ -249,7 +250,13 @@ static void authn_ldap_build_filter(char *filtbuf,
      * Create the first part of the filter, which consists of the
      * config-supplied portions.
      */
-    apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", filter, sec->attribute);
+
+    if ((nofilter = (filter && !strcasecmp(filter, "none")))) { 
+        apr_snprintf(filtbuf, FILTER_LENGTH, "(%s=", sec->attribute);
+    }
+    else { 
+        apr_snprintf(filtbuf, FILTER_LENGTH, "(&(%s)(%s=", filter, sec->attribute);
+    }
 
     /*
      * Now add the client-supplied username to the filter, ensuring that any
@@ -303,8 +310,16 @@ static void authn_ldap_build_filter(char *filtbuf,
      * Append the closing parens of the filter, unless doing so would
      * overrun the buffer.
      */
-    if (q + 2 <= filtbuf_end)
-        strcat(filtbuf, "))");
+
+    if (nofilter) { 
+        if (q + 1 <= filtbuf_end)
+            strcat(filtbuf, ")");
+    } 
+    else { 
+        if (q + 2 <= filtbuf_end)
+            strcat(filtbuf, "))");
+    }
+
 }
 
 static void *create_authnz_ldap_dir_config(apr_pool_t *p, char *d)
@@ -545,6 +560,11 @@ static authn_status authn_ldap_check_password(request_rec *r, const char *user,
                       "user %s authentication failed; URI %s [%s][%s]",
                       user, r->uri, ldc->reason, ldap_err2string(result));
 
+        /* talking to a primitive LDAP server (like RACF-over-LDAP) that doesn't return specific errors */
+        if (!strcasecmp(sec->filter, "none") && LDAP_OTHER == result) { 
+            return AUTH_USER_NOT_FOUND;
+        }
+
         return (LDAP_NO_SUCH_OBJECT == result) ? AUTH_USER_NOT_FOUND
 #ifdef LDAP_SECURITY_ERROR
                  : (LDAP_SECURITY_ERROR(result)) ? AUTH_DENIED