]> git.sur5r.net Git - openldap/commitdiff
Add a DB version check.
authorKurt Zeilenga <kurt@openldap.org>
Thu, 7 Jun 2001 16:11:59 +0000 (16:11 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Thu, 7 Jun 2001 16:11:59 +0000 (16:11 +0000)
libraries/libldbm/ldbm.c

index 4b5f76f4fb1d47213435106264d5cb41b8c75cbf..5005bc3f3289121dc89ba4431a10fb814d1f22f9 100644 (file)
@@ -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