Commit 98936ee3 authored by Pierangelo Masarati's avatar Pierangelo Masarati
Browse files

streamline overlay configuration

parent f86543c7
#! /bin/sh
# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.606 2005/11/16 05:31:02 kurt Exp .
# From configure.in OpenLDAP: pkg/ldap/configure.in,v 1.607 2005/11/23 17:55:37 kurt Exp .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59.
#
......@@ -45206,7 +45206,10 @@ cat >>$CONFIG_STATUS <<_ACEOF
#
 
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS"
STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS"
 
_ACEOF
 
......@@ -46229,6 +46232,59 @@ ENDX
/* end of generated file */
ENDX
fi
OVERLAYSC="servers/slapd/overlays/statover.c"
echo "Making $OVERLAYSC"
rm -f $OVERLAYSC
cat > $OVERLAYSC << ENDX
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in the file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* This file is automatically generated by configure; please do not edit. */
#include "portable.h"
#include "slap.h"
ENDX
if test "${STATIC_OVERLAYS}"; then
for o in ${STATIC_OVERLAYS}; do
oo=`echo "${o}" | sed -e 's/.o$//' -e 's/_x$//'`
cat >> $OVERLAYSC << ENDX
extern BI_init ${oo}_initialize;
ENDX
done
fi
cat >> $OVERLAYSC << ENDX
OverlayInit slap_oinfo[] = {
ENDX
if test "${STATIC_OVERLAYS}"; then
for o in ${STATIC_OVERLAYS}; do
oo=`echo "${o}" | sed -e 's/.o$//' -e 's/_x$//'`
echo " Add ${oo} ..."
cat >> $OVERLAYSC << ENDX
{ "${oo}", ${oo}_initialize },
ENDX
done
fi
cat >> $OVERLAYSC << ENDX
{ NULL, NULL },
};
/* end of generated file */
ENDX
 
echo Please run \"make depend\" to build dependencies
;;
......@@ -3252,7 +3252,63 @@ ENDX
/* end of generated file */
ENDX
fi
OVERLAYSC="servers/slapd/overlays/statover.c"
echo "Making $OVERLAYSC"
rm -f $OVERLAYSC
cat > $OVERLAYSC << ENDX
/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
*
* Copyright 1998-2005 The OpenLDAP Foundation.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted only as authorized by the OpenLDAP
* Public License.
*
* A copy of this license is available in the file LICENSE in the
* top-level directory of the distribution or, alternatively, at
* <http://www.OpenLDAP.org/license.html>.
*/
/* This file is automatically generated by configure; please do not edit. */
#include "portable.h"
#include "slap.h"
ENDX
if test "${STATIC_OVERLAYS}"; then
for o in ${STATIC_OVERLAYS}; do
oo=`echo "${o}" | sed -e 's/.o$//' -e 's/_x$//'`
cat >> $OVERLAYSC << ENDX
extern BI_init ${oo}_initialize;
ENDX
done
fi
cat >> $OVERLAYSC << ENDX
OverlayInit slap_oinfo[] = {
ENDX
if test "${STATIC_OVERLAYS}"; then
for o in ${STATIC_OVERLAYS}; do
oo=`echo "${o}" | sed -e 's/.o$//' -e 's/_x$//'`
echo " Add ${oo} ..."
cat >> $OVERLAYSC << ENDX
{ "${oo}", ${oo}_initialize },
ENDX
done
fi
cat >> $OVERLAYSC << ENDX
{ NULL, NULL },
};
/* end of generated file */
ENDX
echo Please run \"make depend\" to build dependencies
]],[[STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS"]])
]],[[
STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS"
STATIC_OVERLAYS="$SLAPD_STATIC_OVERLAYS"
]])
AC_OUTPUT
......@@ -29,6 +29,7 @@ SRCS = overlays.c \
unique.c \
valsort.c
OBJS = overlays.o \
statover.o \
@SLAPD_STATIC_OVERLAYS@
# Add here the objs that are needed by overlays, but do not make it
......@@ -113,6 +114,8 @@ MKDEPFLAG = -l
.c.lo:
$(LTCOMPILE_MOD) $<
statover.o: statover.c $(srcdir)/../slap.h
$(LIBRARY): $(OBJS) version.lo
$(AR) rs $@ $(OBJS)
......@@ -124,3 +127,6 @@ depend-local:
mv Makefile Makefile.bak; $(SED) $$SCR Makefile.bak > Makefile && \
$(RM) Makefile.bak; fi
veryclean-local:
$(RM) statover.c
......@@ -1277,8 +1277,8 @@ accesslog_db_open(
ldap_pvt_thread_pool_context_reset( thrctx );
return rc;
}
int accesslog_init()
int accesslog_initialize()
{
int i, rc;
......@@ -1364,8 +1364,10 @@ int accesslog_init()
}
#if SLAPD_OVER_ACCESSLOG == SLAPD_MOD_DYNAMIC
int init_module( int argc, char *argv[]) {
return accesslog_init();
int
init_module( int argc, char *argv[] )
{
return accesslog_initialize();
}
#endif
......
......@@ -215,7 +215,7 @@ auditlog_config(
return SLAP_CONF_UNKNOWN;
}
int auditlog_init() {
int auditlog_initialize() {
auditlog.on_bi.bi_type = "auditlog";
auditlog.on_bi.bi_db_init = auditlog_db_init;
......@@ -228,8 +228,10 @@ int auditlog_init() {
}
#if SLAPD_OVER_AUDITLOG == SLAPD_MOD_DYNAMIC && defined(PIC)
int init_module( int argc, char *argv[]) {
return auditlog_init();
int
init_module( int argc, char *argv[] )
{
return auditlog_initialize();
}
#endif
......
......@@ -153,7 +153,7 @@ static int collect_config(
static slap_overinst collect;
int collect_init() {
int collect_initialize() {
collect.on_bi.bi_type = "collect";
collect.on_bi.bi_db_config = collect_config;
collect.on_response = collect_response;
......@@ -163,7 +163,7 @@ int collect_init() {
#if SLAPD_OVER_COLLECT == SLAPD_MOD_DYNAMIC
int init_module(int argc, char *argv[]) {
return collect_init();
return collect_initialize();
}
#endif
......
......@@ -224,7 +224,7 @@ denyop_destroy(
static slap_overinst denyop;
int
denyop_init( void )
denyop_initialize( void )
{
memset( &denyop, 0, sizeof( slap_overinst ) );
denyop.on_bi.bi_type = "denyop";
......@@ -251,7 +251,7 @@ denyop_init( void )
int
init_module( int argc, char *argv[] )
{
return denyop_init();
return denyop_initialize();
}
#endif /* SLAPD_OVER_DENYOP == SLAPD_MOD_DYNAMIC */
......
......@@ -146,7 +146,7 @@ static slap_overinst dyngroup;
* initialized and registered by some other function inside slapd.
*/
int dyngroup_init() {
int dyngroup_initialize() {
dyngroup.on_bi.bi_type = "dyngroup";
dyngroup.on_bi.bi_db_config = dyngroup_config;
dyngroup.on_bi.bi_db_close = dyngroup_close;
......@@ -156,8 +156,10 @@ int dyngroup_init() {
}
#if SLAPD_OVER_DYNGROUP == SLAPD_MOD_DYNAMIC
int init_module(int argc, char *argv[]) {
return dyngroup_init();
int
init_module( int argc, char *argv[] )
{
return dyngroup_initialize();
}
#endif
......
......@@ -749,7 +749,7 @@ static slap_overinst dynlist = { { NULL } };
static
#endif /* SLAPD_OVER_DYNLIST == SLAPD_MOD_DYNAMIC */
int
dynlist_init(void)
dynlist_initialize(void)
{
dynlist.on_bi.bi_type = "dynlist";
dynlist.on_bi.bi_db_init = dynlist_db_init;
......@@ -766,7 +766,7 @@ dynlist_init(void)
int
init_module( int argc, char *argv[] )
{
return dynlist_init();
return dynlist_initialize();
}
#endif
......
......@@ -995,7 +995,7 @@ lastmod_db_destroy(
static slap_overinst lastmod;
int
lastmod_init()
lastmod_initialize()
{
lastmod.on_bi.bi_type = "lastmod";
lastmod.on_bi.bi_db_init = lastmod_db_init;
......@@ -1020,7 +1020,7 @@ lastmod_init()
int
init_module( int argc, char *argv[] )
{
return lastmod_init();
return lastmod_initialize();
}
#endif /* SLAPD_OVER_LASTMOD == SLAPD_MOD_DYNAMIC */
......
......@@ -23,116 +23,22 @@
#include "slap.h"
#if SLAPD_OVER_ACCESSLOG == SLAPD_MOD_STATIC
extern int accesslog_init();
#endif
#if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
extern int denyop_init();
#endif
#if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
extern int dyngroup_init();
#endif
#if SLAPD_OVER_DYNLIST == SLAPD_MOD_STATIC
extern int dynlist_init();
#endif
#if SLAPD_OVER_GLUE == SLAPD_MOD_STATIC
extern int glue_init();
#endif
#if SLAPD_OVER_LASTMOD == SLAPD_MOD_STATIC
extern int lastmod_init();
#endif
#if SLAPD_OVER_PPOLICY == SLAPD_MOD_STATIC
extern int ppolicy_init();
#endif
#if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
extern int pcache_init();
#endif
#if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC
extern int refint_init();
#endif
#if SLAPD_OVER_RETCODE == SLAPD_MOD_STATIC
extern int retcode_init();
#endif
#if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
extern int rwm_init();
#endif
#if SLAPD_OVER_SYNCPROV == SLAPD_MOD_STATIC
extern int syncprov_init();
#endif
#if SLAPD_OVER_TRANSLUCENT == SLAPD_MOD_STATIC
extern int translucent_init();
#endif
#if SLAPD_OVER_UNIQUE == SLAPD_MOD_STATIC
extern int unique_init();
#endif
#if SLAPD_OVER_VALSORT == SLAPD_MOD_STATIC
extern int valsort_init();
#endif
static struct {
char *name;
int (*func)();
} funcs[] = {
#if SLAPD_OVER_ACCESSLOG == SLAPD_MOD_STATIC
{ "Access Log", accesslog_init },
#endif
#if SLAPD_OVER_DENYOP == SLAPD_MOD_STATIC
{ "Deny Operation", denyop_init },
#endif
#if SLAPD_OVER_DYNGROUP == SLAPD_MOD_STATIC
{ "Dynamic Group", dyngroup_init },
#endif
#if SLAPD_OVER_DYNLIST == SLAPD_MOD_STATIC
{ "Dynamic List", dynlist_init },
#endif
#if SLAPD_OVER_GLUE == SLAPD_MOD_STATIC
{ "Backend Glue", glue_init },
#endif
#if SLAPD_OVER_LASTMOD == SLAPD_MOD_STATIC
{ "Last Modification", lastmod_init },
#endif
#if SLAPD_OVER_PPOLICY == SLAPD_MOD_STATIC
{ "Password Policy", ppolicy_init },
#endif
#if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_STATIC
{ "Proxy Cache", pcache_init },
#endif
#if SLAPD_OVER_REFINT == SLAPD_MOD_STATIC
{ "Referential Integrity", refint_init },
#endif
#if SLAPD_OVER_RETCODE == SLAPD_MOD_STATIC
{ "Return Code", retcode_init },
#endif
#if SLAPD_OVER_RWM == SLAPD_MOD_STATIC
{ "Rewrite/Remap", rwm_init },
#endif
#if SLAPD_OVER_SYNCPROV == SLAPD_MOD_STATIC
{ "Syncrepl Provider", syncprov_init },
#endif
#if SLAPD_OVER_TRANSLUCENT == SLAPD_MOD_STATIC
{ "Translucent Proxy", translucent_init },
#endif
#if SLAPD_OVER_UNIQUE == SLAPD_MOD_STATIC
{ "Attribute Uniqueness", unique_init },
#endif
#if SLAPD_OVER_VALSORT == SLAPD_MOD_STATIC
{ "Value Sorting", valsort_init },
#endif
{ NULL, NULL }
};
extern OverlayInit slap_oinfo[];
int
overlay_init(void)
{
int i, rc = 0;
for ( i=0; funcs[i].name; i++ ) {
rc = funcs[i].func();
for ( i= 0 ; slap_oinfo[i].ov_type; i++ ) {
rc = slap_oinfo[i].ov_init();
if ( rc ) {
Debug( LDAP_DEBUG_ANY,
"%s overlay setup failed, err %d\n", funcs[i].name, rc, 0 );
"%s overlay setup failed, err %d\n",
slap_oinfo[i].ov_type, rc, 0 );
break;
}
}
return rc;
}
......@@ -1086,7 +1086,7 @@ cache_entries(
}
static int
proxy_cache_response(
pcache_response(
Operation *op,
SlapReply *rs )
{
......@@ -1218,7 +1218,7 @@ add_filter_attrs(
* performing the pagedResults search only within the client
* and the proxy. This requires pcache to understand pagedResults. */
static int
proxy_cache_chk_controls(
pcache_chk_controls(
Operation *op,
SlapReply *rs )
{
......@@ -1249,7 +1249,7 @@ proxy_cache_chk_controls(
}
static int
proxy_cache_search(
pcache_op_search(
Operation *op,
SlapReply *rs )
{
......@@ -1377,7 +1377,7 @@ proxy_cache_search(
add_filter_attrs(op, &op->ors_attrs, query.attrs, filter_attrs);
cb = op->o_tmpalloc( sizeof(*cb) + sizeof(*si), op->o_tmpmemctx);
cb->sc_response = proxy_cache_response;
cb->sc_response = pcache_response;
cb->sc_cleanup = NULL;
cb->sc_private = (cb+1);
si = cb->sc_private;
......@@ -1988,7 +1988,7 @@ pc_cf_gen( ConfigArgs *c )
}
static int
proxy_cache_config(
pcache_db_config(
BackendDB *be,
const char *fname,
int lineno,
......@@ -2007,7 +2007,7 @@ proxy_cache_config(
}
static int
proxy_cache_init(
pcache_db_init(
BackendDB *be
)
{
......@@ -2052,7 +2052,7 @@ proxy_cache_init(
}
static int
proxy_cache_open(
pcache_db_open(
BackendDB *be
)
{
......@@ -2109,7 +2109,7 @@ proxy_cache_open(
if ( BER_BVISNULL( &cm->db.be_rootndn )
|| BER_BVISEMPTY( &cm->db.be_rootndn ) )
{
Debug( LDAP_DEBUG_ANY, "proxy_cache_open(): "
Debug( LDAP_DEBUG_ANY, "pcache_db_open(): "
"underlying database of type \"%s\"\n"
" serving naming context \"%s\"\n"
" has no \"rootdn\", required by \"proxycache\".\n",
......@@ -2123,7 +2123,7 @@ proxy_cache_open(
}
static int
proxy_cache_close(
pcache_db_close(
BackendDB *be
)
{
......@@ -2165,7 +2165,7 @@ proxy_cache_close(
}
static int
proxy_cache_destroy(
pcache_db_destroy(
BackendDB *be
)
{
......@@ -2194,9 +2194,9 @@ proxy_cache_destroy(
return 0;
}
static slap_overinst proxy_cache;
static slap_overinst pcache;
int pcache_init()
int pcache_initialize()
{
LDAPAttributeType *at;
int code;
......@@ -2206,7 +2206,7 @@ int pcache_init()
LDAP_SCHEMA_ALLOW_ALL );
if ( !at ) {
Debug( LDAP_DEBUG_ANY,
"pcache_init: ldap_str2attributetype failed %s %s\n",
"pcache_initialize: ldap_str2attributetype failed %s %s\n",
ldap_scherr2str(code), err, 0 );
return code;
}
......@@ -2217,32 +2217,33 @@ int pcache_init()
ldap_memfree( at );
if ( code ) {
Debug( LDAP_DEBUG_ANY,
"pcache_init: at_add failed %s %s\n",
"pcache_initialize: at_add failed %s %s\n",
scherr2str(code), err, 0 );
return code;
}
proxy_cache.on_bi.bi_type = "pcache";
proxy_cache.on_bi.bi_db_init = proxy_cache_init;
proxy_cache.on_bi.bi_db_config = proxy_cache_config;
proxy_cache.on_bi.bi_db_open = proxy_cache_open;
proxy_cache.on_bi.bi_db_close = proxy_cache_close;
proxy_cache.on_bi.bi_db_destroy = proxy_cache_destroy;
proxy_cache.on_bi.bi_op_search = proxy_cache_search;
pcache.on_bi.bi_type = "pcache";
pcache.on_bi.bi_db_init = pcache_db_init;
pcache.on_bi.bi_db_config = pcache_db_config;
pcache.on_bi.bi_db_open = pcache_db_open;
pcache.on_bi.bi_db_close = pcache_db_close;
pcache.on_bi.bi_db_destroy = pcache_db_destroy;
proxy_cache.on_bi.bi_chk_controls = proxy_cache_chk_controls;
pcache.on_bi.bi_op_search = pcache_op_search;
proxy_cache.on_bi.bi_cf_ocs = pcocs;
pcache.on_bi.bi_chk_controls = pcache_chk_controls;
pcache.on_bi.bi_cf_ocs = pcocs;
code = config_register_schema( pccfg, pcocs );
if ( code ) return code;
return overlay_register( &proxy_cache );
return overlay_register( &pcache );
}
#if SLAPD_OVER_PROXYCACHE == SLAPD_MOD_DYNAMIC
int init_module(int argc, char *argv[]) {
return pcache_init();
return pcache_initialize();
}
#endif
......
......@@ -1942,7 +1942,7 @@ static char *extops[] = {
static slap_overinst ppolicy;
int ppolicy_init()
int ppolicy_initialize()
{
LDAPAttributeType *at;
const char *err;
......@@ -2002,7 +2002,7 @@ int ppolicy_init()
#if SLAPD_OVER_PPOLICY == SLAPD_MOD_DYNAMIC
int init_module(int argc, char *argv[]) {
return ppolicy_init();
return ppolicy_initialize();
}
#endif
......
......@@ -659,7 +659,7 @@ done:
** it expects to be called automagically during dynamic module initialization
*/
int refint_init() {
int refint_initialize() {
/* statically declared just after the #includes at top */
refint.on_bi.bi_type = "refint";
......@@ -674,7 +674,7 @@ int refint_init() {
#if SLAPD_OVER_REFINT == SLAPD_MOD_DYNAMIC && defined(PIC)
int init_module(int argc, char *argv[]) {
return refint_init();
return refint_initialize();
}
#endif
......
......@@ -1066,7 +1066,7 @@ retcode_db_destroy( BackendDB *be )
static
#endif /* SLAPD_OVER_RETCODE == SLAPD_MOD_DYNAMIC */
int
retcode_init( void )
retcode_initialize( void )
{
int i, code;
const char *err;
......@@ -1243,7 +1243,7 @@ retcode_init( void )
int
init_module( int argc, char *argv[] )