xref: /freebsd/kerberos5/lib/libgssapi_spnego/freebsd_compat.c (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
1ae771770SStanislav Sedov /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
31de7b4b8SPedro F. Giffuni  *
4ae771770SStanislav Sedov  * Copyright (c) 2008 Doug Rabson
5ae771770SStanislav Sedov  * All rights reserved.
6ae771770SStanislav Sedov  *
7ae771770SStanislav Sedov  * Redistribution and use in source and binary forms, with or without
8ae771770SStanislav Sedov  * modification, are permitted provided that the following conditions
9ae771770SStanislav Sedov  * are met:
10ae771770SStanislav Sedov  * 1. Redistributions of source code must retain the above copyright
11ae771770SStanislav Sedov  *    notice, this list of conditions and the following disclaimer.
12ae771770SStanislav Sedov  * 2. Redistributions in binary form must reproduce the above copyright
13ae771770SStanislav Sedov  *    notice, this list of conditions and the following disclaimer in the
14ae771770SStanislav Sedov  *    documentation and/or other materials provided with the distribution.
15ae771770SStanislav Sedov  *
16ae771770SStanislav Sedov  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17ae771770SStanislav Sedov  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18ae771770SStanislav Sedov  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19ae771770SStanislav Sedov  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20ae771770SStanislav Sedov  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21ae771770SStanislav Sedov  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22ae771770SStanislav Sedov  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23ae771770SStanislav Sedov  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24ae771770SStanislav Sedov  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25ae771770SStanislav Sedov  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26ae771770SStanislav Sedov  * SUCH DAMAGE.
27ae771770SStanislav Sedov  */
28ae771770SStanislav Sedov 
29ae771770SStanislav Sedov #include <gssapi/gssapi.h>
30ae771770SStanislav Sedov #include <mech_switch.h>
31ae771770SStanislav Sedov 
32ae771770SStanislav Sedov gss_OID_desc __gss_c_nt_hostbased_service_oid_desc =
33ae771770SStanislav Sedov     {10, (void *)("\x2a\x86\x48\x86\xf7\x12" "\x01\x02\x01\x04")};
34ae771770SStanislav Sedov 
35ae771770SStanislav Sedov const char *
_gss_name_prefix(void)36ae771770SStanislav Sedov _gss_name_prefix(void)
37ae771770SStanislav Sedov {
38ae771770SStanislav Sedov 	return "_gss_spnego";
39ae771770SStanislav Sedov }
40ae771770SStanislav Sedov 
41ae771770SStanislav Sedov void
gss_mg_collect_error(gss_OID mech,OM_uint32 maj,OM_uint32 min)42ae771770SStanislav Sedov gss_mg_collect_error(gss_OID mech, OM_uint32 maj, OM_uint32 min)
43ae771770SStanislav Sedov {
44ae771770SStanislav Sedov 	_gss_mg_collect_error(mech, maj, min);
45ae771770SStanislav Sedov }
46ae771770SStanislav Sedov 
_gss_spnego_display_status(OM_uint32 * minor_status,OM_uint32 status_value,int status_type,const gss_OID mech_type,OM_uint32 * message_context,gss_buffer_t status_string)47ae771770SStanislav Sedov OM_uint32 _gss_spnego_display_status
48ae771770SStanislav Sedov            (OM_uint32 * minor_status,
49ae771770SStanislav Sedov             OM_uint32 status_value,
50ae771770SStanislav Sedov             int status_type,
51ae771770SStanislav Sedov             const gss_OID mech_type,
52ae771770SStanislav Sedov             OM_uint32 * message_context,
53ae771770SStanislav Sedov             gss_buffer_t status_string
54ae771770SStanislav Sedov            )
55ae771770SStanislav Sedov {
56ae771770SStanislav Sedov     return GSS_S_FAILURE;
57ae771770SStanislav Sedov }
58ae771770SStanislav Sedov 
_gss_spnego_add_cred(OM_uint32 * minor_status,const gss_cred_id_t input_cred_handle,const gss_name_t desired_name,const gss_OID desired_mech,gss_cred_usage_t cred_usage,OM_uint32 initiator_time_req,OM_uint32 acceptor_time_req,gss_cred_id_t * output_cred_handle,gss_OID_set * actual_mechs,OM_uint32 * initiator_time_rec,OM_uint32 * acceptor_time_rec)59ae771770SStanislav Sedov OM_uint32 _gss_spnego_add_cred (
60ae771770SStanislav Sedov             OM_uint32 * minor_status,
61ae771770SStanislav Sedov             const gss_cred_id_t input_cred_handle,
62ae771770SStanislav Sedov             const gss_name_t desired_name,
63ae771770SStanislav Sedov             const gss_OID desired_mech,
64ae771770SStanislav Sedov             gss_cred_usage_t cred_usage,
65ae771770SStanislav Sedov             OM_uint32 initiator_time_req,
66ae771770SStanislav Sedov             OM_uint32 acceptor_time_req,
67ae771770SStanislav Sedov             gss_cred_id_t * output_cred_handle,
68ae771770SStanislav Sedov             gss_OID_set * actual_mechs,
69ae771770SStanislav Sedov             OM_uint32 * initiator_time_rec,
70ae771770SStanislav Sedov             OM_uint32 * acceptor_time_rec
71ae771770SStanislav Sedov            )
72ae771770SStanislav Sedov {
73ae771770SStanislav Sedov 	return gss_add_cred(minor_status,
74ae771770SStanislav Sedov                        input_cred_handle,
75ae771770SStanislav Sedov                        desired_name,
76ae771770SStanislav Sedov                        desired_mech,
77ae771770SStanislav Sedov                        cred_usage,
78ae771770SStanislav Sedov                        initiator_time_req,
79ae771770SStanislav Sedov                        acceptor_time_req,
80ae771770SStanislav Sedov                        output_cred_handle,
81ae771770SStanislav Sedov                        actual_mechs,
82ae771770SStanislav Sedov                        initiator_time_rec,
83ae771770SStanislav Sedov                        acceptor_time_rec);
84ae771770SStanislav Sedov }
85