Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/kgssapi/gssapi_impl.h
39476 views
1
/*-
2
* SPDX-License-Identifier: BSD-2-Clause
3
*
4
* Copyright (c) 2008 Isilon Inc http://www.isilon.com/
5
* Authors: Doug Rabson <[email protected]>
6
* Developed with Red Inc: Alfred Perlstein <[email protected]>
7
*
8
* Redistribution and use in source and binary forms, with or without
9
* modification, are permitted provided that the following conditions
10
* are met:
11
* 1. Redistributions of source code must retain the above copyright
12
* notice, this list of conditions and the following disclaimer.
13
* 2. Redistributions in binary form must reproduce the above copyright
14
* notice, this list of conditions and the following disclaimer in the
15
* documentation and/or other materials provided with the distribution.
16
*
17
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
18
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
21
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27
* SUCH DAMAGE.
28
*/
29
30
#include "gssd.h"
31
32
MALLOC_DECLARE(M_GSSAPI);
33
34
struct _gss_ctx_id_t {
35
KOBJ_FIELDS;
36
gssd_ctx_id_t handle;
37
};
38
39
struct _gss_cred_id_t {
40
gssd_cred_id_t handle;
41
};
42
43
struct _gss_name_t {
44
gssd_name_t handle;
45
};
46
47
struct kgss_mech {
48
LIST_ENTRY(kgss_mech) km_link;
49
gss_OID km_mech_type;
50
const char *km_mech_name;
51
struct kobj_class *km_class;
52
};
53
LIST_HEAD(kgss_mech_list, kgss_mech);
54
55
/* Macros for VIMAGE. */
56
/* Just define the KGSS_VNETxxx() macros as VNETxxx() macros. */
57
#define KGSS_VNET_DEFINE(t, n) VNET_DEFINE(t, n)
58
#define KGSS_VNET_DEFINE_STATIC(t, n) VNET_DEFINE_STATIC(t, n)
59
#define KGSS_VNET_DECLARE(t, n) VNET_DECLARE(t, n)
60
#define KGSS_VNET(n) VNET(n)
61
62
#define KGSS_CURVNET_SET(n) CURVNET_SET(n)
63
#define KGSS_CURVNET_SET_QUIET(n) CURVNET_SET_QUIET(n)
64
#define KGSS_CURVNET_RESTORE() CURVNET_RESTORE()
65
#define KGSS_TD_TO_VNET(n) TD_TO_VNET(n)
66
67
extern struct mtx kgss_gssd_lock;
68
extern struct kgss_mech_list kgss_mechs;
69
70
KGSS_VNET_DECLARE(CLIENT *, kgss_gssd_handle);
71
72
CLIENT *kgss_gssd_client(void);
73
int kgss_oid_equal(const gss_OID oid1, const gss_OID oid2);
74
extern void kgss_install_mech(gss_OID mech_type, const char *name,
75
struct kobj_class *cls);
76
extern void kgss_uninstall_mech(gss_OID mech_type);
77
extern gss_OID kgss_find_mech_by_name(const char *name);
78
extern const char *kgss_find_mech_by_oid(const gss_OID oid);
79
extern gss_ctx_id_t kgss_create_context(gss_OID mech_type);
80
extern void kgss_delete_context(gss_ctx_id_t ctx, gss_buffer_t output_token);
81
extern OM_uint32 kgss_transfer_context(gss_ctx_id_t ctx, void *lctx);
82
extern void kgss_copy_buffer(const gss_buffer_t from, gss_buffer_t to);
83
84