xref: /onnv-gate/usr/src/lib/libgss/g_oid_ops.c (revision 13132:9615cdbf7b70)
10Sstevel@tonic-gate /*
2*13132SGlenn.Barry@oracle.com  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
30Sstevel@tonic-gate  */
40Sstevel@tonic-gate /*
50Sstevel@tonic-gate  * lib/gssapi/mechglue/g_oid_ops.c
60Sstevel@tonic-gate  *
70Sstevel@tonic-gate  * Copyright 1995 by the Massachusetts Institute of Technology.
80Sstevel@tonic-gate  * All Rights Reserved.
90Sstevel@tonic-gate  *
100Sstevel@tonic-gate  * Export of this software from the United States of America may
110Sstevel@tonic-gate  *   require a specific license from the United States Government.
120Sstevel@tonic-gate  *   It is the responsibility of any person or organization contemplating
130Sstevel@tonic-gate  *   export to obtain such a license before exporting.
140Sstevel@tonic-gate  *
150Sstevel@tonic-gate  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
160Sstevel@tonic-gate  * distribute this software and its documentation for any purpose and
170Sstevel@tonic-gate  * without fee is hereby granted, provided that the above copyright
180Sstevel@tonic-gate  * notice appear in all copies and that both that copyright notice and
190Sstevel@tonic-gate  * this permission notice appear in supporting documentation, and that
200Sstevel@tonic-gate  * the name of M.I.T. not be used in advertising or publicity pertaining
210Sstevel@tonic-gate  * to distribution of the software without specific, written prior
220Sstevel@tonic-gate  * permission.  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  * oid_ops.c - GSS-API V2 interfaces to manipulate OIDs
300Sstevel@tonic-gate  */
310Sstevel@tonic-gate 
320Sstevel@tonic-gate #include <mechglueP.h>
33*13132SGlenn.Barry@oracle.com #include "gssapiP_generic.h"
340Sstevel@tonic-gate 
350Sstevel@tonic-gate /*
360Sstevel@tonic-gate  * gss_release_oid has been moved to g_initialize, becasue it requires access
370Sstevel@tonic-gate  * to the mechanism list.  All functions requiring direct access to the
380Sstevel@tonic-gate  * mechanism list are now in g_initialize.c
390Sstevel@tonic-gate  */
400Sstevel@tonic-gate 
410Sstevel@tonic-gate OM_uint32
gss_create_empty_oid_set(minor_status,oid_set)420Sstevel@tonic-gate gss_create_empty_oid_set(minor_status, oid_set)
430Sstevel@tonic-gate 	OM_uint32		*minor_status;
440Sstevel@tonic-gate 	gss_OID_set		*oid_set;
450Sstevel@tonic-gate {
46*13132SGlenn.Barry@oracle.com 	OM_uint32 status;
47*13132SGlenn.Barry@oracle.com 	status = generic_gss_create_empty_oid_set(minor_status, oid_set);
48*13132SGlenn.Barry@oracle.com 	if (status != GSS_S_COMPLETE)
49*13132SGlenn.Barry@oracle.com 		map_errcode(minor_status);
50*13132SGlenn.Barry@oracle.com 	return status;
510Sstevel@tonic-gate }
520Sstevel@tonic-gate 
530Sstevel@tonic-gate OM_uint32
gss_add_oid_set_member(minor_status,member_oid,oid_set)540Sstevel@tonic-gate gss_add_oid_set_member(minor_status, member_oid, oid_set)
550Sstevel@tonic-gate 	OM_uint32		*minor_status;
560Sstevel@tonic-gate 	const gss_OID		member_oid;
570Sstevel@tonic-gate 	gss_OID_set		*oid_set;
580Sstevel@tonic-gate {
59*13132SGlenn.Barry@oracle.com 	OM_uint32 status;
60*13132SGlenn.Barry@oracle.com 	status = generic_gss_add_oid_set_member(minor_status, member_oid,
61*13132SGlenn.Barry@oracle.com 						oid_set);
62*13132SGlenn.Barry@oracle.com 	if (status != GSS_S_COMPLETE)
63*13132SGlenn.Barry@oracle.com 		map_errcode(minor_status);
64*13132SGlenn.Barry@oracle.com 	return status;
650Sstevel@tonic-gate }
660Sstevel@tonic-gate 
670Sstevel@tonic-gate OM_uint32
gss_test_oid_set_member(minor_status,member,set,present)680Sstevel@tonic-gate gss_test_oid_set_member(minor_status, member, set, present)
690Sstevel@tonic-gate 	OM_uint32		*minor_status;
700Sstevel@tonic-gate 	const gss_OID		member;
710Sstevel@tonic-gate 	const gss_OID_set	set;
720Sstevel@tonic-gate 	int			*present;
730Sstevel@tonic-gate {
740Sstevel@tonic-gate 	return (generic_gss_test_oid_set_member(minor_status, member, set,
750Sstevel@tonic-gate 				present));
760Sstevel@tonic-gate }
770Sstevel@tonic-gate 
780Sstevel@tonic-gate OM_uint32
gss_oid_to_str(minor_status,oid,oid_str)790Sstevel@tonic-gate gss_oid_to_str(minor_status, oid, oid_str)
800Sstevel@tonic-gate 	OM_uint32		*minor_status;
810Sstevel@tonic-gate 	const gss_OID		oid;
820Sstevel@tonic-gate 	gss_buffer_t		oid_str;
830Sstevel@tonic-gate {
84*13132SGlenn.Barry@oracle.com 	OM_uint32 status = generic_gss_oid_to_str(minor_status, oid, oid_str);
85*13132SGlenn.Barry@oracle.com 	if (status != GSS_S_COMPLETE)
86*13132SGlenn.Barry@oracle.com 		map_errcode(minor_status);
87*13132SGlenn.Barry@oracle.com 	return status;
880Sstevel@tonic-gate }
890Sstevel@tonic-gate 
900Sstevel@tonic-gate OM_uint32
gss_str_to_oid(minor_status,oid_str,oid)910Sstevel@tonic-gate gss_str_to_oid(minor_status, oid_str, oid)
920Sstevel@tonic-gate 	OM_uint32		*minor_status;
930Sstevel@tonic-gate 	const gss_buffer_t	oid_str;
940Sstevel@tonic-gate 	gss_OID			*oid;
950Sstevel@tonic-gate {
96*13132SGlenn.Barry@oracle.com 	OM_uint32 status = generic_gss_str_to_oid(minor_status, oid_str, oid);
97*13132SGlenn.Barry@oracle.com 	if (status != GSS_S_COMPLETE)
98*13132SGlenn.Barry@oracle.com 		map_errcode(minor_status);
99*13132SGlenn.Barry@oracle.com 	return status;
1000Sstevel@tonic-gate }
101