]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
Report inquire_attrs_for_mech mech failures
authorRobbie Harwood <rharwood@redhat.com>
Wed, 27 Jan 2016 23:48:04 +0000 (18:48 -0500)
committerGreg Hudson <ghudson@mit.edu>
Tue, 16 Feb 2016 03:52:39 +0000 (22:52 -0500)
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

index 57c0e526f114f5c6206a5f53776a4ae5bf7fa198..08a60086cea52b18c4aa13e8eb43c6531f6af830 100644 (file)
@@ -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) {