Add gss_duplicate_oid_set()
authorNicolas Williams <nico@twosigma.com>
Sun, 19 Apr 2020 02:32:45 +0000 (21:32 -0500)
committerNicolas Williams <nico@twosigma.com>
Tue, 21 Apr 2020 05:13:50 +0000 (00:13 -0500)
lib/gssapi/Makefile.am
lib/gssapi/NTMakefile
lib/gssapi/gssapi/gssapi.h
lib/gssapi/libgssapi-exports.def
lib/gssapi/mech/gss_duplicate_oid_set.c [new file with mode: 0644]
lib/gssapi/version-script.map

index 8239ef106d49d97cc148eac0b02c12c6c9380703..fa8c01fbf047c32e8f5947787182e3d1d1084f33 100644 (file)
@@ -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 \
index 61dc7e5d8458c48410519347245a9c00f7ffb3a0..e153a0ce25b6c3b380717b0e5a83ac7188e6a089 100644 (file)
@@ -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 \
index 66fed6682fa3809d2a91ae054a825137be7f64fd..4180cd3ee54425ef296634cadb25c6c3fab506da 100644 (file)
@@ -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*/,
index f54471cd4a058fe35ef3349e3927a23b55a53aad..1f72489da898579407fedf8c74b102eaa4a602ba 100644 (file)
@@ -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 (file)
index 0000000..ae0ab8d
--- /dev/null
@@ -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;
+}
index 59c76a3d1ae64b27c501ebb6c51cd74e2bd14461..26c9570a8bfb19020c32d2ccb5a106938b360a75 100644 (file)
@@ -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;