133f12199SDoug Rabson /*-
2*4d846d26SWarner Losh * SPDX-License-Identifier: BSD-2-Clause
35e53a4f9SPedro F. Giffuni *
433f12199SDoug Rabson * Copyright (c) 2008 Doug Rabson
533f12199SDoug Rabson * All rights reserved.
633f12199SDoug Rabson *
733f12199SDoug Rabson * Redistribution and use in source and binary forms, with or without
833f12199SDoug Rabson * modification, are permitted provided that the following conditions
933f12199SDoug Rabson * are met:
1033f12199SDoug Rabson * 1. Redistributions of source code must retain the above copyright
1133f12199SDoug Rabson * notice, this list of conditions and the following disclaimer.
1233f12199SDoug Rabson * 2. Redistributions in binary form must reproduce the above copyright
1333f12199SDoug Rabson * notice, this list of conditions and the following disclaimer in the
1433f12199SDoug Rabson * documentation and/or other materials provided with the distribution.
1533f12199SDoug Rabson *
1633f12199SDoug Rabson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1733f12199SDoug Rabson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1833f12199SDoug Rabson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1933f12199SDoug Rabson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2033f12199SDoug Rabson * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2133f12199SDoug Rabson * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2233f12199SDoug Rabson * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2333f12199SDoug Rabson * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2433f12199SDoug Rabson * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2533f12199SDoug Rabson * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2633f12199SDoug Rabson * SUCH DAMAGE.
2733f12199SDoug Rabson */
2833f12199SDoug Rabson
2933f12199SDoug Rabson #include <gssapi/gssapi.h>
3033f12199SDoug Rabson
3133f12199SDoug Rabson #include "mech_switch.h"
3233f12199SDoug Rabson #include "context.h"
3333f12199SDoug Rabson
3433f12199SDoug Rabson 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 * result)3533f12199SDoug Rabson gss_inquire_sec_context_by_oid(OM_uint32 *minor_status,
3633f12199SDoug Rabson const gss_ctx_id_t context_handle,
3733f12199SDoug Rabson const gss_OID desired_object,
3833f12199SDoug Rabson gss_buffer_set_t *result)
3933f12199SDoug Rabson {
4033f12199SDoug Rabson OM_uint32 major_status;
4133f12199SDoug Rabson struct _gss_context *ctx = (struct _gss_context *) context_handle;
4233f12199SDoug Rabson struct _gss_mech_switch *m;
4333f12199SDoug Rabson
4433f12199SDoug Rabson *minor_status = 0;
4533f12199SDoug Rabson *result = GSS_C_NO_BUFFER_SET;
4633f12199SDoug Rabson if (!ctx)
4733f12199SDoug Rabson return (GSS_S_NO_CONTEXT);
4833f12199SDoug Rabson
4933f12199SDoug Rabson m = ctx->gc_mech;
5033f12199SDoug Rabson if (m->gm_inquire_sec_context_by_oid) {
5133f12199SDoug Rabson major_status = m->gm_inquire_sec_context_by_oid(
5233f12199SDoug Rabson minor_status, ctx->gc_ctx, desired_object, result);
5333f12199SDoug Rabson if (major_status != GSS_S_COMPLETE)
5433f12199SDoug Rabson _gss_mg_error(m, major_status, *minor_status);
5533f12199SDoug Rabson } else {
5633f12199SDoug Rabson major_status = GSS_S_BAD_MECH;
5733f12199SDoug Rabson }
5833f12199SDoug Rabson
5933f12199SDoug Rabson return (major_status);
6033f12199SDoug Rabson }
61