Make copies of the mechname if there is no canonical name. Also don't
clobber the orignal name. From Rafal Malinowski. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@21218 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
@@ -44,7 +44,7 @@ OM_uint32 gss_duplicate_name(OM_uint32 *minor_status,
|
|||||||
/*
|
/*
|
||||||
* If this name has a value (i.e. it didn't come from
|
* If this name has a value (i.e. it didn't come from
|
||||||
* gss_canonicalize_name(), we re-import the thing. Otherwise,
|
* gss_canonicalize_name(), we re-import the thing. Otherwise,
|
||||||
* we make an empty name to hold the MN copy.
|
* we make copy of each mech names.
|
||||||
*/
|
*/
|
||||||
if (name->gn_value.value) {
|
if (name->gn_value.value) {
|
||||||
major_status = gss_import_name(minor_status,
|
major_status = gss_import_name(minor_status,
|
||||||
@@ -52,6 +52,10 @@ OM_uint32 gss_duplicate_name(OM_uint32 *minor_status,
|
|||||||
if (major_status != GSS_S_COMPLETE)
|
if (major_status != GSS_S_COMPLETE)
|
||||||
return (major_status);
|
return (major_status);
|
||||||
new_name = (struct _gss_name *) *dest_name;
|
new_name = (struct _gss_name *) *dest_name;
|
||||||
|
|
||||||
|
SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||||
|
_gss_find_mn(new_name, mn->gmn_mech_oid);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
new_name = malloc(sizeof(struct _gss_name));
|
new_name = malloc(sizeof(struct _gss_name));
|
||||||
if (!new_name) {
|
if (!new_name) {
|
||||||
@@ -59,17 +63,26 @@ OM_uint32 gss_duplicate_name(OM_uint32 *minor_status,
|
|||||||
return (GSS_S_FAILURE);
|
return (GSS_S_FAILURE);
|
||||||
}
|
}
|
||||||
memset(new_name, 0, sizeof(struct _gss_name));
|
memset(new_name, 0, sizeof(struct _gss_name));
|
||||||
SLIST_INIT(&name->gn_mn);
|
SLIST_INIT(&new_name->gn_mn);
|
||||||
*dest_name = (gss_name_t) new_name;
|
*dest_name = (gss_name_t) new_name;
|
||||||
}
|
|
||||||
|
SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
||||||
|
struct _gss_mechanism_name *new_mn;
|
||||||
|
|
||||||
|
new_mn = malloc(sizeof(*new_mn));
|
||||||
|
if (!new_mn) {
|
||||||
|
*minor_status = ENOMEM;
|
||||||
|
return GSS_S_FAILURE;
|
||||||
|
}
|
||||||
|
new_mn->gmn_mech = mn->gmn_mech;
|
||||||
|
new_mn->gmn_mech_oid = mn->gmn_mech_oid;
|
||||||
|
|
||||||
|
major_status =
|
||||||
|
mn->gmn_mech->gm_duplicate_name(minor_status,
|
||||||
|
mn->gmn_name, &nmn->gmn_name);
|
||||||
|
SLIST_INSERT_HEAD(&new_name->gn_mn, new_mn, gmn_link);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Import the new name into any mechanisms listed in the
|
|
||||||
* original name. We could probably get away with only doing
|
|
||||||
* this if the original was canonical.
|
|
||||||
*/
|
|
||||||
SLIST_FOREACH(mn, &name->gn_mn, gmn_link) {
|
|
||||||
_gss_find_mn(new_name, mn->gmn_mech_oid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (GSS_S_COMPLETE);
|
return (GSS_S_COMPLETE);
|
||||||
|
Reference in New Issue
Block a user