diff --git a/lib/gssapi/Makefile.am b/lib/gssapi/Makefile.am index 8239ef106..fa8c01fbf 100644 --- a/lib/gssapi/Makefile.am +++ b/lib/gssapi/Makefile.am @@ -106,6 +106,7 @@ mechsrc = \ mech/gss_duplicate_cred.c \ mech/gss_duplicate_name.c \ mech/gss_duplicate_oid.c \ + mech/gss_duplicate_oid_set.c \ mech/gss_encapsulate_token.c \ mech/gss_export_name.c \ mech/gss_export_name_composite.c \ diff --git a/lib/gssapi/NTMakefile b/lib/gssapi/NTMakefile index 61dc7e5d8..e153a0ce2 100644 --- a/lib/gssapi/NTMakefile +++ b/lib/gssapi/NTMakefile @@ -123,6 +123,7 @@ mechsrc = \ mech/gss_duplicate_name.c \ mech/gss_duplicate_cred.c \ mech/gss_duplicate_oid.c \ + mech/gss_duplicate_oid_set.c \ mech/gss_encapsulate_token.c \ mech/gss_export_name.c \ mech/gss_export_name_composite.c \ @@ -372,6 +373,7 @@ libgssapi_OBJs = \ $(OBJ)\mech/gss_duplicate_cred.obj \ $(OBJ)\mech/gss_duplicate_name.obj \ $(OBJ)\mech/gss_duplicate_oid.obj \ + $(OBJ)\mech/gss_duplicate_oid_set.obj \ $(OBJ)\mech/gss_encapsulate_token.obj \ $(OBJ)\mech/gss_export_name.obj \ $(OBJ)\mech/gss_export_name_composite.obj \ diff --git a/lib/gssapi/gssapi/gssapi.h b/lib/gssapi/gssapi/gssapi.h index 66fed6682..4180cd3ee 100644 --- a/lib/gssapi/gssapi/gssapi.h +++ b/lib/gssapi/gssapi/gssapi.h @@ -751,6 +751,12 @@ GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_duplicate_oid ( gss_OID * /* dest_oid */ ); +GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_duplicate_oid_set ( + OM_uint32 * /* minor_status */, + gss_OID_set /* src_oid */, + gss_OID_set * /* dest_oid */ + ); + GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL gss_release_oid (OM_uint32 * /*minor_status*/, diff --git a/lib/gssapi/libgssapi-exports.def b/lib/gssapi/libgssapi-exports.def index f54471cd4..1f72489da 100644 --- a/lib/gssapi/libgssapi-exports.def +++ b/lib/gssapi/libgssapi-exports.def @@ -34,6 +34,7 @@ EXPORTS gss_display_status gss_duplicate_name gss_duplicate_oid + gss_duplicate_oid_set gss_encapsulate_token gss_export_cred gss_export_name diff --git a/lib/gssapi/mech/gss_duplicate_oid_set.c b/lib/gssapi/mech/gss_duplicate_oid_set.c new file mode 100644 index 000000000..ae0ab8d08 --- /dev/null +++ b/lib/gssapi/mech/gss_duplicate_oid_set.c @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Kungliga Tekniska Högskolan + * (Royal Institute of Technology, Stockholm, Sweden). + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the Institute nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "mech_locl.h" + +GSSAPI_LIB_FUNCTION OM_uint32 GSSAPI_LIB_CALL +gss_duplicate_oid_set(OM_uint32 *minor_status, + gss_OID_set src_oid_set, + gss_OID_set *dest_oid_set) +{ + OM_uint32 major_status, junk; + size_t i; + + *dest_oid_set = GSS_C_NO_OID_SET; + + major_status = gss_create_empty_oid_set(minor_status, dest_oid_set); + + for (i = 0; major_status == GSS_S_COMPLETE && i < src_oid_set->count; i++) + major_status = gss_add_oid_set_member(minor_status, + &src_oid_set->elements[i], + dest_oid_set); + + if (major_status != GSS_S_COMPLETE) + gss_release_oid_set(&junk, dest_oid_set); + + return major_status; +} diff --git a/lib/gssapi/version-script.map b/lib/gssapi/version-script.map index 59c76a3d1..26c9570a8 100644 --- a/lib/gssapi/version-script.map +++ b/lib/gssapi/version-script.map @@ -37,6 +37,7 @@ HEIMDAL_GSS_2.0 { gss_display_status; gss_duplicate_name; gss_duplicate_oid; + gss_duplicate_oid_set; gss_encapsulate_token; gss_export_cred; gss_export_name;