xref: /illumos-gate/usr/src/lib/libgss/g_oid_ops.c (revision 6a634c9d)
17c478bd9Sstevel@tonic-gate /*
2*5e01956fSGlenn Barry  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
37c478bd9Sstevel@tonic-gate  */
47c478bd9Sstevel@tonic-gate /*
57c478bd9Sstevel@tonic-gate  * lib/gssapi/mechglue/g_oid_ops.c
67c478bd9Sstevel@tonic-gate  *
77c478bd9Sstevel@tonic-gate  * Copyright 1995 by the Massachusetts Institute of Technology.
87c478bd9Sstevel@tonic-gate  * All Rights Reserved.
97c478bd9Sstevel@tonic-gate  *
107c478bd9Sstevel@tonic-gate  * Export of this software from the United States of America may
117c478bd9Sstevel@tonic-gate  *   require a specific license from the United States Government.
127c478bd9Sstevel@tonic-gate  *   It is the responsibility of any person or organization contemplating
137c478bd9Sstevel@tonic-gate  *   export to obtain such a license before exporting.
147c478bd9Sstevel@tonic-gate  *
157c478bd9Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
167c478bd9Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
177c478bd9Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
187c478bd9Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
197c478bd9Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
207c478bd9Sstevel@tonic-gate  * the name of M.I.T. not be used in advertising or publicity pertaining
217c478bd9Sstevel@tonic-gate  * to distribution of the software without specific, written prior
227c478bd9Sstevel@tonic-gate  * permission.  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  * oid_ops.c - GSS-API V2 interfaces to manipulate OIDs
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #include <mechglueP.h>
33*5e01956fSGlenn Barry #include "gssapiP_generic.h"
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate /*
367c478bd9Sstevel@tonic-gate  * gss_release_oid has been moved to g_initialize, becasue it requires access
377c478bd9Sstevel@tonic-gate  * to the mechanism list.  All functions requiring direct access to the
387c478bd9Sstevel@tonic-gate  * mechanism list are now in g_initialize.c
397c478bd9Sstevel@tonic-gate  */
407c478bd9Sstevel@tonic-gate 
417c478bd9Sstevel@tonic-gate OM_uint32
gss_create_empty_oid_set(minor_status,oid_set)427c478bd9Sstevel@tonic-gate gss_create_empty_oid_set(minor_status, oid_set)
437c478bd9Sstevel@tonic-gate 	OM_uint32		*minor_status;
447c478bd9Sstevel@tonic-gate 	gss_OID_set		*oid_set;
457c478bd9Sstevel@tonic-gate {
46*5e01956fSGlenn Barry 	OM_uint32 status;
47*5e01956fSGlenn Barry 	status = generic_gss_create_empty_oid_set(minor_status, oid_set);
48*5e01956fSGlenn Barry 	if (status != GSS_S_COMPLETE)
49*5e01956fSGlenn Barry 		map_errcode(minor_status);
50*5e01956fSGlenn Barry 	return status;
517c478bd9Sstevel@tonic-gate }
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate OM_uint32
gss_add_oid_set_member(minor_status,member_oid,oid_set)547c478bd9Sstevel@tonic-gate gss_add_oid_set_member(minor_status, member_oid, oid_set)
557c478bd9Sstevel@tonic-gate 	OM_uint32		*minor_status;
567c478bd9Sstevel@tonic-gate 	const gss_OID		member_oid;
577c478bd9Sstevel@tonic-gate 	gss_OID_set		*oid_set;
587c478bd9Sstevel@tonic-gate {
59*5e01956fSGlenn Barry 	OM_uint32 status;
60*5e01956fSGlenn Barry 	status = generic_gss_add_oid_set_member(minor_status, member_oid,
61*5e01956fSGlenn Barry 						oid_set);
62*5e01956fSGlenn Barry 	if (status != GSS_S_COMPLETE)
63*5e01956fSGlenn Barry 		map_errcode(minor_status);
64*5e01956fSGlenn Barry 	return status;
657c478bd9Sstevel@tonic-gate }
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate OM_uint32
gss_test_oid_set_member(minor_status,member,set,present)687c478bd9Sstevel@tonic-gate gss_test_oid_set_member(minor_status, member, set, present)
697c478bd9Sstevel@tonic-gate 	OM_uint32		*minor_status;
707c478bd9Sstevel@tonic-gate 	const gss_OID		member;
717c478bd9Sstevel@tonic-gate 	const gss_OID_set	set;
727c478bd9Sstevel@tonic-gate 	int			*present;
737c478bd9Sstevel@tonic-gate {
747c478bd9Sstevel@tonic-gate 	return (generic_gss_test_oid_set_member(minor_status, member, set,
757c478bd9Sstevel@tonic-gate 				present));
767c478bd9Sstevel@tonic-gate }
777c478bd9Sstevel@tonic-gate 
787c478bd9Sstevel@tonic-gate OM_uint32
gss_oid_to_str(minor_status,oid,oid_str)797c478bd9Sstevel@tonic-gate gss_oid_to_str(minor_status, oid, oid_str)
807c478bd9Sstevel@tonic-gate 	OM_uint32		*minor_status;
817c478bd9Sstevel@tonic-gate 	const gss_OID		oid;
827c478bd9Sstevel@tonic-gate 	gss_buffer_t		oid_str;
837c478bd9Sstevel@tonic-gate {
84*5e01956fSGlenn Barry 	OM_uint32 status = generic_gss_oid_to_str(minor_status, oid, oid_str);
85*5e01956fSGlenn Barry 	if (status != GSS_S_COMPLETE)
86*5e01956fSGlenn Barry 		map_errcode(minor_status);
87*5e01956fSGlenn Barry 	return status;
887c478bd9Sstevel@tonic-gate }
897c478bd9Sstevel@tonic-gate 
907c478bd9Sstevel@tonic-gate OM_uint32
gss_str_to_oid(minor_status,oid_str,oid)917c478bd9Sstevel@tonic-gate gss_str_to_oid(minor_status, oid_str, oid)
927c478bd9Sstevel@tonic-gate 	OM_uint32		*minor_status;
937c478bd9Sstevel@tonic-gate 	const gss_buffer_t	oid_str;
947c478bd9Sstevel@tonic-gate 	gss_OID			*oid;
957c478bd9Sstevel@tonic-gate {
96*5e01956fSGlenn Barry 	OM_uint32 status = generic_gss_str_to_oid(minor_status, oid_str, oid);
97*5e01956fSGlenn Barry 	if (status != GSS_S_COMPLETE)
98*5e01956fSGlenn Barry 		map_errcode(minor_status);
99*5e01956fSGlenn Barry 	return status;
1007c478bd9Sstevel@tonic-gate }
101