]> andersk Git - mod-vhost-ldap.git/commitdiff
Hard-code ~username for LDAP vhosts. scripts-rebased scripts-rebased.r1608
authorGreg Brockman <gdb@mit.edu>
Sun, 15 Aug 2010 14:51:37 +0000 (10:51 -0400)
committerAnders Kaseorg <andersk@mit.edu>
Fri, 18 Mar 2011 06:36:56 +0000 (02:36 -0400)
Signed-off-by: Geoffrey Thomas <geofft@mit.edu>
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
[gdb@mit.edu: Reimplement using mod_userdir]

mod_vhost_ldap.c

index 0c78330bba7d2c3fe933e14a4d785a905598667d..6bc67fc2e0fc1406ab56cc9a96a1a0c81b4d552b 100644 (file)
@@ -51,6 +51,7 @@
 
 #define MIN_UID 100
 #define MIN_GID 100
+const char USERDIR[] = "web_scripts";
 
 #define MAX_FAILURES 5
 
@@ -650,6 +651,30 @@ null:
        return HTTP_INTERNAL_SERVER_ERROR;
     }
 
+    if (reqc->uid != NULL) {
+       char *username;
+       char *userdir_val;
+       uid_t uid = (uid_t) atoll(reqc->uid);
+
+       if ((code = reconfigure_directive(r->pool, server, "UserDir", USERDIR)) != 0)
+           return code;
+
+        /* Deal with ~ expansion */
+        if ((code = reconfigure_directive(r->pool, server, "UserDir", "disabled")) != 0)
+            return code;
+
+       if (apr_uid_name_get(&username, uid, r->pool) != APR_SUCCESS) {
+           ap_log_rerror(APLOG_MARK, APLOG_ERR|APLOG_NOERRNO, 0, r, 
+                         "could not get username for uid %d", uid);
+           return HTTP_INTERNAL_SERVER_ERROR;
+       }
+
+        userdir_val = apr_pstrcat(r->pool, "enabled ", username, (const char *)NULL);
+
+       if ((code = reconfigure_directive(r->pool, server, "UserDir", userdir_val)) != 0)
+           return code;
+    }
+
     ap_fixup_virtual_host(r->pool, r->server, server);
     r->server = server;
 
This page took 0.040144 seconds and 5 git commands to generate.