svn rev #24200: trunk/src/ include/ lib/kdb/ plugins/kdb/db2/ plugins/kdb/hdb/ ...

ghudson@MIT.EDU ghudson at MIT.EDU
Wed Jul 21 15:01:35 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=24200
Commit By: ghudson
Log Message:
ticket: 6749

Revert the part of r24157 which added the dal_version argument to the
init_library interface.  Instead use the already existing maj_ver
field of the DAL vtable to detect incompatibilities.  Since maj_ver
is a short int, use an incrementing number instead of a date for the
major version.



Changed Files:
U   trunk/src/include/kdb.h
U   trunk/src/lib/kdb/kdb5.c
U   trunk/src/plugins/kdb/db2/db2_exp.c
U   trunk/src/plugins/kdb/hdb/kdb_hdb.c
U   trunk/src/plugins/kdb/ldap/ldap_exp.c
U   trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h
U   trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c
Modified: trunk/src/include/kdb.h
===================================================================
--- trunk/src/include/kdb.h	2010-07-21 17:55:42 UTC (rev 24199)
+++ trunk/src/include/kdb.h	2010-07-21 19:01:35 UTC (rev 24200)
@@ -742,11 +742,10 @@
 #define KRB5_KDB_OPT_SET_LOCK_MODE      1
 
 /*
- * This number indicates the date of the last incompatible change to the
- * DAL.  It is passed to init_library to allow KDB modules to detect when
- * they are being loaded by an incompatible version of the KDC.
+ * This number indicates the date of the last incompatible change to the DAL.
+ * The maj_ver field of the module's vtable structure must match this version.
  */
-#define KRB5_KDB_DAL_VERSION 20100714
+#define KRB5_KDB_DAL_MAJOR_VERSION 2
 
 /*
  * A krb5_context can hold one database object.  Modules should use
@@ -775,7 +774,7 @@
      * Mandatory: Invoked after the module library is loaded, when the first DB
      * using the module is opened, across all contexts.
      */
-    krb5_error_code (*init_library)(int dal_version);
+    krb5_error_code (*init_library)(void);
 
     /*
      * Mandatory: Invoked before the module library is unloaded, after the last

Modified: trunk/src/lib/kdb/kdb5.c
===================================================================
--- trunk/src/lib/kdb/kdb5.c	2010-07-21 17:55:42 UTC (rev 24199)
+++ trunk/src/lib/kdb/kdb5.c	2010-07-21 19:01:35 UTC (rev 24200)
@@ -295,7 +295,7 @@
     memcpy(&lib->vftabl, vftabl_addr, sizeof(kdb_vftabl));
     kdb_setup_opt_functions(lib);
 
-    status = lib->vftabl.init_library(KRB5_KDB_DAL_VERSION);
+    status = lib->vftabl.init_library();
     if (status)
         goto cleanup;
 
@@ -389,10 +389,16 @@
         goto clean_n_exit;
     }
 
+    if (((kdb_vftabl *)vftabl_addrs[0])->maj_ver !=
+        KRB5_KDB_DAL_MAJOR_VERSION) {
+        status = KRB5_KDB_DBTYPE_MISMATCH;
+        goto clean_n_exit;
+    }
+
     memcpy(&(*lib)->vftabl, vftabl_addrs[0], sizeof(kdb_vftabl));
     kdb_setup_opt_functions(*lib);
 
-    if ((status = (*lib)->vftabl.init_library(KRB5_KDB_DAL_VERSION)))
+    if ((status = (*lib)->vftabl.init_library()))
         goto clean_n_exit;
 
 clean_n_exit:

Modified: trunk/src/plugins/kdb/db2/db2_exp.c
===================================================================
--- trunk/src/plugins/kdb/db2/db2_exp.c	2010-07-21 17:55:42 UTC (rev 24199)
+++ trunk/src/plugins/kdb/db2/db2_exp.c	2010-07-21 19:01:35 UTC (rev 24200)
@@ -193,12 +193,10 @@
            (kcontext, request, client, server, authtime, error_code));
 
 static krb5_error_code
-hack_init (int dal_version)
+hack_init (void)
 {
     krb5_error_code c;
 
-    if (dal_version != KRB5_KDB_DAL_VERSION)
-        return KRB5_KDB_DBTYPE_MISMATCH;
     c = krb5int_mutex_alloc (&krb5_db2_mutex);
     if (c)
         return c;
@@ -219,7 +217,7 @@
  */
 
 kdb_vftabl PLUGIN_SYMBOL_NAME(krb5_db2, kdb_function_table) = {
-    1,                                      /* major version number 1 */
+    KRB5_KDB_DAL_MAJOR_VERSION,             /* major version number */
     0,                                      /* minor version number 0 */
     /* init_library */                  hack_init,
     /* fini_library */                  hack_cleanup,

Modified: trunk/src/plugins/kdb/hdb/kdb_hdb.c
===================================================================
--- trunk/src/plugins/kdb/hdb/kdb_hdb.c	2010-07-21 17:55:42 UTC (rev 24199)
+++ trunk/src/plugins/kdb/hdb/kdb_hdb.c	2010-07-21 19:01:35 UTC (rev 24200)
@@ -40,10 +40,8 @@
 #include "kdb_hdb.h"
 
 static krb5_error_code
-kh_init(int dal_version)
+kh_init(void)
 {
-    if (dal_version != KRB5_KDB_DAL_VERSION)
-        return KRB5_KDB_DBTYPE_MISMATCH;
     return 0;
 }
 
@@ -1218,7 +1216,7 @@
 }
 
 kdb_vftabl kdb_function_table = {
-    1,
+    KRB5_KDB_DAL_MAJOR_VERSION,
     0,
     kh_init,
     kh_fini,

Modified: trunk/src/plugins/kdb/ldap/ldap_exp.c
===================================================================
--- trunk/src/plugins/kdb/ldap/ldap_exp.c	2010-07-21 17:55:42 UTC (rev 24199)
+++ trunk/src/plugins/kdb/ldap/ldap_exp.c	2010-07-21 19:01:35 UTC (rev 24200)
@@ -47,7 +47,7 @@
  */
 
 kdb_vftabl PLUGIN_SYMBOL_NAME(krb5_ldap, kdb_function_table) = {
-    1,                                      /* major version number 1 */
+    KRB5_KDB_DAL_MAJOR_VERSION,             /* major version number */
     0,                                      /* minor version number 0 */
     /* init_library */                      krb5_ldap_lib_init,
     /* fini_library */                      krb5_ldap_lib_cleanup,

Modified: trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h
===================================================================
--- trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h	2010-07-21 17:55:42 UTC (rev 24199)
+++ trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.h	2010-07-21 19:01:35 UTC (rev 24200)
@@ -254,7 +254,7 @@
 krb5_ldap_get_age(krb5_context, char *, time_t *);
 
 krb5_error_code
-krb5_ldap_lib_init(int dal_version);
+krb5_ldap_lib_init(void);
 
 krb5_error_code
 krb5_ldap_lib_cleanup(void);

Modified: trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c
===================================================================
--- trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c	2010-07-21 17:55:42 UTC (rev 24199)
+++ trunk/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap_conn.c	2010-07-21 19:01:35 UTC (rev 24200)
@@ -312,10 +312,8 @@
  *     DAL API functions
  */
 krb5_error_code
-krb5_ldap_lib_init(int dal_version)
+krb5_ldap_lib_init()
 {
-    if (dal_version != KRB5_KDB_DAL_VERSION)
-        return KRB5_KDB_DBTYPE_MISMATCH;
     return 0;
 }
 




More information about the cvs-krb5 mailing list