From 3b4b9cbc331abeefacb1547fa82d67fb0363e07b Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Mon, 22 Aug 2005 09:28:13 +0000 Subject: [PATCH] check software version --- contrib/slapd-modules/allop/allop.c | 16 +++++++++++----- contrib/slapd-overlays/allop/allop.c | 16 +++++++++++----- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/contrib/slapd-modules/allop/allop.c b/contrib/slapd-modules/allop/allop.c index f0397aadfe..56a536d11f 100644 --- a/contrib/slapd-modules/allop/allop.c +++ b/contrib/slapd-modules/allop/allop.c @@ -35,13 +35,22 @@ allop-URI #include "portable.h" -#ifdef SLAPD_OVER_ALLOP - #include #include #include "slap.h" +#define SLAP_OVER_VERSION_REQUIRE(major,minor,patch) \ + ( \ + ( LDAP_VENDOR_VERSION_MAJOR == X || LDAP_VENDOR_VERSION_MAJOR >= (major) ) \ + && ( LDAP_VENDOR_VERSION_MINOR == X || LDAP_VENDOR_VERSION_MINOR >= (minor) ) \ + && ( LDAP_VENDOR_VERSION_PATCH == X || LDAP_VENDOR_VERSION_PATCH >= (patch) ) \ + ) + +#if !SLAP_OVER_VERSION_REQUIRE(2,3,0) +#error "version mismatch" +#endif + typedef struct allop_t { struct berval ao_ndn; int ao_scope; @@ -243,12 +252,9 @@ allop_init() return overlay_register( &allop ); } -#if SLAPD_OVER_ALLOP == SLAPD_MOD_DYNAMIC int init_module( int argc, char *argv[] ) { return allop_init(); } -#endif /* SLAPD_OVER_ALLOP == SLAPD_MOD_DYNAMIC */ -#endif /* defined(SLAPD_OVER_ALLOP) */ diff --git a/contrib/slapd-overlays/allop/allop.c b/contrib/slapd-overlays/allop/allop.c index f0397aadfe..56a536d11f 100644 --- a/contrib/slapd-overlays/allop/allop.c +++ b/contrib/slapd-overlays/allop/allop.c @@ -35,13 +35,22 @@ allop-URI #include "portable.h" -#ifdef SLAPD_OVER_ALLOP - #include #include #include "slap.h" +#define SLAP_OVER_VERSION_REQUIRE(major,minor,patch) \ + ( \ + ( LDAP_VENDOR_VERSION_MAJOR == X || LDAP_VENDOR_VERSION_MAJOR >= (major) ) \ + && ( LDAP_VENDOR_VERSION_MINOR == X || LDAP_VENDOR_VERSION_MINOR >= (minor) ) \ + && ( LDAP_VENDOR_VERSION_PATCH == X || LDAP_VENDOR_VERSION_PATCH >= (patch) ) \ + ) + +#if !SLAP_OVER_VERSION_REQUIRE(2,3,0) +#error "version mismatch" +#endif + typedef struct allop_t { struct berval ao_ndn; int ao_scope; @@ -243,12 +252,9 @@ allop_init() return overlay_register( &allop ); } -#if SLAPD_OVER_ALLOP == SLAPD_MOD_DYNAMIC int init_module( int argc, char *argv[] ) { return allop_init(); } -#endif /* SLAPD_OVER_ALLOP == SLAPD_MOD_DYNAMIC */ -#endif /* defined(SLAPD_OVER_ALLOP) */ -- 2.39.5