From: Kurt Zeilenga Date: Thu, 7 Jun 2001 16:11:59 +0000 (+0000) Subject: Add a DB version check. X-Git-Tag: LDBM_PRE_GIANT_RWLOCK~1354 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=486ad59260ca229e5f0db553efc6f4f6d7072991;p=openldap Add a DB version check. --- diff --git a/libraries/libldbm/ldbm.c b/libraries/libldbm/ldbm.c index 4b5f76f4fb..5005bc3f32 100644 --- a/libraries/libldbm/ldbm.c +++ b/libraries/libldbm/ldbm.c @@ -106,6 +106,29 @@ int ldbm_initialize( const char* home ) if(ldbm_initialized++) return 1; + { + char *version; + int major, minor, patch; + version = db_version( &major, &minor, &patch ); + + if( major != DB_VERSION_MAJOR || + minor >= DB_VERSION_MINOR ) + { +#ifdef LDAP_SYSLOG + char error[BUFSIZ]; + + sprintf( error, "%s (%d)\n", STRERROR( err ), err ); + + syslog( LOG_INFO, + "ldbm_initialize(): versoin mismatch\nexpected: %s\ngot: %s\n", + DB_VERSION_STRING, + version ); +#endif + + return 1; + } + } + #ifndef HAVE_BERKELEY_DB_THREAD ldap_pvt_thread_mutex_init( &ldbm_big_mutex ); #endif