krb5 commit: Report inquire_attrs_for_mech mech failures

Greg Hudson ghudson at mit.edu
Mon Feb 15 23:23:11 EST 2016


https://github.com/krb5/krb5/commit/030a4a03a0480969d6acf1591f39fd194642805a
commit 030a4a03a0480969d6acf1591f39fd194642805a
Author: Robbie Harwood <rharwood at redhat.com>
Date:   Wed Jan 27 18:48:04 2016 -0500

    Report inquire_attrs_for_mech mech failures
    
    Previously, gss_inquire_attrs_for_mech() would return a list of mech
    attributes that it knew about when given a bad mech oid or a mechanism
    which did not provide a gss_inquire_attrs_for_mech() method.  It seems
    more useful to just report the failure to the application rather than
    allowing it to continue with a faulty mechanism.
    
    ticket: 8358 (new)

 src/lib/gssapi/mechglue/g_mechattr.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/src/lib/gssapi/mechglue/g_mechattr.c b/src/lib/gssapi/mechglue/g_mechattr.c
index 57c0e52..08a6008 100644
--- a/src/lib/gssapi/mechglue/g_mechattr.c
+++ b/src/lib/gssapi/mechglue/g_mechattr.c
@@ -179,15 +179,16 @@ gss_inquire_attrs_for_mech(
         return status;
 
     mech = gssint_get_mechanism(selected_mech);
-    if (mech != NULL && mech->gss_inquire_attrs_for_mech != NULL) {
-        public_mech = gssint_get_public_oid(selected_mech);
-        status = mech->gss_inquire_attrs_for_mech(minor, public_mech,
-                                                  mech_attrs,
-                                                  known_mech_attrs);
-        if (GSS_ERROR(status)) {
-            map_error(minor, mech);
-            return status;
-        }
+    if (mech == NULL)
+        return GSS_S_BAD_MECH;
+    else if (mech->gss_inquire_attrs_for_mech == NULL)
+        return GSS_S_UNAVAILABLE;
+    public_mech = gssint_get_public_oid(selected_mech);
+    status = mech->gss_inquire_attrs_for_mech(minor, public_mech, mech_attrs,
+                                              known_mech_attrs);
+    if (GSS_ERROR(status)) {
+        map_error(minor, mech);
+        return status;
     }
 
     if (known_mech_attrs != NULL && *known_mech_attrs == GSS_C_NO_OID_SET) {


More information about the cvs-krb5 mailing list