1*d3273b5bSchristos /* $NetBSD: kuserok_plugin.h,v 1.2 2017/01/28 21:31:49 christos Exp $ */ 2b9d004c6Schristos 3b9d004c6Schristos /* 4b9d004c6Schristos * Copyright (c) 2011, Secure Endpoints Inc. 5b9d004c6Schristos * All rights reserved. 6b9d004c6Schristos * 7b9d004c6Schristos * Redistribution and use in source and binary forms, with or without 8b9d004c6Schristos * modification, are permitted provided that the following conditions 9b9d004c6Schristos * are met: 10b9d004c6Schristos * 11b9d004c6Schristos * - Redistributions of source code must retain the above copyright 12b9d004c6Schristos * notice, this list of conditions and the following disclaimer. 13b9d004c6Schristos * 14b9d004c6Schristos * - Redistributions in binary form must reproduce the above copyright 15b9d004c6Schristos * notice, this list of conditions and the following disclaimer in 16b9d004c6Schristos * the documentation and/or other materials provided with the 17b9d004c6Schristos * distribution. 18b9d004c6Schristos * 19b9d004c6Schristos * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20b9d004c6Schristos * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21b9d004c6Schristos * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22b9d004c6Schristos * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23b9d004c6Schristos * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 24b9d004c6Schristos * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25b9d004c6Schristos * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26b9d004c6Schristos * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27b9d004c6Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 28b9d004c6Schristos * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29b9d004c6Schristos * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 30b9d004c6Schristos * OF THE POSSIBILITY OF SUCH DAMAGE. 31b9d004c6Schristos * 32b9d004c6Schristos */ 33b9d004c6Schristos 34b9d004c6Schristos #ifndef HEIMDAL_KRB5_KUSEROK_PLUGIN_H 35b9d004c6Schristos #define HEIMDAL_KRB5_KUSEROK_PLUGIN_H 1 36b9d004c6Schristos 37b9d004c6Schristos #define KRB5_PLUGIN_KUSEROK "krb5_plugin_kuserok" 38b9d004c6Schristos #define KRB5_PLUGIN_KUSEROK_VERSION_0 0 39b9d004c6Schristos 40b9d004c6Schristos /** @struct krb5plugin_kuserok_ftable_desc 41b9d004c6Schristos * 42b9d004c6Schristos * @brief Description of the krb5_kuserok(3) plugin facility. 43b9d004c6Schristos * 44b9d004c6Schristos * The krb5_kuserok(3) function is pluggable. The plugin is named 45b9d004c6Schristos * KRB5_PLUGIN_KUSEROK ("krb5_plugin_kuserok"), with a single minor 46b9d004c6Schristos * version, KRB5_PLUGIN_KUSEROK_VERSION_0 (0). 47b9d004c6Schristos * 48b9d004c6Schristos * The plugin for krb5_kuserok(3) consists of a data symbol referencing 49b9d004c6Schristos * a structure of type krb5plugin_kuserok_ftable, with four fields: 50b9d004c6Schristos * 51b9d004c6Schristos * @param init Plugin initialization function (see krb5-plugin(7)) 52b9d004c6Schristos * 53b9d004c6Schristos * @param minor_version The plugin minor version number (0) 54b9d004c6Schristos * 55b9d004c6Schristos * @param fini Plugin finalization function 56b9d004c6Schristos * 57b9d004c6Schristos * @param kuserok Plugin kuserok function 58b9d004c6Schristos * 59b9d004c6Schristos * The kuserok field is the plugin entry point that performs the 60b9d004c6Schristos * traditional kuserok operation however the plugin desires. It is 61b9d004c6Schristos * invoked in no particular order relative to other kuserok plugins, but 62b9d004c6Schristos * it has a 'rule' argument that indicates which plugin is intended to 63b9d004c6Schristos * act on the rule. The plugin kuserok function must return 64b9d004c6Schristos * KRB5_PLUGIN_NO_HANDLE if the rule is not applicable to it. 65b9d004c6Schristos * 66b9d004c6Schristos * The plugin kuserok function has the following arguments, in this 67b9d004c6Schristos * order: 68b9d004c6Schristos * 69b9d004c6Schristos * -# plug_ctx, the context value output by the plugin's init function 70b9d004c6Schristos * -# context, a krb5_context 71b9d004c6Schristos * -# rule, the kuserok rule being evaluated (from krb5.conf(5)) 72b9d004c6Schristos * -# flags 73b9d004c6Schristos * -# k5login_dir, configured location of k5login per-user files if any 74b9d004c6Schristos * -# luser, name of the local user account to which principal is attempting to access. 75b9d004c6Schristos * -# principal, the krb5_principal trying to access the luser account 76b9d004c6Schristos * -# result, a krb5_boolean pointer where the plugin will output its result 77b9d004c6Schristos * 78b9d004c6Schristos * @ingroup krb5_support 79b9d004c6Schristos */ 80b9d004c6Schristos typedef struct krb5plugin_kuserok_ftable_desc { 81b9d004c6Schristos int minor_version; 82b9d004c6Schristos krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **); 83b9d004c6Schristos void (KRB5_LIB_CALL *fini)(void *); 84b9d004c6Schristos krb5_error_code (KRB5_LIB_CALL *kuserok)(void *, krb5_context, const char *, 85b9d004c6Schristos unsigned int, const char *, const char *, 86b9d004c6Schristos krb5_const_principal, 87b9d004c6Schristos krb5_boolean *); 88b9d004c6Schristos } krb5plugin_kuserok_ftable; 89b9d004c6Schristos 90b9d004c6Schristos #define KUSEROK_ANAME_TO_LNAME_OK 1 91b9d004c6Schristos #define KUSEROK_K5LOGIN_IS_AUTHORITATIVE 2 92b9d004c6Schristos 93b9d004c6Schristos #endif /* HEIMDAL_KRB5_KUSEROK_PLUGIN_H */ 94