diff --git a/configure b/configure index 210fd5d9f77aa2c11d68c3dda4bf2bd807f015fb..efd8b69bec6e3318f4eace84e84b6aaddccca02f 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # $OpenLDAP$ -# from OpenLDAP: pkg/ldap/configure.in,v 1.560 2004/12/04 18:48:48 hyc Exp +# from OpenLDAP: pkg/ldap/configure.in,v 1.561 2005/01/01 19:49:37 kurt Exp # This work is part of OpenLDAP Software <http://www.openldap.org/>. # @@ -25282,60 +25282,6 @@ else PLAT=UNIX fi -if test -z "$SLAPD_STATIC_BACKENDS"; then - SLAPD_NO_STATIC='#' -else - SLAPD_NO_STATIC= -fi - -BACKEND_HEADER=servers/slapd/backend.h -cat > $BACKEND_HEADER << EOF -/* 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. - */ - -EOF - -for b in $SLAPD_STATIC_BACKENDS; do - bb=`echo "$b" | sed -e 's;back-;;'` - - cat >> $BACKEND_HEADER << EOF -extern BI_init ${bb}_back_initialize; -EOF -done - -cat >> $BACKEND_HEADER << EOF - -static BackendInfo binfo[] = { -EOF - -for b in $SLAPD_STATIC_BACKENDS; do - bb=`echo "$b" | sed -e 's;back-;;'` - - cat >> $BACKEND_HEADER << EOF - { "$bb", ${bb}_back_initialize }, -EOF -done - -cat >> $BACKEND_HEADER << EOF - { NULL, NULL } -}; - -/* end of generated file */ -EOF - @@ -25910,12 +25856,64 @@ fi; done EOF cat >> $CONFIG_STATUS <<EOF - +STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS" EOF cat >> $CONFIG_STATUS <<\EOF chmod +x tests/run date > stamp-h +BACKENDSC="servers/slapd/backends.c" +echo "Making $BACKENDSC" +rm -f $BACKENDSC +cat > $BACKENDSC << 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_BACKENDS}"; then + for b in ${STATIC_BACKENDS}; do + bb=`echo "${b}" | sed -e 's/back-//'` + cat >> $BACKENDSC << ENDX +extern BI_init ${bb}_back_initialize; +ENDX + done + + cat >> $BACKENDSC << ENDX + +BackendInfo slap_binfo[] = { +ENDX + + for b in ${STATIC_BACKENDS}; do + bb=`echo "${b}" | sed -e 's/back-//'` + echo " Add ${bb} ..." + cat >> $BACKENDSC << ENDX + { "${bb}", ${bb}_back_initialize }, +ENDX + done + + cat >> $BACKENDSC << ENDX + { NULL, NULL }, +}; + +/* end of generated file */ +ENDX +fi + echo Please run \"make depend\" to build dependencies exit 0 diff --git a/configure.in b/configure.in index 8236b6ad232815131e1865aed67572e7e0394250..6bf73baa507358262acf2311c1e7672740639a8c 100644 --- a/configure.in +++ b/configure.in @@ -2924,62 +2924,6 @@ else PLAT=UNIX fi -if test -z "$SLAPD_STATIC_BACKENDS"; then - SLAPD_NO_STATIC='#' -else - SLAPD_NO_STATIC= -fi - -dnl Generate static backend header file -BACKEND_HEADER=servers/slapd/backend.h -cat > $BACKEND_HEADER << EOF -/* 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. - */ - -EOF - -for b in $SLAPD_STATIC_BACKENDS; do - bb=`echo "$b" | sed -e 's;back-;;'` - - cat >> $BACKEND_HEADER << EOF -extern BI_init ${bb}_back_initialize; -EOF -done - -cat >> $BACKEND_HEADER << EOF - -static BackendInfo binfo[[]] = { -EOF - -for b in $SLAPD_STATIC_BACKENDS; do - bb=`echo "$b" | sed -e 's;back-;;'` - - cat >> $BACKEND_HEADER << EOF - { "$bb", ${bb}_back_initialize }, -EOF -done - -cat >> $BACKEND_HEADER << EOF - { NULL, NULL } -}; - -/* end of generated file */ -EOF -dnl done generating static backend header file - AC_SUBST(LIBSRCS) AC_SUBST(PLAT) AC_SUBST(WITH_SASL) @@ -3108,5 +3052,57 @@ tests/progs/Makefile:build/top.mk:tests/progs/Makefile.in:build/rules.mk \ ,[ chmod +x tests/run date > stamp-h +BACKENDSC="servers/slapd/backends.c" +echo "Making $BACKENDSC" +rm -f $BACKENDSC +cat > $BACKENDSC << 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_BACKENDS}"; then + for b in ${STATIC_BACKENDS}; do + bb=`echo "${b}" | sed -e 's/back-//'` + cat >> $BACKENDSC << ENDX +extern BI_init ${bb}_back_initialize; +ENDX + done + + cat >> $BACKENDSC << ENDX + +BackendInfo slap_binfo[[]] = { +ENDX + + for b in ${STATIC_BACKENDS}; do + bb=`echo "${b}" | sed -e 's/back-//'` + echo " Add ${bb} ..." + cat >> $BACKENDSC << ENDX + { "${bb}", ${bb}_back_initialize }, +ENDX + done + + cat >> $BACKENDSC << ENDX + { NULL, NULL }, +}; + +/* end of generated file */ +ENDX +fi + echo Please run \"make depend\" to build dependencies -]) +],[STATIC_BACKENDS="$SLAPD_STATIC_BACKENDS"]) diff --git a/servers/slapd/Makefile.in b/servers/slapd/Makefile.in index d8b4fc9e7543f092bfd93667b54445d1f28aa0e6..a20266895a11e4264509668ce488d56752b24fcf 100644 --- a/servers/slapd/Makefile.in +++ b/servers/slapd/Makefile.in @@ -16,7 +16,7 @@ SLAPTOOLS=slapadd slapcat slapdn slapindex slappasswd slaptest slapauth slapacl PROGRAMS=slapd $(SLAPTOOLS) XPROGRAMS=sslapd libbackends.a .backend liboverlays.a -XSRCS=version.c +XSRCS=version.c backends.c SUBDIRS=back-* shell-backends slapi overlays @@ -80,10 +80,10 @@ BUILD_SRV = @BUILD_SLAPD@ all-local-srv: all-cffiles NT_SLAPD_DEPENDS = slapd.exp -NT_SLAPD_OBJECTS = slapd.exp symdummy.o $(OBJS) version.o +NT_SLAPD_OBJECTS = slapd.exp symdummy.o $(OBJS) backends.o version.o -UNIX_SLAPD_DEPENDS = $(SLAPD_STATIC_DEPENDS) version.o $(SLAPD_L) -UNIX_SLAPD_OBJECTS = $(OBJS) version.o +UNIX_SLAPD_DEPENDS = $(SLAPD_STATIC_DEPENDS) backends.o version.o $(SLAPD_L) +UNIX_SLAPD_OBJECTS = $(OBJS) backends.o version.o SLAPD_DEPENDS = liboverlays.a $(@PLAT@_SLAPD_DEPENDS) SLAPD_OBJECTS = $(@PLAT@_SLAPD_OBJECTS) @@ -313,8 +313,6 @@ libbackends.a: .backend liboverlays.a: FORCE @cd overlays; $(MAKE) $(MFLAGS) all -backend.c: backend.h - version.c: Makefile @-$(RM) $@ $(MKVERSION) -s -n Versionstr slapd > $@ diff --git a/servers/slapd/backend.c b/servers/slapd/backend.c index 863393f094811bfcbc9ce96fc00b0f0dda75dde4..286fe4c5a216f5620c5d06f4561a4e970e3a2af9 100644 --- a/servers/slapd/backend.c +++ b/servers/slapd/backend.c @@ -56,19 +56,6 @@ static void call_group_postop_plugins( Operation *op ); * imported into slapd without appropriate __declspec(dllimport) directives. */ -/* - * This file is automatically generated by configure; it defines - * the BackendInfo binfo[] structure with the configured static - * backend info. It assumes that every backend of type <name> - * provides an initialization function - * - * int name_back_initialize( BackendInfo *bi ) - * - * that populates the rest of the structure. - */ - -#include "backend.h" - int nBackendInfo = 0; BackendInfo *backendInfo = NULL; @@ -92,25 +79,25 @@ int backend_init(void) } for( ; - binfo[nBackendInfo].bi_type != NULL; + slap_binfo[nBackendInfo].bi_type != NULL; nBackendInfo++ ) { - assert( binfo[nBackendInfo].bi_init ); + assert( slap_binfo[nBackendInfo].bi_init ); - rc = binfo[nBackendInfo].bi_init( &binfo[nBackendInfo] ); + rc = slap_binfo[nBackendInfo].bi_init( &slap_binfo[nBackendInfo] ); if(rc != 0) { Debug( LDAP_DEBUG_ANY, "backend_init: initialized for type \"%s\"\n", - binfo[nBackendInfo].bi_type, 0, 0 ); + slap_binfo[nBackendInfo].bi_type, 0, 0 ); /* destroy those we've already inited */ for( nBackendInfo--; nBackendInfo >= 0 ; nBackendInfo-- ) { - if ( binfo[nBackendInfo].bi_destroy ) { - binfo[nBackendInfo].bi_destroy( - &binfo[nBackendInfo] ); + if ( slap_binfo[nBackendInfo].bi_destroy ) { + slap_binfo[nBackendInfo].bi_destroy( + &slap_binfo[nBackendInfo] ); } } return rc; @@ -118,7 +105,7 @@ int backend_init(void) } if ( nBackendInfo > 0) { - backendInfo = binfo; + backendInfo = slap_binfo; return 0; } @@ -156,8 +143,8 @@ int backend_add(BackendInfo *aBackendInfo) { BackendInfo *newBackendInfo = 0; - /* if backendInfo == binfo no deallocation of old backendInfo */ - if (backendInfo == binfo) { + /* if backendInfo == slap_binfo no deallocation of old backendInfo */ + if (backendInfo == slap_binfo) { newBackendInfo = ch_calloc(nBackendInfo + 1, sizeof(BackendInfo)); AC_MEMCPY(newBackendInfo, backendInfo, sizeof(BackendInfo) * nBackendInfo); @@ -431,7 +418,7 @@ int backend_destroy(void) } #ifdef SLAPD_MODULES - if (backendInfo != binfo) { + if (backendInfo != slap_binfo) { free(backendInfo); } #endif /* SLAPD_MODULES */ diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 5f061a5b59be141ff17f275432b25a81335b652f..e29d34d3a05dd1f187016a8f1d466db0286a9ed3 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -296,6 +296,8 @@ LDAP_SLAPD_F (int) backend_operational LDAP_P(( SlapReply *rs )); +LDAP_SLAPD_V(BackendInfo) slap_binfo[]; + /* * backglue.c */