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