jpayne@69
|
1 /* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
jpayne@69
|
2 /*
|
jpayne@69
|
3 * Copyright (C) 2013 by the Massachusetts Institute of Technology.
|
jpayne@69
|
4 * All rights reserved.
|
jpayne@69
|
5 *
|
jpayne@69
|
6 * Redistribution and use in source and binary forms, with or without
|
jpayne@69
|
7 * modification, are permitted provided that the following conditions
|
jpayne@69
|
8 * are met:
|
jpayne@69
|
9 *
|
jpayne@69
|
10 * * Redistributions of source code must retain the above copyright
|
jpayne@69
|
11 * notice, this list of conditions and the following disclaimer.
|
jpayne@69
|
12 *
|
jpayne@69
|
13 * * Redistributions in binary form must reproduce the above copyright
|
jpayne@69
|
14 * notice, this list of conditions and the following disclaimer in
|
jpayne@69
|
15 * the documentation and/or other materials provided with the
|
jpayne@69
|
16 * distribution.
|
jpayne@69
|
17 *
|
jpayne@69
|
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
jpayne@69
|
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
jpayne@69
|
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
jpayne@69
|
21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
jpayne@69
|
22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
jpayne@69
|
23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
jpayne@69
|
24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
jpayne@69
|
25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
jpayne@69
|
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
|
jpayne@69
|
27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
jpayne@69
|
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
|
jpayne@69
|
29 * OF THE POSSIBILITY OF SUCH DAMAGE.
|
jpayne@69
|
30 */
|
jpayne@69
|
31
|
jpayne@69
|
32 /*
|
jpayne@69
|
33 * Declarations for hostrealm plugin module implementors.
|
jpayne@69
|
34 *
|
jpayne@69
|
35 * The hostrealm pluggable interface currently has only one supported major
|
jpayne@69
|
36 * version, which is 1. Major version 1 has a current minor version number of
|
jpayne@69
|
37 * 1.
|
jpayne@69
|
38 *
|
jpayne@69
|
39 * Hostrealm plugin modules should define a function named
|
jpayne@69
|
40 * hostrealm_<modulename>_initvt, matching the signature:
|
jpayne@69
|
41 *
|
jpayne@69
|
42 * krb5_error_code
|
jpayne@69
|
43 * hostrealm_modname_initvt(krb5_context context, int maj_ver, int min_ver,
|
jpayne@69
|
44 * krb5_plugin_vtable vtable);
|
jpayne@69
|
45 *
|
jpayne@69
|
46 * The initvt function should:
|
jpayne@69
|
47 *
|
jpayne@69
|
48 * - Check that the supplied maj_ver number is supported by the module, or
|
jpayne@69
|
49 * return KRB5_PLUGIN_VER_NOTSUPP if it is not.
|
jpayne@69
|
50 *
|
jpayne@69
|
51 * - Cast the vtable pointer as appropriate for maj_ver:
|
jpayne@69
|
52 * maj_ver == 1: Cast to krb5_hostrealm_vtable
|
jpayne@69
|
53 *
|
jpayne@69
|
54 * - Initialize the methods of the vtable, stopping as appropriate for the
|
jpayne@69
|
55 * supplied min_ver. Optional methods may be left uninitialized.
|
jpayne@69
|
56 *
|
jpayne@69
|
57 * Memory for the vtable is allocated by the caller, not by the module.
|
jpayne@69
|
58 */
|
jpayne@69
|
59
|
jpayne@69
|
60 #ifndef KRB5_HOSTREALM_PLUGIN_H
|
jpayne@69
|
61 #define KRB5_HOSTREALM_PLUGIN_H
|
jpayne@69
|
62
|
jpayne@69
|
63 #include <krb5/krb5.h>
|
jpayne@69
|
64 #include <krb5/plugin.h>
|
jpayne@69
|
65
|
jpayne@69
|
66 /* An abstract type for hostrealm module data. */
|
jpayne@69
|
67 typedef struct krb5_hostrealm_moddata_st *krb5_hostrealm_moddata;
|
jpayne@69
|
68
|
jpayne@69
|
69 /*** Method type declarations ***/
|
jpayne@69
|
70
|
jpayne@69
|
71 /* Optional: Initialize module data. */
|
jpayne@69
|
72 typedef krb5_error_code
|
jpayne@69
|
73 (*krb5_hostrealm_init_fn)(krb5_context context,
|
jpayne@69
|
74 krb5_hostrealm_moddata *data);
|
jpayne@69
|
75
|
jpayne@69
|
76 /*
|
jpayne@69
|
77 * Optional: Determine the possible realms of a hostname, using only secure,
|
jpayne@69
|
78 * authoritative mechanisms (ones which should be used prior to trying
|
jpayne@69
|
79 * referrals when getting a service ticket). Return success with a
|
jpayne@69
|
80 * null-terminated list of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to
|
jpayne@69
|
81 * defer to later modules, or another error to terminate processing.
|
jpayne@69
|
82 */
|
jpayne@69
|
83 typedef krb5_error_code
|
jpayne@69
|
84 (*krb5_hostrealm_host_realm_fn)(krb5_context context,
|
jpayne@69
|
85 krb5_hostrealm_moddata data,
|
jpayne@69
|
86 const char *host, char ***realms_out);
|
jpayne@69
|
87
|
jpayne@69
|
88 /*
|
jpayne@69
|
89 * Optional: Determine the possible realms of a hostname, using heuristic or
|
jpayne@69
|
90 * less secure mechanisms (ones which should be used after trying referrals
|
jpayne@69
|
91 * when getting a service ticket). Return success with a null-terminated list
|
jpayne@69
|
92 * of realms in *realms_out, KRB5_PLUGIN_NO_HANDLE to defer to later modules,
|
jpayne@69
|
93 * or another error to terminate processing.
|
jpayne@69
|
94 */
|
jpayne@69
|
95 typedef krb5_error_code
|
jpayne@69
|
96 (*krb5_hostrealm_fallback_realm_fn)(krb5_context context,
|
jpayne@69
|
97 krb5_hostrealm_moddata data,
|
jpayne@69
|
98 const char *host, char ***realms_out);
|
jpayne@69
|
99
|
jpayne@69
|
100 /*
|
jpayne@69
|
101 * Optional: Determine the possible default realms of the local host. Return
|
jpayne@69
|
102 * success with a null-terminated list of realms in *realms_out,
|
jpayne@69
|
103 * KRB5_PLUGIN_NO_HANDLE to defer to later modules, or another error to
|
jpayne@69
|
104 * terminate processing.
|
jpayne@69
|
105 */
|
jpayne@69
|
106 typedef krb5_error_code
|
jpayne@69
|
107 (*krb5_hostrealm_default_realm_fn)(krb5_context context,
|
jpayne@69
|
108 krb5_hostrealm_moddata data,
|
jpayne@69
|
109 char ***realms_out);
|
jpayne@69
|
110
|
jpayne@69
|
111 /*
|
jpayne@69
|
112 * Mandatory (if any of the query methods are implemented): Release the memory
|
jpayne@69
|
113 * returned by one of the interface methods.
|
jpayne@69
|
114 */
|
jpayne@69
|
115 typedef void
|
jpayne@69
|
116 (*krb5_hostrealm_free_list_fn)(krb5_context context,
|
jpayne@69
|
117 krb5_hostrealm_moddata data, char **list);
|
jpayne@69
|
118
|
jpayne@69
|
119 /* Optional: Release resources used by module data. */
|
jpayne@69
|
120 typedef void
|
jpayne@69
|
121 (*krb5_hostrealm_fini_fn)(krb5_context context, krb5_hostrealm_moddata data);
|
jpayne@69
|
122
|
jpayne@69
|
123 /* hostrealm vtable for major version 1. */
|
jpayne@69
|
124 typedef struct krb5_hostrealm_vtable_st {
|
jpayne@69
|
125 const char *name; /* Mandatory: name of module. */
|
jpayne@69
|
126 krb5_hostrealm_init_fn init;
|
jpayne@69
|
127 krb5_hostrealm_fini_fn fini;
|
jpayne@69
|
128 krb5_hostrealm_host_realm_fn host_realm;
|
jpayne@69
|
129 krb5_hostrealm_fallback_realm_fn fallback_realm;
|
jpayne@69
|
130 krb5_hostrealm_default_realm_fn default_realm;
|
jpayne@69
|
131 krb5_hostrealm_free_list_fn free_list;
|
jpayne@69
|
132 /* Minor version 1 ends here. */
|
jpayne@69
|
133 } *krb5_hostrealm_vtable;
|
jpayne@69
|
134
|
jpayne@69
|
135 #endif /* KRB5_HOSTREALM_PLUGIN_H */
|