]> andersk Git - mod-vhost-ldap.git/commitdiff
mod_vhost_ldap: Fix /~user URLs.
authorAnders Kaseorg <andersk@mit.edu>
Sat, 17 Jul 2010 22:53:37 +0000 (22:53 +0000)
committerAnders Kaseorg <andersk@mit.edu>
Sat, 17 Jul 2010 22:53:37 +0000 (22:53 +0000)
This also re-enables the upstream apacheScriptAlias handling that was
previously disabled for no good reason (we don’t use it, but its
existence isn’t harmful), and fixes the same problem in it.  The patch
has been sent upstream to http://bugs.debian.org/589461 .

git-svn-id: svn://scripts.mit.edu/trunk@1589 db9d59ff-b01e-0410-9b1a-cd9a8c06840f

mod_vhost_ldap.c

index 807bc13ae7ff7365a291d94e893ed6745f944365..d95b89eb002f81766fe224110143c062fd256c8b 100644 (file)
@@ -453,6 +453,7 @@ static int mod_vhost_ldap_translate_name(request_rec *r)
     int sleep1 = 1;
     int sleep;
     struct berval hostnamebv, shostnamebv;
+    int ret = DECLINED;
 
     reqc =
        (mod_vhost_ldap_request_t *)apr_pcalloc(r->pool, sizeof(mod_vhost_ldap_request_t));
@@ -607,7 +608,6 @@ null:
 
     cgi = NULL;
 
-#if 0
     if (reqc->cgiroot) {
        cgi = strstr(r->uri, "cgi-bin/");
        if (cgi && (cgi != r->uri + strspn(r->uri, "/"))) {
@@ -624,12 +624,11 @@ null:
          r->filename = cgi;
          r->handler = "cgi-script";
          apr_table_setn(r->notes, "alias-forced-type", r->handler);
+         ret = OK;
        }
-#endif
-    /* This is a quick, dirty hack. I should be shot for taking 6.170
-     * this term and being willing to write a quick, dirty hack. */
-    
-    if (strncmp(r->uri, "/~", 2) == 0) {
+    } else if (strncmp(r->uri, "/~", 2) == 0) {
+        /* This is a quick, dirty hack. I should be shot for taking 6.170
+         * this term and being willing to write a quick, dirty hack. */    
        char *username;
        uid_t uid = (uid_t)atoll(reqc->uid);
        if (apr_uid_name_get(&username, uid, r->pool) != APR_SUCCESS) {
@@ -647,6 +646,7 @@ null:
                return DECLINED;
            }
            r->filename = apr_pstrcat(r->pool, homedir, "/", USERDIR, r->uri + 2 + strlen(username), NULL);
+           ret = OK;
        }
     } else if (r->uri[0] == '/') {
         /* we don't set r->filename here, and let other modules do it
@@ -712,7 +712,7 @@ null:
     }
 
     /* Hack to allow post-processing by other modules (mod_rewrite, mod_alias) */
-    return DECLINED;
+    return ret;
 }
 
 #ifdef HAVE_UNIX_SUEXEC
This page took 0.091821 seconds and 5 git commands to generate.