2 * Copyright (c) 2004 Massachusetts Institute of Technology
4 * Permission is hereby granted, free of charge, to any person
5 * obtaining a copy of this software and associated documentation
6 * files (the "Software"), to deal in the Software without
7 * restriction, including without limitation the rights to use, copy,
8 * modify, merge, publish, distribute, sublicense, and/or sell copies
9 * of the Software, and to permit persons to whom the Software is
10 * furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be
13 * included in all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
19 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
20 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27 #ifndef __KHIMAIRA_AFSCRED_H
28 #define __KHIMAIRA_AFSCRED_H
34 #define KHERR_FACILITY L"AfsCred"
35 #define KHERR_HMODULE hResModule
40 #include <afs/cm_config.h>
43 #include <afs/ptserver.h>
44 #include <afs/ptuser.h>
49 #include<afsnewcreds.h>
55 #define AFS_PLUGIN_NAME L"AfsCred"
56 #define AFS_CREDTYPE_NAME L"AfsCred"
58 #define AFS_PLUGIN_DEPS L"Krb5Cred\0"
60 #define KRB5_CREDTYPE_NAME L"Krb5Cred"
61 #define KRB4_CREDTYPE_NAME L"Krb4Cred"
63 #define AFS_TYPENAME_PRINCIPAL L"AFSPrincipal"
64 #define AFS_TYPENAME_METHOD L"AFSTokenMethod"
65 #define AFS_ATTRNAME_CLIENT_PRINC L"AFSClientPrinc"
66 #define AFS_ATTRNAME_SERVER_PRINC L"AFSServerPrinc"
67 #define AFS_ATTRNAME_CELL L"AFSCell"
68 #define AFS_ATTRNAME_METHOD L"AFSMethod"
69 #define AFS_ATTRNAME_REALM L"AFSRealm"
71 #define AFS_VALID_CELL_CHARS L"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.-"
72 #define AFS_VALID_REALM_CHARS AFS_VALID_CELL_CHARS
74 #define AFS_CONFIG_NODE_IDS L"AfsIdentities"
75 #define AFS_CONFIG_NODE_ID L"AfsIdentity"
76 #define AFS_CONFIG_NODE_MAIN L"AfsOptions"
78 #define AFS_HELPFILE L"afsplhlp.chm"
80 /* token acquisition methods provided by extensions begin with this
82 #define AFS_TOKEN_USER 8
86 KHMEXP khm_int32 KHMAPI init_module(kmm_module h_module);
87 KHMEXP khm_int32 KHMAPI exit_module(kmm_module h_module);
90 extern kmm_module h_khModule;
91 extern HMODULE hResModule;
92 extern HINSTANCE hInstance;
94 extern khm_int32 afs_credtype_id;
95 extern khm_int32 krb5_credtype_id;
96 extern khm_int32 krb4_credtype_id;
97 extern khm_int32 afs_msg_type_id;
98 extern khm_handle afs_credset;
100 extern khm_int32 afs_type_principal;
101 extern khm_int32 afs_attr_client_princ;
102 extern khm_int32 afs_attr_server_princ;
103 extern khm_int32 afs_attr_cell;
104 extern khm_int32 afs_attr_method;
105 extern khm_int32 afs_attr_realm;
107 /* Configuration spaces */
108 #define CSNAME_PLUGINS L"Plugins"
109 #define CSNAME_AFSCRED L"AfsCred"
110 #define CSNAME_PARAMS L"Parameters"
112 extern khm_handle csp_plugins;
113 extern khm_handle csp_afscred;
114 extern khm_handle csp_params;
116 extern khm_handle afs_sub;
118 /* defined in afsconfig.c which is generated from afsconfig.csv */
119 extern kconf_schema schema_afsconfig[];
122 /* plugin callback procedure */
124 afs_plugin_cb(khm_int32 msg_type,
125 khm_int32 msg_subtype,
130 afs_cfg_ids_proc(HWND hwnd,
136 afs_cfg_id_proc(HWND hwnd,
142 afs_cfg_main_proc(HWND hwnd,
148 afs_html_help(HWND caller,
154 typedef afs_msg_announce afs_extension;
156 /* not thread safe. only call from the plugin thread */
158 afs_find_extension(const wchar_t * name);
160 /* not thread safe. only call from the plugin thread */
162 afs_get_extension(khm_size i);
164 /* not thread safe. only call from the plugin thread */
166 afs_get_next_token_acq(afs_extension * f);
168 /* not thread safe. only call from the plugin thread */
170 afs_is_valid_method_id(afs_tk_method method);
173 afs_get_next_method_id(afs_tk_method method);
176 afs_get_method_id(wchar_t * name);
179 afs_get_method_name(afs_tk_method method, wchar_t * buf, khm_size cbbuf);
182 afs_get_method_ext(afs_tk_method method);
185 afs_method_describe(afs_tk_method method, khm_int32 flags,
186 wchar_t * wbuf, khm_size cbbuf);
189 afs_ext_resolve_token(const wchar_t * cell,
190 const struct ktc_token * token,
191 const struct ktc_principal * serverp,
192 const struct ktc_principal * clientp,
194 afs_tk_method * pmethod);
197 afs_ext_klog(afs_tk_method method,
199 const char * service,
202 const afs_conf_cell * cell_config,
206 afs_cfg_get_afscreds_shortcut(wchar_t * wpath);