* 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 */
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;
}
- ap_add_version_component(p, "mod_vhost_ldap/0.2.1");
+ ap_add_version_component(p, MOD_VHOST_LDAP_VERSION);
return OK;
}
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 = "";
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"
"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."),
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;
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);
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);
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;
}