17c478bd9Sstevel@tonic-gate /*
27c478bd9Sstevel@tonic-gate  * lib/gssapi/krb5/rel_oid.c
37c478bd9Sstevel@tonic-gate  *
47c478bd9Sstevel@tonic-gate  * Copyright 1995 by the Massachusetts Institute of Technology.
57c478bd9Sstevel@tonic-gate  * All Rights Reserved.
67c478bd9Sstevel@tonic-gate  *
77c478bd9Sstevel@tonic-gate  * Export of this software from the United States of America may
87c478bd9Sstevel@tonic-gate  *   require a specific license from the United States Government.
97c478bd9Sstevel@tonic-gate  *   It is the responsibility of any person or organization contemplating
107c478bd9Sstevel@tonic-gate  *   export to obtain such a license before exporting.
117c478bd9Sstevel@tonic-gate  *
127c478bd9Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
137c478bd9Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
147c478bd9Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
157c478bd9Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
167c478bd9Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
177c478bd9Sstevel@tonic-gate  * the name of M.I.T. not be used in advertising or publicity pertaining
187c478bd9Sstevel@tonic-gate  * to distribution of the software without specific, written prior
19ab9b2e15Sgtb  * permission.  Furthermore if you modify this software you must label
20ab9b2e15Sgtb  * your software as modified software and not distribute it in such a
21ab9b2e15Sgtb  * fashion that it might be confused with the original M.I.T. software.
22ab9b2e15Sgtb  * M.I.T. makes no representations about the suitability of
237c478bd9Sstevel@tonic-gate  * this software for any purpose.  It is provided "as is" without express
247c478bd9Sstevel@tonic-gate  * or implied warranty.
257c478bd9Sstevel@tonic-gate  *
267c478bd9Sstevel@tonic-gate  */
277c478bd9Sstevel@tonic-gate 
287c478bd9Sstevel@tonic-gate /*
297c478bd9Sstevel@tonic-gate  * rel_oid.c - Release an OID.
307c478bd9Sstevel@tonic-gate  */
31ab9b2e15Sgtb #include "gssapiP_krb5.h"
32159d09a2SMark Phalan 
33159d09a2SMark Phalan /* Solaris Kerberos - resync 163 */
34159d09a2SMark Phalan OM_uint32 generic_gss_release_oid (OM_uint32 *, gss_OID *);
35159d09a2SMark Phalan 
36ab9b2e15Sgtb 
37ab9b2e15Sgtb OM_uint32 krb5_gss_internal_release_oid (OM_uint32 *, /* minor_status */
38ab9b2e15Sgtb 					 gss_OID * /* oid */
39ab9b2e15Sgtb     );
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate OM_uint32
krb5_gss_release_oid(minor_status,oid)427c478bd9Sstevel@tonic-gate krb5_gss_release_oid(minor_status, oid)
437c478bd9Sstevel@tonic-gate     OM_uint32	*minor_status;
447c478bd9Sstevel@tonic-gate     gss_OID	*oid;
457c478bd9Sstevel@tonic-gate {
467c478bd9Sstevel@tonic-gate     /*
477c478bd9Sstevel@tonic-gate      * The V2 API says the following!
487c478bd9Sstevel@tonic-gate      *
497c478bd9Sstevel@tonic-gate      * gss_release_oid[()] will recognize any of the GSSAPI's own OID values,
507c478bd9Sstevel@tonic-gate      * and will silently ignore attempts to free these OIDs; for other OIDs
517c478bd9Sstevel@tonic-gate      * it will call the C free() routine for both the OID data and the
527c478bd9Sstevel@tonic-gate      * descriptor.  This allows applications to freely mix their own heap-
537c478bd9Sstevel@tonic-gate      * allocated OID values with OIDs returned by GSS-API.
547c478bd9Sstevel@tonic-gate      */
55ab9b2e15Sgtb     if (krb5_gss_internal_release_oid(minor_status, oid) != GSS_S_COMPLETE) {
567c478bd9Sstevel@tonic-gate 	/* Pawn it off on the generic routine */
57ab9b2e15Sgtb 	return(generic_gss_release_oid(minor_status, oid));
587c478bd9Sstevel@tonic-gate     }
597c478bd9Sstevel@tonic-gate     else {
607c478bd9Sstevel@tonic-gate 	*oid = GSS_C_NO_OID;
617c478bd9Sstevel@tonic-gate 	*minor_status = 0;
627c478bd9Sstevel@tonic-gate 	return(GSS_S_COMPLETE);
637c478bd9Sstevel@tonic-gate     }
647c478bd9Sstevel@tonic-gate }
657c478bd9Sstevel@tonic-gate 
667c478bd9Sstevel@tonic-gate OM_uint32
krb5_gss_internal_release_oid(minor_status,oid)67ab9b2e15Sgtb krb5_gss_internal_release_oid(minor_status, oid)
687c478bd9Sstevel@tonic-gate     OM_uint32	*minor_status;
697c478bd9Sstevel@tonic-gate     gss_OID	*oid;
707c478bd9Sstevel@tonic-gate {
717c478bd9Sstevel@tonic-gate     /*
727c478bd9Sstevel@tonic-gate      * This function only knows how to release internal OIDs. It will
737c478bd9Sstevel@tonic-gate      * return GSS_S_CONTINUE_NEEDED for any OIDs it does not recognize.
747c478bd9Sstevel@tonic-gate      */
75*55fea89dSDan Cross 
76ab9b2e15Sgtb     if ((*oid != gss_mech_krb5) &&
777c478bd9Sstevel@tonic-gate 	(*oid != gss_mech_krb5_old) &&
78ab9b2e15Sgtb 	(*oid != gss_mech_krb5_wrong) &&
797c478bd9Sstevel@tonic-gate 	(*oid != gss_nt_krb5_name) &&
807c478bd9Sstevel@tonic-gate 	(*oid != gss_nt_krb5_principal)) {
817c478bd9Sstevel@tonic-gate 	/* We don't know about this OID */
827c478bd9Sstevel@tonic-gate 	return(GSS_S_CONTINUE_NEEDED);
837c478bd9Sstevel@tonic-gate     }
847c478bd9Sstevel@tonic-gate     else {
857c478bd9Sstevel@tonic-gate 	*oid = GSS_C_NO_OID;
867c478bd9Sstevel@tonic-gate 	*minor_status = 0;
877c478bd9Sstevel@tonic-gate 	return(GSS_S_COMPLETE);
887c478bd9Sstevel@tonic-gate     }
897c478bd9Sstevel@tonic-gate }
907c478bd9Sstevel@tonic-gate 
91