]> git.decadent.org.uk Git - nfs-utils.git/blob - support/gssapi/g_oid_ops.c
Add gss support from citi @ umich
[nfs-utils.git] / support / gssapi / g_oid_ops.c
1 /*
2  * lib/gssapi/mechglue/g_oid_ops.c
3  *
4  * Copyright 1995 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
28 /*
29  * oid_ops.c - GSS-API V2 interfaces to manipulate OIDs
30  */
31
32 #include <stdio.h>
33 #include "mglueP.h"
34 /* should include to get protos #include "../generic/gssapiP_generic.h" */
35
36 extern gss_mechanism *__gss_mechs_array;
37
38 OM_uint32 KRB5_CALLCONV
39 gss_release_oid(minor_status, oid)
40     OM_uint32   *minor_status;
41     gss_OID     *oid;
42 {
43     int i;
44     OM_uint32   major_status;
45
46     /* first call the gss_internal_release_oid for each mechanism
47      * until one returns success. gss_internal_release_oid will only return
48      * success when the OID was recognized as an internal mechanism OID.
49      * if no mechanisms recognize the OID, then call the generic version.
50      */
51
52     for(i=0; __gss_mechs_array[i]->mech_type.length !=0; i++) {
53         if (__gss_mechs_array[i]->gss_internal_release_oid) {
54             major_status = __gss_mechs_array[i]->gss_internal_release_oid(
55 #ifdef USE_MECH_CONTEXT
56                                             __gss_mechs_array[i]->context,
57 #endif
58                                             minor_status,
59                                             oid);
60 #ifdef DEBUG
61             fprintf(stderr, "gss_release_oid (glue): mech returned 0x%08x\n",
62                     major_status);
63 #endif
64             if (major_status == GSS_S_COMPLETE) {
65                 return (GSS_S_COMPLETE);
66             }
67         }
68     }
69
70 #ifdef DEBUG
71     fprintf(stderr, "gss_release_oid (glue): calling "
72             "generic_gss_release_oid with oid %p (*oid %p)\n", oid, *oid);
73 #endif
74     return generic_gss_release_oid(minor_status, oid);
75 }
76
77 OM_uint32 KRB5_CALLCONV
78 gss_create_empty_oid_set(minor_status, oid_set)
79     OM_uint32   *minor_status;
80     gss_OID_set *oid_set;
81 {
82         return generic_gss_create_empty_oid_set(minor_status, oid_set);
83 }
84
85 OM_uint32 KRB5_CALLCONV
86 gss_add_oid_set_member(minor_status, member_oid, oid_set)
87     OM_uint32   *minor_status;
88     gss_OID     member_oid;
89     gss_OID_set *oid_set;
90 {
91      return generic_gss_add_oid_set_member(minor_status, member_oid, oid_set);
92 }
93
94 OM_uint32 KRB5_CALLCONV
95 gss_test_oid_set_member(minor_status, member, set, present)
96     OM_uint32   *minor_status;
97     gss_OID     member;
98     gss_OID_set set;
99     int         *present;
100 {
101     return generic_gss_test_oid_set_member(minor_status, member, set, present);
102 }
103
104 OM_uint32 KRB5_CALLCONV
105 gss_oid_to_str(minor_status, oid, oid_str)
106     OM_uint32           *minor_status;
107     gss_OID             oid;
108     gss_buffer_t        oid_str;
109 {
110     return generic_gss_oid_to_str(minor_status, oid, oid_str);
111 }
112
113 OM_uint32 KRB5_CALLCONV
114 gss_str_to_oid(minor_status, oid_str, oid)
115     OM_uint32           *minor_status;
116     gss_buffer_t        oid_str;
117     gss_OID             *oid;
118 {
119     return generic_gss_str_to_oid(minor_status, oid_str, oid);
120 }
121