summaryrefslogtreecommitdiffstats
path: root/lib/libgssapi
diff options
context:
space:
mode:
authorharti <harti@FreeBSD.org>2007-06-14 19:58:24 +0000
committerharti <harti@FreeBSD.org>2007-06-14 19:58:24 +0000
commitf1a585dc5124f5a09be3b5e34d314a35be605730 (patch)
tree2d92494f8fc5ef7af78dd7f0e1a3d229c50912f6 /lib/libgssapi
parent18afb27e89f7c33e7f7ee046aaad87bef8939ee0 (diff)
downloadFreeBSD-src-f1a585dc5124f5a09be3b5e34d314a35be605730.zip
FreeBSD-src-f1a585dc5124f5a09be3b5e34d314a35be605730.tar.gz
According to the documentation mech_type for gss_init_sec_context() may
be passed as GSS_C_NO_OID in which case a default mech should be used. This case was not handled and leads to core dumps when using nss_ldap. Now use the first mech in this case. When there is no mechanism available return an error (this part is taken from the PR). PR: 113266 Submitted by: Eirik Nygaard <eirikald@pvv.ntnu.no> (partly)
Diffstat (limited to 'lib/libgssapi')
-rw-r--r--lib/libgssapi/gss_init_sec_context.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libgssapi/gss_init_sec_context.c b/lib/libgssapi/gss_init_sec_context.c
index 0d4099e..b9325fe 100644
--- a/lib/libgssapi/gss_init_sec_context.c
+++ b/lib/libgssapi/gss_init_sec_context.c
@@ -41,7 +41,7 @@ gss_init_sec_context(OM_uint32 * minor_status,
const gss_cred_id_t initiator_cred_handle,
gss_ctx_id_t * context_handle,
const gss_name_t target_name,
- const gss_OID mech_type,
+ const gss_OID imech_type,
OM_uint32 req_flags,
OM_uint32 time_req,
const gss_channel_bindings_t input_chan_bindings,
@@ -52,6 +52,7 @@ gss_init_sec_context(OM_uint32 * minor_status,
OM_uint32 * time_rec)
{
OM_uint32 major_status;
+ gss_OID mech_type;
struct _gss_mech_switch *m;
struct _gss_name *name = (struct _gss_name *) target_name;
struct _gss_mechanism_name *mn;
@@ -63,6 +64,13 @@ gss_init_sec_context(OM_uint32 * minor_status,
*minor_status = 0;
+ if ((mech_type = imech_type) == GSS_C_NO_OID) {
+ _gss_load_mech();
+ mech_type = &SLIST_FIRST(&_gss_mechs)->gm_mech_oid;
+ if (mech_type == NULL)
+ return (GSS_S_BAD_MECH);
+ }
+
/*
* If we haven't allocated a context yet, do so now and lookup
* the mechanism switch table. If we have one already, make
OpenPOWER on IntegriCloud