1ba7b222eSGlenn Barry /*
2ba7b222eSGlenn Barry  * Copyright 2008 by the Massachusetts Institute of Technology.
3ba7b222eSGlenn Barry  * All Rights Reserved.
4ba7b222eSGlenn Barry  *
5ba7b222eSGlenn Barry  * Export of this software from the United States of America may
6ba7b222eSGlenn Barry  *   require a specific license from the United States Government.
7ba7b222eSGlenn Barry  *   It is the responsibility of any person or organization contemplating
8ba7b222eSGlenn Barry  *   export to obtain such a license before exporting.
9ba7b222eSGlenn Barry  *
10ba7b222eSGlenn Barry  * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
11ba7b222eSGlenn Barry  * distribute this software and its documentation for any purpose and
12ba7b222eSGlenn Barry  * without fee is hereby granted, provided that the above copyright
13ba7b222eSGlenn Barry  * notice appear in all copies and that both that copyright notice and
14ba7b222eSGlenn Barry  * this permission notice appear in supporting documentation, and that
15ba7b222eSGlenn Barry  * the name of M.I.T. not be used in advertising or publicity pertaining
16ba7b222eSGlenn Barry  * to distribution of the software without specific, written prior
17ba7b222eSGlenn Barry  * permission.  Furthermore if you modify this software you must label
18ba7b222eSGlenn Barry  * your software as modified software and not distribute it in such a
19ba7b222eSGlenn Barry  * fashion that it might be confused with the original M.I.T. software.
20ba7b222eSGlenn Barry  * M.I.T. makes no representations about the suitability of
21ba7b222eSGlenn Barry  * this software for any purpose.  It is provided "as is" without express
22ba7b222eSGlenn Barry  * or implied warranty.
23ba7b222eSGlenn Barry  *
24ba7b222eSGlenn Barry  */
25ba7b222eSGlenn Barry /*
26*5e01956fSGlenn Barry  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
27ba7b222eSGlenn Barry  */
28ba7b222eSGlenn Barry 
29ba7b222eSGlenn Barry /*
30ba7b222eSGlenn Barry  *  glue routine for gss_inquire_sec_context_by_oid
31ba7b222eSGlenn Barry  */
32ba7b222eSGlenn Barry 
33ba7b222eSGlenn Barry #include "mglueP.h"
34*5e01956fSGlenn Barry #include "gssapiP_generic.h"
35*5e01956fSGlenn Barry 
36ba7b222eSGlenn Barry #define gssint_get_mechanism __gss_get_mechanism /* SUNW17PACresync */
37ba7b222eSGlenn Barry 
38ba7b222eSGlenn Barry 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)39ba7b222eSGlenn Barry gss_inquire_sec_context_by_oid (OM_uint32 *minor_status,
40ba7b222eSGlenn Barry 	                        const gss_ctx_id_t context_handle,
41ba7b222eSGlenn Barry 	                        const gss_OID desired_object,
42ba7b222eSGlenn Barry 	                        gss_buffer_set_t *data_set)
43ba7b222eSGlenn Barry {
44ba7b222eSGlenn Barry     OM_uint32		status;
45ba7b222eSGlenn Barry     gss_union_ctx_id_t	ctx;
46ba7b222eSGlenn Barry     gss_mechanism	mech;
47ba7b222eSGlenn Barry 
48ba7b222eSGlenn Barry     if (minor_status == NULL)
49ba7b222eSGlenn Barry 	return GSS_S_CALL_INACCESSIBLE_WRITE;
50ba7b222eSGlenn Barry 
51ba7b222eSGlenn Barry     if (context_handle == GSS_C_NO_CONTEXT)
52ba7b222eSGlenn Barry 	return GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT;
53ba7b222eSGlenn Barry 
54ba7b222eSGlenn Barry     /*
55ba7b222eSGlenn Barry      * select the approprate underlying mechanism routine and
56ba7b222eSGlenn Barry      * call it.
57ba7b222eSGlenn Barry      */
58ba7b222eSGlenn Barry 
59ba7b222eSGlenn Barry     ctx = (gss_union_ctx_id_t) context_handle;
60ba7b222eSGlenn Barry     mech = gssint_get_mechanism (ctx->mech_type);
61ba7b222eSGlenn Barry 
62ba7b222eSGlenn Barry     if (mech != NULL) {
63ba7b222eSGlenn Barry 	if (mech->gss_inquire_sec_context_by_oid != NULL) {
64ba7b222eSGlenn Barry 	    status = mech->gss_inquire_sec_context_by_oid(minor_status,
65ba7b222eSGlenn Barry 							  ctx->internal_ctx_id,
66ba7b222eSGlenn Barry 							  desired_object,
67ba7b222eSGlenn Barry 							  data_set);
68ba7b222eSGlenn Barry 	    if (status != GSS_S_COMPLETE)
69ba7b222eSGlenn Barry 		map_error(minor_status, mech);
70ba7b222eSGlenn Barry 	} else
71ba7b222eSGlenn Barry 	    status = GSS_S_BAD_MECH;
72ba7b222eSGlenn Barry 
73ba7b222eSGlenn Barry 	return status;
74ba7b222eSGlenn Barry     }
75ba7b222eSGlenn Barry 
76ba7b222eSGlenn Barry     return GSS_S_NO_CONTEXT;
77ba7b222eSGlenn Barry }
78ba7b222eSGlenn Barry 
79