]> andersk Git - mod-vhost-ldap.git/blobdiff - mod_vhost_ldap.c
Hard-code ~username for LDAP vhosts.
[mod-vhost-ldap.git] / 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.024303 seconds and 4 git commands to generate.