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