[prev in list] [next in list] [prev in thread] [next in thread] 

List:       krb5-cvs
Subject:    svn rev #25471: trunk/src/ include/ lib/krb5/krb/
From:       ghudson () mit ! edu
Date:       2011-11-13 0:38:23
Message-ID: 201111130038.pAD0cNcQ014705 () drugstore ! mit ! edu
[Download RAW message or body]

http://src.mit.edu/fisheye/changelog/krb5/?cs=25471
Commit By: ghudson
Log Message:
Add consistency check for plugin interface names

Add an assertion to ensure that the interface_names table in plugin.c
is updated when a new pluggable interface is added.


Changed Files:
U   trunk/src/include/k5-int.h
U   trunk/src/lib/krb5/krb/plugin.c
Modified: trunk/src/include/k5-int.h
===================================================================
--- trunk/src/include/k5-int.h	2011-11-12 22:03:54 UTC (rev 25470)
+++ trunk/src/include/k5-int.h	2011-11-13 00:38:23 UTC (rev 25471)
@@ -1382,7 +1382,8 @@
 };
 
 /* A list of plugin interface IDs.  Make sure to increment
- * PLUGIN_NUM_INTERFACES when a new interface is added. */
+ * PLUGIN_NUM_INTERFACES when a new interface is added, and add an entry to the
+ * interface_names table in lib/krb5/krb/plugin.c. */
 #define PLUGIN_INTERFACE_PWQUAL      0
 #define PLUGIN_INTERFACE_KADM5_HOOK  1
 #define PLUGIN_INTERFACE_CLPREAUTH   2

Modified: trunk/src/lib/krb5/krb/plugin.c
===================================================================
--- trunk/src/lib/krb5/krb/plugin.c	2011-11-12 22:03:54 UTC (rev 25470)
+++ trunk/src/lib/krb5/krb/plugin.c	2011-11-13 00:38:23 UTC (rev 25471)
@@ -26,7 +26,7 @@
 
 #include "k5-int.h"
 
-const char *interface_names[PLUGIN_NUM_INTERFACES] = {
+const char *interface_names[] = {
     "pwqual",
     "kadm5_hook",
     "clpreauth",
@@ -250,6 +250,10 @@
     if (interface->configured)
         return 0;
 
+    /* Detect consistency errors when plugin interfaces are added. */
+    assert(sizeof(interface_names) / sizeof(*interface_names) ==
+           PLUGIN_NUM_INTERFACES);
+
     /* Read the configuration variables for this interface. */
     path[0] = KRB5_CONF_PLUGINS;
     path[1] = iname;

_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic