1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD 3 * 4 * Copyright (c) 2008 Isilon Inc http://www.isilon.com/ 5 * Authors: Doug Rabson <dfr@rabson.org> 6 * Developed with Red Inc: Alfred Perlstein <alfred@freebsd.org> 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 * $FreeBSD$ 30 */ 31 32 #include "gssd.h" 33 34 MALLOC_DECLARE(M_GSSAPI); 35 36 struct _gss_ctx_id_t { 37 KOBJ_FIELDS; 38 gssd_ctx_id_t handle; 39 }; 40 41 struct _gss_cred_id_t { 42 gssd_cred_id_t handle; 43 }; 44 45 struct _gss_name_t { 46 gssd_name_t handle; 47 }; 48 49 struct kgss_mech { 50 LIST_ENTRY(kgss_mech) km_link; 51 gss_OID km_mech_type; 52 const char *km_mech_name; 53 struct kobj_class *km_class; 54 }; 55 LIST_HEAD(kgss_mech_list, kgss_mech); 56 57 /* Macros for VIMAGE. */ 58 /* Just define the KGSS_VNETxxx() macros as VNETxxx() macros. */ 59 #define KGSS_VNET_DEFINE(t, n) VNET_DEFINE(t, n) 60 #define KGSS_VNET_DEFINE_STATIC(t, n) VNET_DEFINE_STATIC(t, n) 61 #define KGSS_VNET_DECLARE(t, n) VNET_DECLARE(t, n) 62 #define KGSS_VNET(n) VNET(n) 63 64 #define KGSS_CURVNET_SET(n) CURVNET_SET(n) 65 #define KGSS_CURVNET_SET_QUIET(n) CURVNET_SET_QUIET(n) 66 #define KGSS_CURVNET_RESTORE() CURVNET_RESTORE() 67 #define KGSS_TD_TO_VNET(n) TD_TO_VNET(n) 68 69 extern struct mtx kgss_gssd_lock; 70 extern struct kgss_mech_list kgss_mechs; 71 72 KGSS_VNET_DECLARE(CLIENT *, kgss_gssd_handle); 73 74 CLIENT *kgss_gssd_client(void); 75 int kgss_oid_equal(const gss_OID oid1, const gss_OID oid2); 76 extern void kgss_install_mech(gss_OID mech_type, const char *name, 77 struct kobj_class *cls); 78 extern void kgss_uninstall_mech(gss_OID mech_type); 79 extern gss_OID kgss_find_mech_by_name(const char *name); 80 extern const char *kgss_find_mech_by_oid(const gss_OID oid); 81 extern gss_ctx_id_t kgss_create_context(gss_OID mech_type); 82 extern void kgss_delete_context(gss_ctx_id_t ctx, gss_buffer_t output_token); 83 extern OM_uint32 kgss_transfer_context(gss_ctx_id_t ctx); 84 extern void kgss_copy_buffer(const gss_buffer_t from, gss_buffer_t to); 85