From 030a4a03a0480969d6acf1591f39fd194642805a Mon Sep 17 00:00:00 2001 From: Robbie Harwood Date: Wed, 27 Jan 2016 18:48:04 -0500 Subject: [PATCH] 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 file 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) { -- 2.7.0