summaryrefslogtreecommitdiffstats
path: root/src/lib/gssapi/mechglue/g_initialize.c
diff options
context:
space:
mode:
authorTheodore Tso <tytso@mit.edu>1996-02-24 23:45:13 +0000
committerTheodore Tso <tytso@mit.edu>1996-02-24 23:45:13 +0000
commitc981c53a4ce52a576c2e1d51a60a9fbccb60030f (patch)
treef75dbaee7978d42b5ec1a25bf81d8126de70079a /src/lib/gssapi/mechglue/g_initialize.c
parentccad1d550df6a675d689a63186328d5fd0b8f9cd (diff)
downloadkrb5-c981c53a4ce52a576c2e1d51a60a9fbccb60030f.tar.gz
krb5-c981c53a4ce52a576c2e1d51a60a9fbccb60030f.tar.xz
krb5-c981c53a4ce52a576c2e1d51a60a9fbccb60030f.zip
g_mechname.c (gss_add_mech_name_type): Only mark a name-type as being
non-mechanism-specific if the mechanism doesn't match the type currently associated with the name-type. g_init_sec_context.c (gss_init_security_context): If we are using a mechanism-specific name, use the mechanism-specific name directly, instead of calling __gss_internal_import() on the external form of the name. If the mechanism_type is unspecified, use the type of the mechanism-specific name. If the mechanism_type is specified, it must match the type of the supplied name. g_acquire_cred.c (gss_acquire_cred): If we are acquiring credentials for a mechanism-specific name, use the name directly, instead of doing an __gss_internal_import() on the name. Also, if the desired_mechanisms oid is NULL, default to using the mechanism-type of the mechanism-specific name. g_compare_name.c (gss_compare_name): Add logic for comparing mechanism-specific names. g_accept_sec_context.c (gss_accept_sec_context): Use __gss_convert_name_to_union_name() to take the gss_name_t returned by the mechanism accept_sec_context(), and convert it into a mechanism-specific union name. g_inquire_context.c (gss_inquire_context): Removed local static function convert_name_to_union_name(), and changed references to it use the generalized __gss_convert_name_to_union_name() call. g_glue.c (__gss_convert_name_to_union_name): New function which takes gss_name_t returned by a particular mechanism, and converts it into a gss_union_name. g_rel_oid_set.c (gss_release_oid_set): Manually free the oids in an OID set, since the containing structure is allocated as an array. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@7523 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/gssapi/mechglue/g_initialize.c')
-rw-r--r--src/lib/gssapi/mechglue/g_initialize.c47
1 files changed, 32 insertions, 15 deletions
diff --git a/src/lib/gssapi/mechglue/g_initialize.c b/src/lib/gssapi/mechglue/g_initialize.c
index 33e6a446c6..c92d73154e 100644
--- a/src/lib/gssapi/mechglue/g_initialize.c
+++ b/src/lib/gssapi/mechglue/g_initialize.c
@@ -44,6 +44,10 @@
static void solaris_initialize (void);
#endif /* USE_SOLARIS_SHARED_LIBRARIES */
+#define g_OID_equal(o1,o2) \
+ (((o1)->length == (o2)->length) && \
+ (memcmp((o1)->elements,(o2)->elements,(int) (o1)->length) == 0))
+
extern gss_mechanism krb5_gss_initialize();
static int _gss_initialized = 0;
@@ -60,8 +64,10 @@ gss_mechanism *__gss_mechs_array = NULL;
static OM_uint32
add_mechanism (gss_mechanism mech, int replace)
{
- gss_mechanism *temp_array;
- int i;
+ gss_mechanism * temp_array;
+ gss_OID_set mech_names;
+ OM_uint32 minor_status, major_status;
+ unsigned int i;
if (mech == NULL)
return GSS_S_COMPLETE;
@@ -81,19 +87,16 @@ add_mechanism (gss_mechanism mech, int replace)
* entry for this OID
*/
for (i=0; __gss_mechs_array[i]->mech_type.length != 0; i++) {
- if ((__gss_mechs_array[i]->mech_type.length ==
- mech->mech_type.length) &&
- (memcmp (__gss_mechs_array[i]->mech_type.elements,
- mech->mech_type.elements,
- mech->mech_type.length) == 0)) {
-
- /* We found a match. Replace it? */
- if (!replace)
- return GSS_S_FAILURE;
-
- __gss_mechs_array[i] = mech;
- return GSS_S_COMPLETE;
- }
+ if (!g_OID_equal(&__gss_mechs_array[i]->mech_type,
+ &mech->mech_type))
+ continue;
+
+ /* We found a match. Replace it? */
+ if (!replace)
+ return GSS_S_FAILURE;
+
+ __gss_mechs_array[i] = mech;
+ return GSS_S_COMPLETE;
}
/* we didn't find it -- add it to the end of the __gss_mechs_array */
@@ -108,6 +111,20 @@ add_mechanism (gss_mechanism mech, int replace)
__gss_mechs_array = temp_array;
+ /*
+ * OK, now let's register all of the name types this mechanism
+ * knows how to deal with.
+ */
+ major_status = gss_inquire_names_for_mech(&minor_status, &mech->mech_type,
+ &mech_names);
+ if (major_status != GSS_S_COMPLETE)
+ return (GSS_S_COMPLETE);
+ for (i=0; i < mech_names->count; i++) {
+ gss_add_mech_name_type(&minor_status, &mech_names->elements[i],
+ &mech->mech_type);
+ }
+ (void) gss_release_oid_set(&minor_status, &mech_names);
+
return GSS_S_COMPLETE;
}