Colin, thanks for the patch. It was far more than I had hoped for :).
The patch has been merged[*] into upstream and I have released new upstream version 2.4.0, which I have in turn packaged using your (slightly) modified patches and uploaded to unstable. Anders, do you still use the mod_vhost_ldap? Would you be so kind and test the new code? The patch from Colin looks good, but it still needs some testing from a real user. Thanks to all, Ondrej * – I just did drop all the << Apache 2.4 stuff, people wanting Apache 2.2 compatibility can still use 2.0.8 (which is problematic without the patched Apache 2.2 anyway). On Thu, Jul 11, 2013 at 4:18 PM, Colin Watson <cjwat...@debian.org> wrote: > On Thu, Jul 11, 2013 at 02:22:12PM +0200, Ondřej Surý wrote: > > there's one catch. The Apache 2.4 should have a new API and it should be > > able to set per request document_root. (It was proposed by me for this > > module and later SF submitted a tad bit different patch achieving the > same > > functionality.) > > > > And I just didn't have a time to lookup the new API and update the > upstream. > > I *think* this is right, but I have no real way to test it beyond > build-testing; so if you get a chance to look over this then that would > be very helpful. > > diff -Nru mod-vhost-ldap-2.0.8/debian/apache2 > mod-vhost-ldap-2.0.8/debian/apache2 > --- mod-vhost-ldap-2.0.8/debian/apache2 1970-01-01 01:00:00.000000000 +0100 > +++ mod-vhost-ldap-2.0.8/debian/apache2 2013-07-10 23:17:48.000000000 +0100 > @@ -0,0 +1,3 @@ > +mod .libs/mod_vhost_ldap.so > +mod debian/vhost_ldap.load > +mod debian/vhost_ldap.conf > diff -Nru mod-vhost-ldap-2.0.8/debian/changelog > mod-vhost-ldap-2.0.8/debian/changelog > --- mod-vhost-ldap-2.0.8/debian/changelog 2011-06-21 > 17:18:19.000000000 +0100 > +++ mod-vhost-ldap-2.0.8/debian/changelog 2013-07-10 > 23:18:58.000000000 +0100 > @@ -1,3 +1,10 @@ > +mod-vhost-ldap (2.0.8-1.1) UNRELEASED; urgency=low > + > + * Non-maintainer upload. > + * Port to Apache 2.4 (closes: #666813). > + > + -- Colin Watson <cjwat...@debian.org> Wed, 10 Jul 2013 23:18:48 +0100 > + > mod-vhost-ldap (2.0.8-1) unstable; urgency=low > > * Upstream release 2.0.8 > diff -Nru mod-vhost-ldap-2.0.8/debian/control > mod-vhost-ldap-2.0.8/debian/control > --- mod-vhost-ldap-2.0.8/debian/control 2011-06-21 17:18:19.000000000 +0100 > +++ mod-vhost-ldap-2.0.8/debian/control 2013-07-10 23:18:40.000000000 +0100 > @@ -3,13 +3,14 @@ > Priority: optional > Maintainer: Ondřej Surý <ond...@debian.org> > Standards-Version: 3.8.4 > -Build-Depends: debhelper (>> 7.0.52~), > +Build-Depends: debhelper (>> 7.2.11~), > quilt (>= 0.46-7~), > - apache2-threaded-dev (>= 2.2.3-3) > + dh-apache2, > + apache2-dev (>= 2.2.3-3) > > Package: libapache2-mod-vhost-ldap > Architecture: any > -Depends: ${shlibs:Depends}, ${misc:Depends}, apache2.2-common > +Depends: ${shlibs:Depends}, ${misc:Depends} > Description: Apache 2 module for Virtual Hosting from LDAP > mod-vhost-ldap is an Apache 2 module for storing and configuring > virtual hosts from LDAP. It supports the DocumentRoot, ScriptAlias, > diff -Nru mod-vhost-ldap-2.0.8/debian/patches/document-root.patch > mod-vhost-ldap-2.0.8/debian/patches/document-root.patch > --- mod-vhost-ldap-2.0.8/debian/patches/document-root.patch 1970-01-01 > 01:00:00.000000000 +0100 > +++ mod-vhost-ldap-2.0.8/debian/patches/document-root.patch 2013-07-11 > 15:13:23.000000000 +0100 > @@ -0,0 +1,60 @@ > +Description: Update document_root handling for Apache 2.4 > +Author: Colin Watson <cjwat...@ubuntu.com> > +Forwarded: no > +Last-Update: 2013-07-11 > + > +Index: b/mod_vhost_ldap.c > +=================================================================== > +--- a/mod_vhost_ldap.c > ++++ b/mod_vhost_ldap.c > +@@ -469,7 +469,7 @@ > + int sleep1 = 1; > + int sleep; > + struct berval hostnamebv, shostnamebv; > +- char **document_root_ptr; > ++ char *document_root; > + int ret = DECLINED; > + > + reqc = > +@@ -687,9 +687,11 @@ > + } > + ap_set_module_config(r->server->module_config, &core_module, core); > + > +- document_root_ptr = (char **)&core->ap_document_root; > ++ document_root = apr_pstrdup(r->pool, core->ap_document_root); > ++#elif AP_MODULE_MAGIC_AT_LEAST(20110605,0) > ++ document_root = apr_pstrdup(r->pool, ap_context_document_root(r)); > + #else > +- document_root_ptr = (char **)&r->document_root; > ++ document_root = apr_pstrdup(r->pool, r->document_root); > + #endif > + > + /* Make it absolute, relative to ServerRoot */ > +@@ -703,16 +705,25 @@ > + } > + > + /* TODO: ap_configtestonly && ap_docrootcheck && */ > +- if (apr_filepath_merge(document_root_ptr, NULL, reqc->docroot, > ++ if (apr_filepath_merge(&document_root, NULL, reqc->docroot, > + APR_FILEPATH_TRUENAME, r->pool) != APR_SUCCESS > + || !ap_is_directory(r->pool, reqc->docroot)) { > + > + ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, > + "[mod_vhost_ldap.c] set_document_root: Warning: > DocumentRoot [%s] does not exist", > + reqc->docroot); > +- *document_root_ptr = reqc->docroot; > ++ document_root = reqc->docroot; > + } > + > ++#ifndef HAS_PER_REQUEST_DOCUMENT_ROOT > ++ *(char **)&core->ap_document_root = document_root; > ++#elif AP_MODULE_MAGIC_AT_LEAST(20110605,0) > ++ ap_set_context_info(r, NULL, document_root); > ++ ap_set_document_root(r, document_root); > ++#else > ++ *(char **)&r->document_root = document_root; > ++#endif > ++ > + /* Return DECLINE to allow post-processing by other modules > (mod_rewrite, mod_alias) */ > + return ret; > + } > diff -Nru mod-vhost-ldap-2.0.8/debian/patches/series > mod-vhost-ldap-2.0.8/debian/patches/series > --- mod-vhost-ldap-2.0.8/debian/patches/series 1970-01-01 > 01:00:00.000000000 +0100 > +++ mod-vhost-ldap-2.0.8/debian/patches/series 2013-07-11 > 14:35:16.000000000 +0100 > @@ -0,0 +1 @@ > +document-root.patch > diff -Nru mod-vhost-ldap-2.0.8/debian/rules > mod-vhost-ldap-2.0.8/debian/rules > --- mod-vhost-ldap-2.0.8/debian/rules 2011-06-21 17:18:19.000000000 +0100 > +++ mod-vhost-ldap-2.0.8/debian/rules 2013-07-10 23:24:42.000000000 +0100 > @@ -19,7 +19,7 @@ > #}}} > > %: > - dh --with quilt $@ > + dh $@ --with quilt,apache2 > > AP2_MAKE_DEFS=top_dir=/usr/share/apache2 \ > APXS=apxs2 APACHECTL=apachectl2 \ > @@ -35,8 +35,4 @@ > $(MAKE) $(AP2_MAKE_DEFS) > > override_dh_auto_install: > - mkdir -p $(DEST)/usr/lib/apache2/modules > - install -m 644 .libs/mod_vhost_ldap.so > $(DEST)/usr/lib/apache2/modules > - mkdir -p $(DEST)/etc/apache2/mods-available > - install -m 644 debian/vhost_ldap.load > $(DEST)/etc/apache2/mods-available > - install -m 644 debian/vhost_ldap.conf > $(DEST)/etc/apache2/mods-available > + # handled by dh_apache2 > > -- > Colin Watson [cjwat...@debian.org] > -- Ondřej Surý <ond...@sury.org>