svn rev #24260: branches/plugins2/ pwqual_combo/ src/lib/kadm5/srv/ src/lib/krb5/error_tables/ ...

ghudson@MIT.EDU ghudson at MIT.EDU
Thu Aug 26 19:52:06 EDT 2010


http://src.mit.edu/fisheye/changelog/krb5/?cs=24260
Commit By: ghudson
Log Message:
Create specific error codes for plugin-related failures, now that we
have an expansion error table to hold them in.



Changed Files:
U   branches/plugins2/README.BRANCH
U   branches/plugins2/pwqual_combo/combo.c
U   branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c
U   branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c
U   branches/plugins2/src/lib/krb5/error_tables/k5e1_err.et
U   branches/plugins2/src/lib/krb5/krb/plugin.c
Modified: branches/plugins2/README.BRANCH
===================================================================
--- branches/plugins2/README.BRANCH	2010-08-26 23:19:40 UTC (rev 24259)
+++ branches/plugins2/README.BRANCH	2010-08-26 23:52:05 UTC (rev 24260)
@@ -154,11 +154,6 @@
 The krb5 code on this branch is mostly complete, but as a
 demonstration branch it is not perfect.  Problems include:
 
-* In some cases (marked by XXX comments), overly vague error codes are
-  returned where new error codes should have been created.  This is
-  because the krb5 trunk's krb5 error table is currently full, and
-  rectifying that problem is out of scope for the branch.
-
 * Opening and closing password quality plugins should perhaps be
   hidden by the password quality consumer API--that is, the open
   method should be invoked by the loader, and the close method by

Modified: branches/plugins2/pwqual_combo/combo.c
===================================================================
--- branches/plugins2/pwqual_combo/combo.c	2010-08-26 23:19:40 UTC (rev 24259)
+++ branches/plugins2/pwqual_combo/combo.c	2010-08-26 23:52:05 UTC (rev 24260)
@@ -174,7 +174,7 @@
     krb5_pwqual_vtable vt;
 
     if (maj_ver != 1)
-        return EINVAL; /* XXX create error code */
+        return KRB5_PLUGIN_VER_NOTSUPP;
     vt = (krb5_pwqual_vtable)vtable;
     vt->open = combo_open;
     vt->check = combo_check;

Modified: branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c
===================================================================
--- branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c	2010-08-26 23:19:40 UTC (rev 24259)
+++ branches/plugins2/src/lib/kadm5/srv/pwqual_dict.c	2010-08-26 23:52:05 UTC (rev 24260)
@@ -235,7 +235,7 @@
     krb5_pwqual_vtable vt;
 
     if (maj_ver != 1)
-        return EINVAL; /* XXX create error code */
+        return KRB5_PLUGIN_VER_NOTSUPP;
     vt = (krb5_pwqual_vtable)vtable;
     vt->open = dict_open;
     vt->check = dict_check;

Modified: branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c
===================================================================
--- branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c	2010-08-26 23:19:40 UTC (rev 24259)
+++ branches/plugins2/src/lib/kadm5/srv/pwqual_policy.c	2010-08-26 23:52:05 UTC (rev 24260)
@@ -74,7 +74,7 @@
     krb5_pwqual_vtable vt;
 
     if (maj_ver != 1)
-        return EINVAL; /* XXX create error code */
+        return KRB5_PLUGIN_VER_NOTSUPP;
     vt = (krb5_pwqual_vtable)vtable;
     vt->check = policy_check;
     return 0;

Modified: branches/plugins2/src/lib/krb5/error_tables/k5e1_err.et
===================================================================
--- branches/plugins2/src/lib/krb5/error_tables/k5e1_err.et	2010-08-26 23:19:40 UTC (rev 24259)
+++ branches/plugins2/src/lib/krb5/error_tables/k5e1_err.et	2010-08-26 23:52:05 UTC (rev 24260)
@@ -30,4 +30,8 @@
 #
 error_table k5e1
 
+error_code KRB5_PLUGIN_VER_NOTSUPP, "Plugin does not support interface version"
+error_code KRB5_PLUGIN_BAD_MODULE_SPEC, "Invalid module specifier"
+error_code KRB5_PLUGIN_NAME_NOTFOUND, "Plugin module name not found"
+
 end

Modified: branches/plugins2/src/lib/krb5/krb/plugin.c
===================================================================
--- branches/plugins2/src/lib/krb5/krb/plugin.c	2010-08-26 23:19:40 UTC (rev 24259)
+++ branches/plugins2/src/lib/krb5/krb/plugin.c	2010-08-26 23:52:05 UTC (rev 24260)
@@ -109,9 +109,9 @@
 
     sep = strchr(modstr, ':');
     if (sep == NULL) {
-        krb5_set_error_message(context, EINVAL, "Invalid module string %s",
-                               modstr);
-        return EINVAL; /* XXX create specific error code */
+        krb5_set_error_message(context, KRB5_PLUGIN_BAD_MODULE_SPEC,
+                               "Invalid module specifier %s", modstr);
+        return KRB5_PLUGIN_BAD_MODULE_SPEC;
     }
 
     /* Copy the module name. */
@@ -287,7 +287,10 @@
             return 0;
         }
     }
-    return ENOENT; /* XXX Create error code? */
+    krb5_set_error_message(context, KRB5_PLUGIN_NAME_NOTFOUND,
+                           "Could not find %s plugin module named '%s'",
+                           interface_names[interface_id], modname);
+    return KRB5_PLUGIN_NAME_NOTFOUND;
 }
 
 krb5_error_code




More information about the cvs-krb5 mailing list