10Sstevel@tonic-gate /*
20Sstevel@tonic-gate * lib/gssapi/krb5/rel_oid.c
30Sstevel@tonic-gate *
40Sstevel@tonic-gate * Copyright 1995 by the Massachusetts Institute of Technology.
50Sstevel@tonic-gate * All Rights Reserved.
60Sstevel@tonic-gate *
70Sstevel@tonic-gate * Export of this software from the United States of America may
80Sstevel@tonic-gate * require a specific license from the United States Government.
90Sstevel@tonic-gate * It is the responsibility of any person or organization contemplating
100Sstevel@tonic-gate * export to obtain such a license before exporting.
110Sstevel@tonic-gate *
120Sstevel@tonic-gate * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
130Sstevel@tonic-gate * distribute this software and its documentation for any purpose and
140Sstevel@tonic-gate * without fee is hereby granted, provided that the above copyright
150Sstevel@tonic-gate * notice appear in all copies and that both that copyright notice and
160Sstevel@tonic-gate * this permission notice appear in supporting documentation, and that
170Sstevel@tonic-gate * the name of M.I.T. not be used in advertising or publicity pertaining
180Sstevel@tonic-gate * to distribution of the software without specific, written prior
195053Sgtb * permission. Furthermore if you modify this software you must label
205053Sgtb * your software as modified software and not distribute it in such a
215053Sgtb * fashion that it might be confused with the original M.I.T. software.
225053Sgtb * M.I.T. makes no representations about the suitability of
230Sstevel@tonic-gate * this software for any purpose. It is provided "as is" without express
240Sstevel@tonic-gate * or implied warranty.
250Sstevel@tonic-gate *
260Sstevel@tonic-gate */
270Sstevel@tonic-gate
280Sstevel@tonic-gate /*
290Sstevel@tonic-gate * rel_oid.c - Release an OID.
300Sstevel@tonic-gate */
315053Sgtb #include "gssapiP_krb5.h"
32*7934SMark.Phalan@Sun.COM
33*7934SMark.Phalan@Sun.COM /* Solaris Kerberos - resync 163 */
34*7934SMark.Phalan@Sun.COM OM_uint32 generic_gss_release_oid (OM_uint32 *, gss_OID *);
35*7934SMark.Phalan@Sun.COM
365053Sgtb
375053Sgtb OM_uint32 krb5_gss_internal_release_oid (OM_uint32 *, /* minor_status */
385053Sgtb gss_OID * /* oid */
395053Sgtb );
400Sstevel@tonic-gate
410Sstevel@tonic-gate OM_uint32
krb5_gss_release_oid(minor_status,oid)420Sstevel@tonic-gate krb5_gss_release_oid(minor_status, oid)
430Sstevel@tonic-gate OM_uint32 *minor_status;
440Sstevel@tonic-gate gss_OID *oid;
450Sstevel@tonic-gate {
460Sstevel@tonic-gate /*
470Sstevel@tonic-gate * The V2 API says the following!
480Sstevel@tonic-gate *
490Sstevel@tonic-gate * gss_release_oid[()] will recognize any of the GSSAPI's own OID values,
500Sstevel@tonic-gate * and will silently ignore attempts to free these OIDs; for other OIDs
510Sstevel@tonic-gate * it will call the C free() routine for both the OID data and the
520Sstevel@tonic-gate * descriptor. This allows applications to freely mix their own heap-
530Sstevel@tonic-gate * allocated OID values with OIDs returned by GSS-API.
540Sstevel@tonic-gate */
555053Sgtb if (krb5_gss_internal_release_oid(minor_status, oid) != GSS_S_COMPLETE) {
560Sstevel@tonic-gate /* Pawn it off on the generic routine */
575053Sgtb return(generic_gss_release_oid(minor_status, oid));
580Sstevel@tonic-gate }
590Sstevel@tonic-gate else {
600Sstevel@tonic-gate *oid = GSS_C_NO_OID;
610Sstevel@tonic-gate *minor_status = 0;
620Sstevel@tonic-gate return(GSS_S_COMPLETE);
630Sstevel@tonic-gate }
640Sstevel@tonic-gate }
650Sstevel@tonic-gate
660Sstevel@tonic-gate OM_uint32
krb5_gss_internal_release_oid(minor_status,oid)675053Sgtb krb5_gss_internal_release_oid(minor_status, oid)
680Sstevel@tonic-gate OM_uint32 *minor_status;
690Sstevel@tonic-gate gss_OID *oid;
700Sstevel@tonic-gate {
710Sstevel@tonic-gate /*
720Sstevel@tonic-gate * This function only knows how to release internal OIDs. It will
730Sstevel@tonic-gate * return GSS_S_CONTINUE_NEEDED for any OIDs it does not recognize.
740Sstevel@tonic-gate */
750Sstevel@tonic-gate
765053Sgtb if ((*oid != gss_mech_krb5) &&
770Sstevel@tonic-gate (*oid != gss_mech_krb5_old) &&
785053Sgtb (*oid != gss_mech_krb5_wrong) &&
790Sstevel@tonic-gate (*oid != gss_nt_krb5_name) &&
800Sstevel@tonic-gate (*oid != gss_nt_krb5_principal)) {
810Sstevel@tonic-gate /* We don't know about this OID */
820Sstevel@tonic-gate return(GSS_S_CONTINUE_NEEDED);
830Sstevel@tonic-gate }
840Sstevel@tonic-gate else {
850Sstevel@tonic-gate *oid = GSS_C_NO_OID;
860Sstevel@tonic-gate *minor_status = 0;
870Sstevel@tonic-gate return(GSS_S_COMPLETE);
880Sstevel@tonic-gate }
890Sstevel@tonic-gate }
900Sstevel@tonic-gate
91