1*d3273b5bSchristos /* $NetBSD: an2ln_plugin.h,v 1.2 2017/01/28 21:31:49 christos Exp $ */ 2b9d004c6Schristos 3b9d004c6Schristos /* 4b9d004c6Schristos * Copyright (c) 2006 Kungliga Tekniska Högskolan 5b9d004c6Schristos * (Royal Institute of Technology, Stockholm, Sweden). 6b9d004c6Schristos * All rights reserved. 7b9d004c6Schristos * 8b9d004c6Schristos * Redistribution and use in source and binary forms, with or without 9b9d004c6Schristos * modification, are permitted provided that the following conditions 10b9d004c6Schristos * are met: 11b9d004c6Schristos * 12b9d004c6Schristos * 1. Redistributions of source code must retain the above copyright 13b9d004c6Schristos * notice, this list of conditions and the following disclaimer. 14b9d004c6Schristos * 15b9d004c6Schristos * 2. Redistributions in binary form must reproduce the above copyright 16b9d004c6Schristos * notice, this list of conditions and the following disclaimer in the 17b9d004c6Schristos * documentation and/or other materials provided with the distribution. 18b9d004c6Schristos * 19b9d004c6Schristos * 3. Neither the name of the Institute nor the names of its contributors 20b9d004c6Schristos * may be used to endorse or promote products derived from this software 21b9d004c6Schristos * without specific prior written permission. 22b9d004c6Schristos * 23b9d004c6Schristos * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND 24b9d004c6Schristos * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 25b9d004c6Schristos * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 26b9d004c6Schristos * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE 27b9d004c6Schristos * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 28b9d004c6Schristos * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 29b9d004c6Schristos * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 30b9d004c6Schristos * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 31b9d004c6Schristos * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 32b9d004c6Schristos * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 33b9d004c6Schristos * SUCH DAMAGE. 34b9d004c6Schristos */ 35b9d004c6Schristos 36b9d004c6Schristos /* Id */ 37b9d004c6Schristos 38b9d004c6Schristos #ifndef HEIMDAL_KRB5_AN2LN_PLUGIN_H 39b9d004c6Schristos #define HEIMDAL_KRB5_AN2LN_PLUGIN_H 1 40b9d004c6Schristos 41b9d004c6Schristos #define KRB5_PLUGIN_AN2LN "an2ln" 42b9d004c6Schristos #define KRB5_PLUGIN_AN2LN_VERSION_0 0 43b9d004c6Schristos 44b9d004c6Schristos typedef krb5_error_code (KRB5_LIB_CALL *set_result_f)(void *, const char *); 45b9d004c6Schristos 46b9d004c6Schristos /** @struct krb5plugin_an2ln_ftable_desc 47b9d004c6Schristos * 48b9d004c6Schristos * @brief Description of the krb5_aname_to_lname(3) plugin facility. 49b9d004c6Schristos * 50b9d004c6Schristos * The krb5_aname_to_lname(3) function is pluggable. The plugin is 51b9d004c6Schristos * named KRB5_PLUGIN_AN2LN ("an2ln"), with a single minor version, 52b9d004c6Schristos * KRB5_PLUGIN_AN2LN_VERSION_0 (0). 53b9d004c6Schristos * 54b9d004c6Schristos * The plugin for krb5_aname_to_lname(3) consists of a data symbol 55b9d004c6Schristos * referencing a structure of type krb5plugin_an2ln_ftable, with four 56b9d004c6Schristos * fields: 57b9d004c6Schristos * 58b9d004c6Schristos * @param init Plugin initialization function (see krb5-plugin(7)) 59b9d004c6Schristos * 60b9d004c6Schristos * @param minor_version The plugin minor version number (0) 61b9d004c6Schristos * 62b9d004c6Schristos * @param fini Plugin finalization function 63b9d004c6Schristos * 64b9d004c6Schristos * @param an2ln Plugin aname_to_lname function 65b9d004c6Schristos * 66b9d004c6Schristos * The an2ln field is the plugin entry point that performs the 67b9d004c6Schristos * traditional aname_to_lname operation however the plugin desires. It 68b9d004c6Schristos * is invoked in no particular order relative to other an2ln plugins, 69b9d004c6Schristos * but it has a 'rule' argument that indicates which plugin is intended 70b9d004c6Schristos * to act on the rule. The plugin an2ln function must return 71b9d004c6Schristos * KRB5_PLUGIN_NO_HANDLE if the rule is not applicable to it. 72b9d004c6Schristos * 73b9d004c6Schristos * The plugin an2ln function has the following arguments, in this order: 74b9d004c6Schristos * 75b9d004c6Schristos * -# plug_ctx, the context value output by the plugin's init function 76b9d004c6Schristos * -# context, a krb5_context 77b9d004c6Schristos * -# rule, the aname_to_lname rule being evaluated (from krb5.conf(5)) 78b9d004c6Schristos * -# aname, the krb5_principal to be mapped to an lname 79b9d004c6Schristos * -# set_res_f, a function the plugin must call to set its result 80b9d004c6Schristos * -# set_res_ctx, the first argument to set_res_f (the second is the result lname string) 81b9d004c6Schristos * 82b9d004c6Schristos * @ingroup krb5_support 83b9d004c6Schristos */ 84b9d004c6Schristos typedef struct krb5plugin_an2ln_ftable_desc { 85b9d004c6Schristos int minor_version; 86b9d004c6Schristos krb5_error_code (KRB5_LIB_CALL *init)(krb5_context, void **); 87b9d004c6Schristos void (KRB5_LIB_CALL *fini)(void *); 88b9d004c6Schristos krb5_error_code (KRB5_LIB_CALL *an2ln)(void *, krb5_context, const char *, 89b9d004c6Schristos krb5_const_principal, set_result_f, void *); 90b9d004c6Schristos } krb5plugin_an2ln_ftable; 91b9d004c6Schristos 92b9d004c6Schristos #endif /* HEIMDAL_KRB5_AN2LN_PLUGIN_H */ 93b9d004c6Schristos 94