1 /* #pragma ident "@(#)g_oid_ops.c 1.11 98/01/22 SMI" */
2 /* lib/gssapi/mechglue/g_oid_ops.c - GSSAPI V2 interfaces to manipulate OIDs */
3 /*
4 * Copyright 1995, 2007 by the Massachusetts Institute of Technology.
5 * All Rights Reserved.
6 *
7 * Export of this software from the United States of America may
8 * require a specific license from the United States Government.
9 * It is the responsibility of any person or organization contemplating
10 * export to obtain such a license before exporting.
11 *
12 * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
13 * distribute this software and its documentation for any purpose and
14 * without fee is hereby granted, provided that the above copyright
15 * notice appear in all copies and that both that copyright notice and
16 * this permission notice appear in supporting documentation, and that
17 * the name of M.I.T. not be used in advertising or publicity pertaining
18 * to distribution of the software without specific, written prior
19 * permission. Furthermore if you modify this software you must label
20 * your software as modified software and not distribute it in such a
21 * fashion that it might be confused with the original M.I.T. software.
22 * M.I.T. makes no representations about the suitability of
23 * this software for any purpose. It is provided "as is" without express
24 * or implied warranty.
25 */
26
27 #include "mglueP.h"
28
29 /*
30 * gss_release_oid has been moved to g_initialize, because it requires access
31 * to the mechanism list. All functions requiring direct access to the
32 * mechanism list are now in g_initialize.c
33 */
34
35 OM_uint32 KRB5_CALLCONV
gss_create_empty_oid_set(minor_status,oid_set)36 gss_create_empty_oid_set(minor_status, oid_set)
37 OM_uint32 *minor_status;
38 gss_OID_set *oid_set;
39 {
40 OM_uint32 status;
41 status = generic_gss_create_empty_oid_set(minor_status, oid_set);
42 if (status != GSS_S_COMPLETE)
43 map_errcode(minor_status);
44 return status;
45 }
46
47 OM_uint32 KRB5_CALLCONV
gss_add_oid_set_member(minor_status,member_oid,oid_set)48 gss_add_oid_set_member(minor_status, member_oid, oid_set)
49 OM_uint32 *minor_status;
50 gss_OID member_oid;
51 gss_OID_set *oid_set;
52 {
53 OM_uint32 status;
54 status = generic_gss_add_oid_set_member(minor_status, member_oid, oid_set);
55 if (status != GSS_S_COMPLETE)
56 map_errcode(minor_status);
57 return status;
58 }
59
60 OM_uint32 KRB5_CALLCONV
gss_test_oid_set_member(minor_status,member,set,present)61 gss_test_oid_set_member(minor_status, member, set, present)
62 OM_uint32 *minor_status;
63 gss_OID member;
64 gss_OID_set set;
65 int *present;
66 {
67 return generic_gss_test_oid_set_member(minor_status, member, set, present);
68 }
69
70 OM_uint32 KRB5_CALLCONV
gss_oid_to_str(minor_status,oid,oid_str)71 gss_oid_to_str(minor_status, oid, oid_str)
72 OM_uint32 *minor_status;
73 gss_OID oid;
74 gss_buffer_t oid_str;
75 {
76 OM_uint32 status = generic_gss_oid_to_str(minor_status, oid, oid_str);
77 if (status != GSS_S_COMPLETE)
78 map_errcode(minor_status);
79 return status;
80 }
81
82 OM_uint32 KRB5_CALLCONV
gss_str_to_oid(minor_status,oid_str,oid)83 gss_str_to_oid(minor_status, oid_str, oid)
84 OM_uint32 *minor_status;
85 gss_buffer_t oid_str;
86 gss_OID *oid;
87 {
88 OM_uint32 status = generic_gss_str_to_oid(minor_status, oid_str, oid);
89 if (status != GSS_S_COMPLETE)
90 map_errcode(minor_status);
91 return status;
92 }
93
94 OM_uint32
gssint_copy_oid_set(OM_uint32 * minor_status,const gss_OID_set_desc * const oidset,gss_OID_set * new_oidset)95 gssint_copy_oid_set(
96 OM_uint32 *minor_status,
97 const gss_OID_set_desc * const oidset,
98 gss_OID_set *new_oidset)
99 {
100 return generic_gss_copy_oid_set(minor_status, oidset, new_oidset);
101 }
102
103 int KRB5_CALLCONV
gss_oid_equal(gss_const_OID first_oid,gss_const_OID second_oid)104 gss_oid_equal(
105 gss_const_OID first_oid,
106 gss_const_OID second_oid)
107 {
108 /* GSS_C_NO_OID doesn't match itself, per draft-josefsson-gss-capsulate. */
109 if (first_oid == GSS_C_NO_OID || second_oid == GSS_C_NO_OID)
110 return 0;
111 return g_OID_equal(first_oid, second_oid);
112 }
113