ports/58256: [new port] www/mod_cfg_ldap: Allows you to keep your virtual host configuration in a LDAP directory
Clement Laforet
sheepkiller at cultdeadsheep.org
Mon Nov 17 14:26:54 UTC 2003
Fix compilation on -STABLE.
Noticed and partially submitted by: Tom Müller-Kortkamp <tmueko [at] kommunity [dot] net>
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# mod_cfg_ldap
# mod_cfg_ldap/Makefile
# mod_cfg_ldap/distinfo
# mod_cfg_ldap/pkg-descr
# mod_cfg_ldap/pkg-plist
# mod_cfg_ldap/files
# mod_cfg_ldap/files/patch-mod_cfg_ldap.c
#
echo c - mod_cfg_ldap
mkdir -p mod_cfg_ldap > /dev/null 2>&1
echo x - mod_cfg_ldap/Makefile
sed 's/^X//' >mod_cfg_ldap/Makefile << 'END-of-mod_cfg_ldap/Makefile'
X# New ports collection makefile for: mod_cfg_ldap
X# Date created: Sun Oct 19
X# Whom: Clement Laforet <sheepkiller at cultdeadsheep.org>
X#
X# $FreeBSD$
X#
X
XPORTNAME= mod_cfg_ldap
XPORTVERSION= 1.0
XCATEGORIES= www
XMASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
XMASTER_SITE_SUBDIR= ${PORTNAME:S/_//g}
XDIST_SUBDIR= apache
X
XMAINTAINER= sheepkiller at cultdeadsheep.org
XCOMMENT= Allows you to keep your virtual host configuration in a LDAP directory
X
XBUILD_DEPENDS= ${LOCALBASE}/sbin/apxs:${PORTSDIR}/www/apache2
XRUN_DEPENDS= ${BUILD_DEPENDS}
X
XUSE_OPENLDAP= YES
X
XAPXS?= ${LOCALBASE}/sbin/apxs
XLDAP_INC?= ${LOCALBASE}/include
XLDAP_LIB?= ${LOCALBASE}/lib -lldap
X
XDOCS_FILES= AUTHORS cfg_ldap.conf ChangeLog COPYING INSTALL \
X mod_cfg_ldap.schema README TODO
X
Xdo-build:
X @(cd ${WRKSRC} && ${APXS} -I ${LDAP_INC} -L ${LDAP_LIB} -c ${PORTNAME}.c)
X
Xdo-install:
X @(cd ${WRKSRC} && ${APXS} -n ${PORTNAME:S/mod_//} -A -i ${PORTNAME}.la)
X.if !defined (NOPORTDOCS)
X @${MKDIR} ${DOCSDIR}
X. for f in ${DOCS_FILES}
X @${INSTALL_DATA} ${WRKSRC}/${f} ${DOCSDIR}
X. endfor
X.endif
X
X.include <bsd.port.mk>
END-of-mod_cfg_ldap/Makefile
echo x - mod_cfg_ldap/distinfo
sed 's/^X//' >mod_cfg_ldap/distinfo << 'END-of-mod_cfg_ldap/distinfo'
XMD5 (apache/mod_cfg_ldap-1.0.tar.gz) = 8e556a9cff882cb616db322f74f20355
END-of-mod_cfg_ldap/distinfo
echo x - mod_cfg_ldap/pkg-descr
sed 's/^X//' >mod_cfg_ldap/pkg-descr << 'END-of-mod_cfg_ldap/pkg-descr'
Xmod_cfgldap can be used to keep VirtualHost configuration of the Apache web
Xserver in a LDAP directory and to make changes visible in nearly realtime.
X
XWWW: http://modcfgldap.sourceforge.net/
END-of-mod_cfg_ldap/pkg-descr
echo x - mod_cfg_ldap/pkg-plist
sed 's/^X//' >mod_cfg_ldap/pkg-plist << 'END-of-mod_cfg_ldap/pkg-plist'
Xlibexec/apache2/mod_cfg_ldap.so
X at exec %D/sbin/apxs -e -A -n cfg_ldap %D/%f
X%%PORTDOCS%%%%DOCSDIR%%/AUTHORS
X%%PORTDOCS%%%%DOCSDIR%%/cfg_ldap.conf
X%%PORTDOCS%%%%DOCSDIR%%/ChangeLog
X%%PORTDOCS%%%%DOCSDIR%%/COPYING
X%%PORTDOCS%%%%DOCSDIR%%/INSTALL
X%%PORTDOCS%%%%DOCSDIR%%/mod_cfg_ldap.schema
X%%PORTDOCS%%%%DOCSDIR%%/README
X%%PORTDOCS%%%%DOCSDIR%%/TODO
X%%PORTDOCS%%@dirrm %%DOCSDIR%%
X at unexec echo "===> If you do not plan on reinstalling mod_cfg_ldap, you must manually remove"; echo "===> references to it in httpd.conf."
END-of-mod_cfg_ldap/pkg-plist
echo c - mod_cfg_ldap/files
mkdir -p mod_cfg_ldap/files > /dev/null 2>&1
echo x - mod_cfg_ldap/files/patch-mod_cfg_ldap.c
sed 's/^X//' >mod_cfg_ldap/files/patch-mod_cfg_ldap.c << 'END-of-mod_cfg_ldap/files/patch-mod_cfg_ldap.c'
X--- mod_cfg_ldap.c.orig Mon Nov 17 15:06:22 2003
X+++ mod_cfg_ldap.c Mon Nov 17 15:08:22 2003
X@@ -85,11 +85,11 @@
X cfg_ldap_init_ldap (apr_pool_t * p, server_rec * s)
X {
X cfg_ldap_cfg *cfg;
X+ int rc;
X cfg =
X (cfg_ldap_cfg *) ap_get_module_config (s->module_config,
X &cfg_ldap_module);
X
X- int rc;
X ld = ldap_init (cfg->hostname, LDAP_PORT);
X rc = ldap_simple_bind_s (ld, cfg->username, cfg->password);
X
X@@ -154,22 +154,30 @@
X cfg_ldap_read_vhost_from_ldap (apr_pool_t * p, server_rec * s, char *hostname)
X {
X cfg_ldap_cfg *cfg;
X+ cfg_ldap_vhost *vhost;
X+ char *filter;
X+ int rc,count;
X+ LDAPMessage *res;
X+ LDAPMessage *entry;
X+ char *attr;
X+ BerElement *ber;
X+ char **val = NULL;
X+ char *vhost_name = NULL;
X+ char *vhost_admin = NULL;
X+ char *vhost_docroot = NULL;
X+
X cfg =
X (cfg_ldap_cfg *) ap_get_module_config (s->module_config,
X &cfg_ldap_module);
X
X- cfg_ldap_vhost *vhost;
X vhost = (cfg_ldap_vhost *) apr_pcalloc (p, sizeof (cfg_ldap_vhost));
X vhost->timestamp = apr_time_now ();
X vhost->name = CFG_LDAP_NO_SUCH_VHOST;
X
X- char *filter;
X filter =
X apr_pstrcat (p, "(|(apacheServerName=", hostname, ")(apacheServerAlias=",
X hostname, "))", NULL);
X
X- int rc;
X- LDAPMessage *res;
X rc = ldap_search_s (ld, cfg->basedn, LDAP_SCOPE_SUBTREE, filter,
X (char **) &attrs, 0, &res);
X
X@@ -185,10 +193,9 @@
X return vhost;
X }
X
X- LDAPMessage *entry;
X entry = ldap_first_entry (ld, res);
X
X- int count = ldap_count_entries (ld, res);
X+ count = ldap_count_entries (ld, res);
X if (count == 0)
X {
X return vhost;
X@@ -199,13 +206,6 @@
X "cfg_ldap: more than one entry for %s", hostname);
X return vhost;
X }
X-
X- char *attr;
X- BerElement *ber;
X- char **val = NULL;
X- char *vhost_name = NULL;
X- char *vhost_admin = NULL;
X- char *vhost_docroot = NULL;
X
X for (attr = ldap_first_attribute (ld, entry, &ber);
X attr != NULL; attr = ldap_next_attribute (ld, entry, ber))
END-of-mod_cfg_ldap/files/patch-mod_cfg_ldap.c
exit
More information about the freebsd-ports-bugs
mailing list