]> andersk Git - mod-vhost-ldap.git/commitdiff
Also check wildcard entries before falling back on the default.
authorGeoffrey Thomas <geofft@mit.edu>
Thu, 6 Mar 2008 00:56:07 +0000 (00:56 +0000)
committerGeoffrey Thomas <geofft@mit.edu>
Thu, 6 Mar 2008 00:56:07 +0000 (00:56 +0000)
git-svn-id: svn://scripts.mit.edu/server/common/oursrc/httpdmods@675 db9d59ff-b01e-0410-9b1a-cd9a8c06840f

mod_vhost_ldap.c

index 87996a9c1820e900e9ed74bdc7df53f0e67d05ea..4401fa3c35e130797362d3b23697b3da166c6c10 100644 (file)
@@ -505,6 +505,19 @@ fallback:
     }
 
     if ((result == LDAP_NO_SUCH_OBJECT)) {
+       char* parent_hostname = apr_pstrdup(r->pool, hostname);
+       do {
+           parent_hostname = strchr(parent_hostname + 1, '.');
+       } while (parent_hostname && parent_hostname[-1] != '*');
+       if (parent_hostname) {
+           *(--parent_hostname) = '*';
+           ap_log_rerror(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, 0, r,
+                         "[mod_vhost_ldap.c] translate: "
+                         "virtual host not found, trying wildcard %s",
+                         parent_hostname);
+           hostname = parent_hostname;
+           goto fallback;
+       }
        if (conf->fallback && (is_fallback++ <= 0)) {
            ap_log_rerror(APLOG_MARK, APLOG_NOTICE|APLOG_NOERRNO, 0, r,
                          "[mod_vhost_ldap.c] translate: "
This page took 0.142473 seconds and 5 git commands to generate.