1 /*
2 * lib/gssapi/krb5/rel_oid.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 * rel_oid.c - Release an OID.
30 */
31 #include "gssapiP_krb5.h"
32
33 /* Solaris Kerberos - resync 163 */
34 OM_uint32 generic_gss_release_oid (OM_uint32 *, gss_OID *);
35
36
37 OM_uint32 krb5_gss_internal_release_oid (OM_uint32 *, /* minor_status */
38 gss_OID * /* oid */
39 );
40
41 OM_uint32
krb5_gss_release_oid(minor_status,oid)42 krb5_gss_release_oid(minor_status, oid)
43 OM_uint32 *minor_status;
44 gss_OID *oid;
45 {
46 /*
47 * The V2 API says the following!
48 *
49 * gss_release_oid[()] will recognize any of the GSSAPI's own OID values,
50 * and will silently ignore attempts to free these OIDs; for other OIDs
51 * it will call the C free() routine for both the OID data and the
52 * descriptor. This allows applications to freely mix their own heap-
53 * allocated OID values with OIDs returned by GSS-API.
54 */
55 if (krb5_gss_internal_release_oid(minor_status, oid) != GSS_S_COMPLETE) {
56 /* Pawn it off on the generic routine */
57 return(generic_gss_release_oid(minor_status, oid));
58 }
59 else {
60 *oid = GSS_C_NO_OID;
61 *minor_status = 0;
62 return(GSS_S_COMPLETE);
63 }
64 }
65
66 OM_uint32
krb5_gss_internal_release_oid(minor_status,oid)67 krb5_gss_internal_release_oid(minor_status, oid)
68 OM_uint32 *minor_status;
69 gss_OID *oid;
70 {
71 /*
72 * This function only knows how to release internal OIDs. It will
73 * return GSS_S_CONTINUE_NEEDED for any OIDs it does not recognize.
74 */
75
76 if ((*oid != gss_mech_krb5) &&
77 (*oid != gss_mech_krb5_old) &&
78 (*oid != gss_mech_krb5_wrong) &&
79 (*oid != gss_nt_krb5_name) &&
80 (*oid != gss_nt_krb5_principal)) {
81 /* We don't know about this OID */
82 return(GSS_S_CONTINUE_NEEDED);
83 }
84 else {
85 *oid = GSS_C_NO_OID;
86 *minor_status = 0;
87 return(GSS_S_COMPLETE);
88 }
89 }
90
91