summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2011-11-13 00:38:23 +0000
committerGreg Hudson <ghudson@mit.edu>2011-11-13 00:38:23 +0000
commit9b21c05fec7cc9e06c7c8d00dd750ee8a32cfe44 (patch)
tree2d6593a996be7c607825c4a8ee678e220dc26000
parent2f96163a0f4ab2797dfbb56c9be23b3c2211d662 (diff)
downloadkrb5-9b21c05fec7cc9e06c7c8d00dd750ee8a32cfe44.tar.gz
krb5-9b21c05fec7cc9e06c7c8d00dd750ee8a32cfe44.tar.xz
krb5-9b21c05fec7cc9e06c7c8d00dd750ee8a32cfe44.zip
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. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@25471 dc483132-0cff-0310-8789-dd5450dbe970
-rw-r--r--src/include/k5-int.h3
-rw-r--r--src/lib/krb5/krb/plugin.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index b82fe5b6f9..21519b096c 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -1382,7 +1382,8 @@ struct plugin_interface {
};
/* 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
diff --git a/src/lib/krb5/krb/plugin.c b/src/lib/krb5/krb/plugin.c
index 575b8efa77..9b2328ba24 100644
--- a/src/lib/krb5/krb/plugin.c
+++ b/src/lib/krb5/krb/plugin.c
@@ -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 @@ configure_interface(krb5_context context, int id)
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;