]> andersk Git - mod-vhost-ldap.git/blobdiff - mod_vhost_ldap.c
updated make archive script in Makefile
[mod-vhost-ldap.git] / mod_vhost_ldap.c
index c0351662aae376c0467f9690261180896f891a07..a66e069ae43a108f53dead7d342530cc5c1f3795 100644 (file)
@@ -20,6 +20,8 @@
  * mod_vhost_ldap.c --- read virtual host config from LDAP directory
  */
 
+#define CORE_PRIVATE
+
 #include <unistd.h>
 
 #include "httpd.h"
 #include "unixd.h"              /* Contains the suexec_identity hook used on Unix */
 #endif
 
-#define MIN_UID 1000
-#define MIN_GID 1000
+#define MIN_UID 100
+#define MIN_GID 100
 
 module AP_MODULE_DECLARE_DATA vhost_ldap_module;
 
 typedef struct mod_vhost_ldap_config_t {
     apr_pool_t *pool;                  /* Pool that this config is allocated from */
-#if APR_HAS_THREADS
-    apr_thread_mutex_t *lock;           /* Lock for this config */
-#endif
     int enabled;                       /* Is vhost_ldap enabled? */
 
     /* These parameters are all derived from the VhostLDAPURL directive */
@@ -79,7 +78,7 @@ typedef struct mod_vhost_ldap_request_t {
     char *name;                                /* ServerName */
     char *admin;                       /* ServerAdmin */
     char *docroot;                     /* DocumentRoot */
-    char *cgiroot;                     /* ScripAlias */
+    char *cgiroot;                     /* ScriptAlias */
     char *uid;                         /* Suexec Uid */
     char *gid;                         /* Suexec Gid */
 } mod_vhost_ldap_request_t;
@@ -98,7 +97,7 @@ static int mod_vhost_ldap_post_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_
 
     }
 
-    ap_add_version_component(p, "mod_vhost_ldap/0.2.1");
+    ap_add_version_component(p, MOD_VHOST_LDAP_VERSION);
 
     return OK;
 }
@@ -111,10 +110,6 @@ mod_vhost_ldap_create_server_config (apr_pool_t *p, server_rec *s)
 
     cfg->pool = p;
 
-#if APR_HAS_THREADS
-    apr_thread_mutex_create(&cfg->lock, APR_THREAD_MUTEX_DEFAULT, p);
-#endif
-
     cfg->enabled = 0;
     cfg->have_ldap_url = 0;
     cfg->url = "";
@@ -290,7 +285,7 @@ static const char *mod_vhost_ldap_set_deref(cmd_parms *cmd, void *dummy, const c
 
 command_rec mod_vhost_ldap_cmds[] = {
     AP_INIT_TAKE1("VhostLDAPURL", mod_vhost_ldap_parse_url, NULL, RSRC_CONF,
-                  "URL to define LDAP connection. This should be an RFC 2255 complaint\n"
+                  "URL to define LDAP connection. This should be an RFC 2255 compliant\n"
                   "URL of the form ldap://host[:port]/basedn[?attrib[?scope[?filter]]].\n"
                   "<ul>\n"
                   "<li>Host is the name of the LDAP server. Use a space separated list of hosts \n"
@@ -309,7 +304,7 @@ command_rec mod_vhost_ldap_cmds[] = {
                  "Set to off to disable vhost_ldap, even if it's been enabled in a higher tree"),
 
     AP_INIT_TAKE1("VhostLDAPDereferenceAliases", mod_vhost_ldap_set_deref, NULL, RSRC_CONF,
-                  "Determines how aliases are handled during a search. Can bo one of the"
+                  "Determines how aliases are handled during a search. Can be one of the"
                   "values \"never\", \"searching\", \"finding\", or \"always\". "
                   "Defaults to always."),
 
@@ -326,7 +321,8 @@ mod_vhost_ldap_translate_name (request_rec * r)
     char filtbuf[FILTER_LENGTH];
     mod_vhost_ldap_config_t *cfg =
        (mod_vhost_ldap_config_t *)ap_get_module_config(r->server->module_config, &vhost_ldap_module);
-
+    core_server_config * core =
+       (core_server_config *) ap_get_module_config(r->server->module_config, &core_module);
     util_ldap_connection_t *ldc = NULL;
     int result = 0;
     const char *dn = NULL;
@@ -427,17 +423,16 @@ start_over:
        if (cgi && (cgi != r->uri + strspn(r->parsed_uri.path, "/"))) {
            cgi = NULL;
        }
-    
-       if (cgi) {
-           r->filename =
-               apr_pstrcat (r->pool, req->cgiroot, cgi + strlen("cgi-bin"), NULL);
-           r->handler = "cgi-script";
-           apr_table_setn(r->notes, "alias-forced-type", r->handler);
-       } else {
-           
-           r->filename =
-               apr_pstrcat (r->pool, req->docroot, r->parsed_uri.path, NULL);
-       }
+    }
+
+    if (cgi) {
+       r->filename =
+           apr_pstrcat (r->pool, req->cgiroot, cgi + strlen("cgi-bin"), NULL);
+       r->handler = "cgi-script";
+       apr_table_setn(r->notes, "alias-forced-type", r->handler);
+    } else {
+       r->filename =
+           apr_pstrcat (r->pool, req->docroot, r->parsed_uri.path, NULL);
     }
 
     r->server->server_hostname = apr_pstrdup (r->pool, req->name);
@@ -450,6 +445,8 @@ start_over:
     e = r->subprocess_env;
     apr_table_addn (e, "SERVER_ROOT", req->docroot);
 
+    core->ap_document_root = apr_pstrdup(r->pool, req->docroot);
+
     ap_log_rerror(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, r,
                  "[mod_vhost_ldap.c]: translated to %s", r->filename);
 
@@ -486,7 +483,7 @@ static ap_unix_identity_t *mod_vhost_ldap_get_suexec_id_doer(const request_rec *
   uid = (uid_t)atoll(req->uid);
   gid = (gid_t)atoll(req->gid);
 
-  if ((uid <= MIN_UID)||(gid <= MIN_GID)) {
+  if ((uid < MIN_UID)||(gid < MIN_GID)) {
       return NULL;
   }
 
This page took 0.03162 seconds and 4 git commands to generate.