13 HINSTANCE hKrb524 = 0;
14 HINSTANCE hSecur32 = 0;
15 HINSTANCE hComErr = 0;
16 HINSTANCE hService = 0;
17 HINSTANCE hProfile = 0;
19 HINSTANCE hToolHelp32 = 0;
22 DWORD AfsAvailable = 0;
26 DECL_FUNC_PTR(get_krb_err_txt_entry);
27 DECL_FUNC_PTR(k_isinst);
28 DECL_FUNC_PTR(k_isname);
29 DECL_FUNC_PTR(k_isrealm);
30 DECL_FUNC_PTR(kadm_change_your_password);
31 DECL_FUNC_PTR(kname_parse);
32 DECL_FUNC_PTR(krb_get_cred);
33 DECL_FUNC_PTR(krb_get_krbhst);
34 DECL_FUNC_PTR(krb_get_lrealm);
35 DECL_FUNC_PTR(krb_get_pw_in_tkt);
36 DECL_FUNC_PTR(krb_get_tf_realm);
37 DECL_FUNC_PTR(krb_mk_req);
38 DECL_FUNC_PTR(krb_realmofhost);
39 DECL_FUNC_PTR(tf_init);
40 DECL_FUNC_PTR(tf_close);
41 DECL_FUNC_PTR(tf_get_cred);
42 DECL_FUNC_PTR(tf_get_pname);
43 DECL_FUNC_PTR(tf_get_pinst);
44 DECL_FUNC_PTR(LocalHostAddr);
45 DECL_FUNC_PTR(tkt_string);
46 DECL_FUNC_PTR(krb_set_tkt_string);
47 DECL_FUNC_PTR(initialize_krb_error_func);
48 DECL_FUNC_PTR(initialize_kadm_error_table);
49 DECL_FUNC_PTR(dest_tkt);
50 DECL_FUNC_PTR(lsh_LoadKrb4LeashErrorTables); // XXX
51 DECL_FUNC_PTR(krb_in_tkt);
52 DECL_FUNC_PTR(krb_save_credentials);
53 DECL_FUNC_PTR(krb_get_krbconf2);
54 DECL_FUNC_PTR(krb_get_krbrealm2);
55 DECL_FUNC_PTR(krb_life_to_time);
59 DECL_FUNC_PTR(krb5_change_password);
60 DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
61 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
62 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
63 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_forwardable);
64 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
65 DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
66 DECL_FUNC_PTR(krb5_get_init_creds_password);
67 DECL_FUNC_PTR(krb5_build_principal_ext);
68 DECL_FUNC_PTR(krb5_cc_resolve);
69 DECL_FUNC_PTR(krb5_cc_default);
70 DECL_FUNC_PTR(krb5_cc_default_name);
71 DECL_FUNC_PTR(krb5_cc_set_default_name);
72 DECL_FUNC_PTR(krb5_cc_initialize);
73 DECL_FUNC_PTR(krb5_cc_destroy);
74 DECL_FUNC_PTR(krb5_cc_close);
75 DECL_FUNC_PTR(krb5_cc_store_cred);
76 DECL_FUNC_PTR(krb5_cc_copy_creds);
77 // DECL_FUNC_PTR(krb5_cc_retrieve_cred);
78 DECL_FUNC_PTR(krb5_cc_get_principal);
79 DECL_FUNC_PTR(krb5_cc_start_seq_get);
80 DECL_FUNC_PTR(krb5_cc_next_cred);
81 DECL_FUNC_PTR(krb5_cc_end_seq_get);
82 // DECL_FUNC_PTR(krb5_cc_remove_cred);
83 DECL_FUNC_PTR(krb5_cc_set_flags);
84 // DECL_FUNC_PTR(krb5_cc_get_type);
85 DECL_FUNC_PTR(krb5_free_context);
86 DECL_FUNC_PTR(krb5_free_cred_contents);
87 DECL_FUNC_PTR(krb5_free_principal);
88 DECL_FUNC_PTR(krb5_get_in_tkt_with_password);
89 DECL_FUNC_PTR(krb5_init_context);
90 DECL_FUNC_PTR(krb5_parse_name);
91 DECL_FUNC_PTR(krb5_timeofday);
92 DECL_FUNC_PTR(krb5_timestamp_to_sfstring);
93 DECL_FUNC_PTR(krb5_unparse_name);
94 DECL_FUNC_PTR(krb5_get_credentials);
95 DECL_FUNC_PTR(krb5_mk_req);
96 DECL_FUNC_PTR(krb5_sname_to_principal);
97 DECL_FUNC_PTR(krb5_get_credentials_renew);
98 DECL_FUNC_PTR(krb5_free_data);
99 DECL_FUNC_PTR(krb5_free_data_contents);
100 // DECL_FUNC_PTR(krb5_get_realm_domain);
101 DECL_FUNC_PTR(krb5_free_unparsed_name);
102 DECL_FUNC_PTR(krb5_os_localaddr);
103 DECL_FUNC_PTR(krb5_copy_keyblock_contents);
104 DECL_FUNC_PTR(krb5_copy_data);
105 DECL_FUNC_PTR(krb5_free_creds);
106 DECL_FUNC_PTR(krb5_build_principal);
107 DECL_FUNC_PTR(krb5_get_renewed_creds);
108 DECL_FUNC_PTR(krb5_get_default_config_files);
109 DECL_FUNC_PTR(krb5_free_config_files);
110 DECL_FUNC_PTR(krb5_get_default_realm);
111 DECL_FUNC_PTR(krb5_free_ticket);
112 DECL_FUNC_PTR(krb5_decode_ticket);
113 DECL_FUNC_PTR(krb5_get_host_realm);
114 DECL_FUNC_PTR(krb5_free_host_realm);
115 DECL_FUNC_PTR(krb5_c_random_make_octets);
116 DECL_FUNC_PTR(krb5_free_addresses);
117 DECL_FUNC_PTR(krb5_free_default_realm);
118 DECL_FUNC_PTR(krb5_principal_compare);
119 DECL_FUNC_PTR(krb5_string_to_deltat);
123 DECL_FUNC_PTR(krb524_init_ets);
124 DECL_FUNC_PTR(krb524_convert_creds_kdc);
128 DECL_FUNC_PTR(com_err);
129 DECL_FUNC_PTR(error_message);
132 DECL_FUNC_PTR(profile_init);
133 DECL_FUNC_PTR(profile_release);
134 DECL_FUNC_PTR(profile_get_subsection_names);
135 DECL_FUNC_PTR(profile_free_list);
136 DECL_FUNC_PTR(profile_get_string);
137 DECL_FUNC_PTR(profile_release_string);
138 DECL_FUNC_PTR(profile_get_integer);
141 DECL_FUNC_PTR(OpenSCManagerA);
142 DECL_FUNC_PTR(OpenServiceA);
143 DECL_FUNC_PTR(QueryServiceStatus);
144 DECL_FUNC_PTR(CloseServiceHandle);
145 DECL_FUNC_PTR(LsaNtStatusToWinError);
148 DECL_FUNC_PTR(LsaConnectUntrusted);
149 DECL_FUNC_PTR(LsaLookupAuthenticationPackage);
150 DECL_FUNC_PTR(LsaCallAuthenticationPackage);
151 DECL_FUNC_PTR(LsaFreeReturnBuffer);
152 DECL_FUNC_PTR(LsaGetLogonSessionData);
155 DECL_FUNC_PTR(cc_initialize);
156 DECL_FUNC_PTR(cc_shutdown);
157 DECL_FUNC_PTR(cc_get_NC_info);
158 DECL_FUNC_PTR(cc_free_NC_info);
161 FUNC_INFO k4_fi[] = {
162 MAKE_FUNC_INFO(get_krb_err_txt_entry),
163 MAKE_FUNC_INFO(k_isinst),
164 MAKE_FUNC_INFO(k_isname),
165 MAKE_FUNC_INFO(k_isrealm),
166 MAKE_FUNC_INFO(kadm_change_your_password),
167 MAKE_FUNC_INFO(kname_parse),
168 MAKE_FUNC_INFO(krb_get_cred),
169 MAKE_FUNC_INFO(krb_get_krbhst),
170 MAKE_FUNC_INFO(krb_get_lrealm),
171 MAKE_FUNC_INFO(krb_get_pw_in_tkt),
172 MAKE_FUNC_INFO(krb_get_tf_realm),
173 MAKE_FUNC_INFO(krb_mk_req),
174 MAKE_FUNC_INFO(krb_realmofhost),
175 MAKE_FUNC_INFO(tf_init),
176 MAKE_FUNC_INFO(tf_close),
177 MAKE_FUNC_INFO(tf_get_cred),
178 MAKE_FUNC_INFO(tf_get_pname),
179 MAKE_FUNC_INFO(tf_get_pinst),
180 MAKE_FUNC_INFO(LocalHostAddr),
181 MAKE_FUNC_INFO(tkt_string),
182 MAKE_FUNC_INFO(krb_set_tkt_string),
183 MAKE_FUNC_INFO(initialize_krb_error_func),
184 MAKE_FUNC_INFO(initialize_kadm_error_table),
185 MAKE_FUNC_INFO(dest_tkt),
186 MAKE_FUNC_INFO(lsh_LoadKrb4LeashErrorTables), // XXX
187 MAKE_FUNC_INFO(krb_in_tkt),
188 MAKE_FUNC_INFO(krb_save_credentials),
189 MAKE_FUNC_INFO(krb_get_krbconf2),
190 MAKE_FUNC_INFO(krb_get_krbrealm2),
191 MAKE_FUNC_INFO(krb_life_to_time),
196 FUNC_INFO k5_fi[] = {
197 MAKE_FUNC_INFO(krb5_change_password),
198 MAKE_FUNC_INFO(krb5_get_init_creds_opt_init),
199 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_tkt_life),
200 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_renew_life),
201 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_forwardable),
202 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_proxiable),
203 MAKE_FUNC_INFO(krb5_get_init_creds_opt_set_address_list),
204 MAKE_FUNC_INFO(krb5_get_init_creds_password),
205 MAKE_FUNC_INFO(krb5_build_principal_ext),
206 MAKE_FUNC_INFO(krb5_cc_resolve),
207 MAKE_FUNC_INFO(krb5_cc_default),
208 MAKE_FUNC_INFO(krb5_cc_default_name),
209 MAKE_FUNC_INFO(krb5_cc_set_default_name),
210 MAKE_FUNC_INFO(krb5_cc_initialize),
211 MAKE_FUNC_INFO(krb5_cc_destroy),
212 MAKE_FUNC_INFO(krb5_cc_close),
213 MAKE_FUNC_INFO(krb5_cc_copy_creds),
214 MAKE_FUNC_INFO(krb5_cc_store_cred),
215 // MAKE_FUNC_INFO(krb5_cc_retrieve_cred),
216 MAKE_FUNC_INFO(krb5_cc_get_principal),
217 MAKE_FUNC_INFO(krb5_cc_start_seq_get),
218 MAKE_FUNC_INFO(krb5_cc_next_cred),
219 MAKE_FUNC_INFO(krb5_cc_end_seq_get),
220 // MAKE_FUNC_INFO(krb5_cc_remove_cred),
221 MAKE_FUNC_INFO(krb5_cc_set_flags),
222 // MAKE_FUNC_INFO(krb5_cc_get_type),
223 MAKE_FUNC_INFO(krb5_free_context),
224 MAKE_FUNC_INFO(krb5_free_cred_contents),
225 MAKE_FUNC_INFO(krb5_free_principal),
226 MAKE_FUNC_INFO(krb5_get_in_tkt_with_password),
227 MAKE_FUNC_INFO(krb5_init_context),
228 MAKE_FUNC_INFO(krb5_parse_name),
229 MAKE_FUNC_INFO(krb5_timeofday),
230 MAKE_FUNC_INFO(krb5_timestamp_to_sfstring),
231 MAKE_FUNC_INFO(krb5_unparse_name),
232 MAKE_FUNC_INFO(krb5_get_credentials),
233 MAKE_FUNC_INFO(krb5_mk_req),
234 MAKE_FUNC_INFO(krb5_sname_to_principal),
235 MAKE_FUNC_INFO(krb5_get_credentials_renew),
236 MAKE_FUNC_INFO(krb5_free_data),
237 MAKE_FUNC_INFO(krb5_free_data_contents),
238 // MAKE_FUNC_INFO(krb5_get_realm_domain),
239 MAKE_FUNC_INFO(krb5_free_unparsed_name),
240 MAKE_FUNC_INFO(krb5_os_localaddr),
241 MAKE_FUNC_INFO(krb5_copy_keyblock_contents),
242 MAKE_FUNC_INFO(krb5_copy_data),
243 MAKE_FUNC_INFO(krb5_free_creds),
244 MAKE_FUNC_INFO(krb5_build_principal),
245 MAKE_FUNC_INFO(krb5_get_renewed_creds),
246 MAKE_FUNC_INFO(krb5_free_addresses),
247 MAKE_FUNC_INFO(krb5_get_default_config_files),
248 MAKE_FUNC_INFO(krb5_free_config_files),
249 MAKE_FUNC_INFO(krb5_get_default_realm),
250 MAKE_FUNC_INFO(krb5_free_ticket),
251 MAKE_FUNC_INFO(krb5_decode_ticket),
252 MAKE_FUNC_INFO(krb5_get_host_realm),
253 MAKE_FUNC_INFO(krb5_free_host_realm),
254 MAKE_FUNC_INFO(krb5_c_random_make_octets),
255 MAKE_FUNC_INFO(krb5_free_default_realm),
256 MAKE_FUNC_INFO(krb5_principal_compare),
257 MAKE_FUNC_INFO(krb5_string_to_deltat),
262 FUNC_INFO k524_fi[] = {
263 MAKE_FUNC_INFO(krb524_init_ets),
264 MAKE_FUNC_INFO(krb524_convert_creds_kdc),
269 FUNC_INFO profile_fi[] = {
270 MAKE_FUNC_INFO(profile_init),
271 MAKE_FUNC_INFO(profile_release),
272 MAKE_FUNC_INFO(profile_get_subsection_names),
273 MAKE_FUNC_INFO(profile_free_list),
274 MAKE_FUNC_INFO(profile_get_string),
275 MAKE_FUNC_INFO(profile_release_string),
276 MAKE_FUNC_INFO(profile_get_integer),
280 FUNC_INFO ce_fi[] = {
281 MAKE_FUNC_INFO(com_err),
282 MAKE_FUNC_INFO(error_message),
286 FUNC_INFO service_fi[] = {
287 MAKE_FUNC_INFO(OpenSCManagerA),
288 MAKE_FUNC_INFO(OpenServiceA),
289 MAKE_FUNC_INFO(QueryServiceStatus),
290 MAKE_FUNC_INFO(CloseServiceHandle),
291 MAKE_FUNC_INFO(LsaNtStatusToWinError),
295 FUNC_INFO lsa_fi[] = {
296 MAKE_FUNC_INFO(LsaConnectUntrusted),
297 MAKE_FUNC_INFO(LsaLookupAuthenticationPackage),
298 MAKE_FUNC_INFO(LsaCallAuthenticationPackage),
299 MAKE_FUNC_INFO(LsaFreeReturnBuffer),
300 MAKE_FUNC_INFO(LsaGetLogonSessionData),
305 FUNC_INFO ccapi_fi[] = {
306 MAKE_FUNC_INFO(cc_initialize),
307 MAKE_FUNC_INFO(cc_shutdown),
308 MAKE_FUNC_INFO(cc_get_NC_info),
309 MAKE_FUNC_INFO(cc_free_NC_info),
314 DECL_FUNC_PTR(GetModuleFileNameExA);
315 DECL_FUNC_PTR(EnumProcessModules);
317 FUNC_INFO psapi_fi[] = {
318 MAKE_FUNC_INFO(GetModuleFileNameExA),
319 MAKE_FUNC_INFO(EnumProcessModules),
323 // toolhelp functions
324 DECL_FUNC_PTR(CreateToolhelp32Snapshot);
325 DECL_FUNC_PTR(Module32First);
326 DECL_FUNC_PTR(Module32Next);
328 FUNC_INFO toolhelp_fi[] = {
329 MAKE_FUNC_INFO(CreateToolhelp32Snapshot),
330 MAKE_FUNC_INFO(Module32First),
331 MAKE_FUNC_INFO(Module32Next),
342 hLeashInst = hinstDLL;
346 case DLL_PROCESS_ATTACH:
350 LoadFuncs(KRB4_DLL, k4_fi, &hKrb4, 0, 1, 0, 0);
352 LoadFuncs(KRB5_DLL, k5_fi, &hKrb5, 0, 1, 0, 0);
353 LoadFuncs(COMERR_DLL, ce_fi, &hComErr, 0, 0, 1, 0);
354 LoadFuncs(SERVICE_DLL, service_fi, &hService, 0, 1, 0, 0);
355 LoadFuncs(SECUR32_DLL, lsa_fi, &hSecur32, 0, 1, 1, 1);
357 LoadFuncs(KRB524_DLL, k524_fi, &hKrb524, 0, 1, 1, 1);
359 LoadFuncs(PROFILE_DLL, profile_fi, &hProfile, 0, 1, 0, 0);
360 LoadFuncs(CCAPI_DLL, ccapi_fi, &hCcapi, 0, 1, 0, 0);
362 memset(&osvi, 0, sizeof(OSVERSIONINFO));
363 osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
366 // XXX: We should really use feature testing, first
367 // checking for CreateToolhelp32Snapshot. If that's
368 // not around, we try the psapi stuff.
370 // Only load LSA functions if on NT/2000/XP
371 if(osvi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)
374 LoadFuncs(TOOLHELPDLL, toolhelp_fi, &hToolHelp32, 0, 1, 0, 0);
377 else if(osvi.dwPlatformId == VER_PLATFORM_WIN32_NT)
380 LoadFuncs(PSAPIDLL, psapi_fi, &hPsapi, 0, 1, 0, 0);
386 * Register window class for the MITPasswordControl that
387 * replaces normal edit controls for password input.
388 * zero any fields we don't explicitly set
390 hLeashInst = hinstDLL;
392 if (plsh_LoadKrb4LeashErrorTables)
393 plsh_LoadKrb4LeashErrorTables(hLeashInst, 0);
396 Register_MITPasswordEditControl(hLeashInst);
401 GetAfsStatus(&AfsStatus);
403 AfsAvailable = afscompat_init();
405 if ( AfsStatus && !AfsAvailable )
411 case DLL_PROCESS_DETACH:
424 FreeLibrary(hProfile);
426 FreeLibrary(hComErr);
428 FreeLibrary(hService);
430 FreeLibrary(hSecur32);
433 FreeLibrary(hKrb524);
438 FreeLibrary(hToolHelp32);