xref: /onnv-gate/usr/src/lib/libgss/g_inq_context_oid.c (revision 13132:9615cdbf7b70)
110598SGlenn.Barry@Sun.COM /*
210598SGlenn.Barry@Sun.COM  * Copyright 2008 by the Massachusetts Institute of Technology.
310598SGlenn.Barry@Sun.COM  * All Rights Reserved.
410598SGlenn.Barry@Sun.COM  *
510598SGlenn.Barry@Sun.COM  * Export of this software from the United States of America may
610598SGlenn.Barry@Sun.COM  *   require a specific license from the United States Government.
710598SGlenn.Barry@Sun.COM  *   It is the responsibility of any person or organization contemplating
810598SGlenn.Barry@Sun.COM  *   export to obtain such a license before exporting.
910598SGlenn.Barry@Sun.COM  *
1010598SGlenn.Barry@Sun.COM  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
1110598SGlenn.Barry@Sun.COM  * distribute this software and its documentation for any purpose and
1210598SGlenn.Barry@Sun.COM  * without fee is hereby granted, provided that the above copyright
1310598SGlenn.Barry@Sun.COM  * notice appear in all copies and that both that copyright notice and
1410598SGlenn.Barry@Sun.COM  * this permission notice appear in supporting documentation, and that
1510598SGlenn.Barry@Sun.COM  * the name of M.I.T. not be used in advertising or publicity pertaining
1610598SGlenn.Barry@Sun.COM  * to distribution of the software without specific, written prior
1710598SGlenn.Barry@Sun.COM  * permission.  Furthermore if you modify this software you must label
1810598SGlenn.Barry@Sun.COM  * your software as modified software and not distribute it in such a
1910598SGlenn.Barry@Sun.COM  * fashion that it might be confused with the original M.I.T. software.
2010598SGlenn.Barry@Sun.COM  * M.I.T. makes no representations about the suitability of
2110598SGlenn.Barry@Sun.COM  * this software for any purpose.  It is provided "as is" without express
2210598SGlenn.Barry@Sun.COM  * or implied warranty.
2310598SGlenn.Barry@Sun.COM  *
2410598SGlenn.Barry@Sun.COM  */
2510598SGlenn.Barry@Sun.COM /*
26*13132SGlenn.Barry@oracle.com  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
2710598SGlenn.Barry@Sun.COM  */
2810598SGlenn.Barry@Sun.COM 
2910598SGlenn.Barry@Sun.COM /*
3010598SGlenn.Barry@Sun.COM  *  glue routine for gss_inquire_sec_context_by_oid
3110598SGlenn.Barry@Sun.COM  */
3210598SGlenn.Barry@Sun.COM 
3310598SGlenn.Barry@Sun.COM #include "mglueP.h"
34*13132SGlenn.Barry@oracle.com #include "gssapiP_generic.h"
35*13132SGlenn.Barry@oracle.com 
3610598SGlenn.Barry@Sun.COM #define gssint_get_mechanism __gss_get_mechanism /* SUNW17PACresync */
3710598SGlenn.Barry@Sun.COM 
3810598SGlenn.Barry@Sun.COM OM_uint32
gss_inquire_sec_context_by_oid(OM_uint32 * minor_status,const gss_ctx_id_t context_handle,const gss_OID desired_object,gss_buffer_set_t * data_set)3910598SGlenn.Barry@Sun.COM gss_inquire_sec_context_by_oid (OM_uint32 *minor_status,
4010598SGlenn.Barry@Sun.COM 	                        const gss_ctx_id_t context_handle,
4110598SGlenn.Barry@Sun.COM 	                        const gss_OID desired_object,
4210598SGlenn.Barry@Sun.COM 	                        gss_buffer_set_t *data_set)
4310598SGlenn.Barry@Sun.COM {
4410598SGlenn.Barry@Sun.COM     OM_uint32		status;
4510598SGlenn.Barry@Sun.COM     gss_union_ctx_id_t	ctx;
4610598SGlenn.Barry@Sun.COM     gss_mechanism	mech;
4710598SGlenn.Barry@Sun.COM 
4810598SGlenn.Barry@Sun.COM     if (minor_status == NULL)
4910598SGlenn.Barry@Sun.COM 	return GSS_S_CALL_INACCESSIBLE_WRITE;
5010598SGlenn.Barry@Sun.COM 
5110598SGlenn.Barry@Sun.COM     if (context_handle == GSS_C_NO_CONTEXT)
5210598SGlenn.Barry@Sun.COM 	return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT;
5310598SGlenn.Barry@Sun.COM 
5410598SGlenn.Barry@Sun.COM     /*
5510598SGlenn.Barry@Sun.COM      * select the approprate underlying mechanism routine and
5610598SGlenn.Barry@Sun.COM      * call it.
5710598SGlenn.Barry@Sun.COM      */
5810598SGlenn.Barry@Sun.COM 
5910598SGlenn.Barry@Sun.COM     ctx = (gss_union_ctx_id_t) context_handle;
6010598SGlenn.Barry@Sun.COM     mech = gssint_get_mechanism (ctx->mech_type);
6110598SGlenn.Barry@Sun.COM 
6210598SGlenn.Barry@Sun.COM     if (mech != NULL) {
6310598SGlenn.Barry@Sun.COM 	if (mech->gss_inquire_sec_context_by_oid != NULL) {
6410598SGlenn.Barry@Sun.COM 	    status = mech->gss_inquire_sec_context_by_oid(minor_status,
6510598SGlenn.Barry@Sun.COM 							  ctx->internal_ctx_id,
6610598SGlenn.Barry@Sun.COM 							  desired_object,
6710598SGlenn.Barry@Sun.COM 							  data_set);
6810598SGlenn.Barry@Sun.COM 	    if (status != GSS_S_COMPLETE)
6910598SGlenn.Barry@Sun.COM 		map_error(minor_status, mech);
7010598SGlenn.Barry@Sun.COM 	} else
7110598SGlenn.Barry@Sun.COM 	    status = GSS_S_BAD_MECH;
7210598SGlenn.Barry@Sun.COM 
7310598SGlenn.Barry@Sun.COM 	return status;
7410598SGlenn.Barry@Sun.COM     }
7510598SGlenn.Barry@Sun.COM 
7610598SGlenn.Barry@Sun.COM     return GSS_S_NO_CONTEXT;
7710598SGlenn.Barry@Sun.COM }
7810598SGlenn.Barry@Sun.COM 
79