svn rev #25471: trunk/src/ include/ lib/krb5/krb/
ghudson@MIT.EDU
ghudson at MIT.EDU
Sat Nov 12 19:38:23 EST 2011
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;
More information about the cvs-krb5
mailing list