xref: /freebsd/crypto/krb5/src/windows/leashdll/leashdll.h (revision 7f2fe78b9dd5f51c821d771b63d2e096f6fd49e9)
1 #ifndef _LEASHDLL_H_
2 #define _LEASHDLL_H_
3 
4 #include <com_err.h>
5 #ifdef __cplusplus
6 extern "C" {
7 #endif
8 
9 /* Internal Stuff */
10 
11 #include <windows.h>
12 #define SECURITY_WIN32
13 #include <security.h>
14 
15 /* _WIN32_WINNT must be 0x0501 or greater to pull in definition of
16  * all required LSA data types when the Vista SDK NtSecAPI.h is used.
17  */
18 #ifndef _WIN32_WINNT
19 #define _WIN32_WINNT 0x0501
20 #else
21 #if _WIN32_WINNT < 0x0501
22 #undef _WIN32_WINNT
23 #define _WIN32_WINNT 0x0501
24 #endif
25 #endif
26 #include <ntsecapi.h>
27 
28 #include <krb5.h>
29 
30 extern HINSTANCE hKrb5;
31 extern HINSTANCE hProfile;
32 
33 #define TIMEHOST "TIMEHOST"
34 
35 #define LEASH_DEBUG_CLASS_GENERIC   0
36 
37 #define LEASH_PRIORITY_LOW  0
38 #define LEASH_PRIORITY_HIGH 1
39 
40 ///////////////////////////////////////////////////////////////////////////////
41 
42 #ifdef _WIN64
43 #define LEASH_DLL     "leashw64.dll"
44 #define KRBCC32_DLL   "krbcc64.dll"
45 #else
46 #define LEASH_DLL     "leashw32.dll"
47 #define KRBCC32_DLL   "krbcc32.dll"
48 #endif
49 #define SERVICE_DLL   "advapi32.dll"
50 #define SECUR32_DLL   "secur32.dll"
51 
52 //////////////////////////////////////////////////////////////////////////////
53 
54 #include <loadfuncs-com_err.h>
55 #include <loadfuncs-krb5.h>
56 #include <loadfuncs-profile.h>
57 #include <loadfuncs-lsa.h>
58 
59 #include <errno.h>
60 
61 // service definitions
62 typedef SC_HANDLE (WINAPI *FP_OpenSCManagerA)(char *, char *, DWORD);
63 typedef SC_HANDLE (WINAPI *FP_OpenServiceA)(SC_HANDLE, char *, DWORD);
64 typedef BOOL (WINAPI *FP_QueryServiceStatus)(SC_HANDLE, LPSERVICE_STATUS);
65 typedef BOOL (WINAPI *FP_CloseServiceHandle)(SC_HANDLE);
66 
67 //////////////////////////////////////////////////////////////////////////////
68 
69 // krb5 functions
70 extern DECL_FUNC_PTR(krb5_change_password);
71 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_alloc);
72 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_free);
73 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_init);
74 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_tkt_life);
75 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
76 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_forwardable);
77 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_proxiable);
78 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_renew_life);
79 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_address_list);
80 extern DECL_FUNC_PTR(krb5_get_init_creds_opt_set_out_ccache);
81 extern DECL_FUNC_PTR(krb5_get_init_creds_password);
82 extern DECL_FUNC_PTR(krb5_build_principal_ext);
83 extern DECL_FUNC_PTR(krb5_cc_get_name);
84 extern DECL_FUNC_PTR(krb5_cc_resolve);
85 extern DECL_FUNC_PTR(krb5_cc_default);
86 extern DECL_FUNC_PTR(krb5_cc_default_name);
87 extern DECL_FUNC_PTR(krb5_cc_set_default_name);
88 extern DECL_FUNC_PTR(krb5_cc_initialize);
89 extern DECL_FUNC_PTR(krb5_cc_destroy);
90 extern DECL_FUNC_PTR(krb5_cc_close);
91 extern DECL_FUNC_PTR(krb5_cc_copy_creds);
92 extern DECL_FUNC_PTR(krb5_cc_store_cred);
93 // extern DECL_FUNC_PTR(krb5_cc_retrieve_cred);
94 extern DECL_FUNC_PTR(krb5_cc_get_principal);
95 extern DECL_FUNC_PTR(krb5_cc_start_seq_get);
96 extern DECL_FUNC_PTR(krb5_cc_next_cred);
97 extern DECL_FUNC_PTR(krb5_cc_end_seq_get);
98 // extern DECL_FUNC_PTR(krb5_cc_remove_cred);
99 extern DECL_FUNC_PTR(krb5_cc_set_flags);
100 // extern DECL_FUNC_PTR(krb5_cc_get_type);
101 extern DECL_FUNC_PTR(krb5_cc_get_full_name);
102 extern DECL_FUNC_PTR(krb5_free_context);
103 extern DECL_FUNC_PTR(krb5_free_cred_contents);
104 extern DECL_FUNC_PTR(krb5_free_principal);
105 extern DECL_FUNC_PTR(krb5_free_string);
106 extern DECL_FUNC_PTR(krb5_get_in_tkt_with_password);
107 extern DECL_FUNC_PTR(krb5_init_context);
108 extern DECL_FUNC_PTR(krb5_parse_name);
109 extern DECL_FUNC_PTR(krb5_timeofday);
110 extern DECL_FUNC_PTR(krb5_timestamp_to_sfstring);
111 extern DECL_FUNC_PTR(krb5_unparse_name);
112 extern DECL_FUNC_PTR(krb5_get_credentials);
113 extern DECL_FUNC_PTR(krb5_mk_req);
114 extern DECL_FUNC_PTR(krb5_sname_to_principal);
115 extern DECL_FUNC_PTR(krb5_get_credentials_renew);
116 extern DECL_FUNC_PTR(krb5_free_data);
117 extern DECL_FUNC_PTR(krb5_free_data_contents);
118 // extern DECL_FUNC_PTR(krb5_get_realm_domain);
119 extern DECL_FUNC_PTR(krb5_free_unparsed_name);
120 extern DECL_FUNC_PTR(krb5_os_localaddr);
121 extern DECL_FUNC_PTR(krb5_copy_keyblock_contents);
122 extern DECL_FUNC_PTR(krb5_copy_data);
123 extern DECL_FUNC_PTR(krb5_free_creds);
124 extern DECL_FUNC_PTR(krb5_build_principal);
125 extern DECL_FUNC_PTR(krb5_get_renewed_creds);
126 extern DECL_FUNC_PTR(krb5_free_addresses);
127 extern DECL_FUNC_PTR(krb5_get_default_config_files);
128 extern DECL_FUNC_PTR(krb5_free_config_files);
129 extern DECL_FUNC_PTR(krb5_get_default_realm);
130 extern DECL_FUNC_PTR(krb5_free_ticket);
131 extern DECL_FUNC_PTR(krb5_decode_ticket);
132 extern DECL_FUNC_PTR(krb5_get_host_realm);
133 extern DECL_FUNC_PTR(krb5_free_host_realm);
134 extern DECL_FUNC_PTR(krb5_c_random_make_octets);
135 extern DECL_FUNC_PTR(krb5_free_default_realm);
136 extern DECL_FUNC_PTR(krb5_principal_compare);
137 extern DECL_FUNC_PTR(krb5_string_to_deltat);
138 extern DECL_FUNC_PTR(krb5_is_config_principal);
139 extern DECL_FUNC_PTR(krb5_cccol_cursor_new);
140 extern DECL_FUNC_PTR(krb5_cccol_cursor_next);
141 extern DECL_FUNC_PTR(krb5_cccol_cursor_free);
142 extern DECL_FUNC_PTR(krb5_cc_cache_match);
143 extern DECL_FUNC_PTR(krb5_cc_get_type);
144 extern DECL_FUNC_PTR(krb5_cc_new_unique);
145 extern DECL_FUNC_PTR(krb5_cc_support_switch);
146 extern DECL_FUNC_PTR(krb5_cc_switch);
147 extern DECL_FUNC_PTR(krb5int_cc_user_set_default_name);
148 
149 // ComErr functions
150 extern DECL_FUNC_PTR(com_err);
151 extern DECL_FUNC_PTR(error_message);
152 
153 // Profile functions
154 extern DECL_FUNC_PTR(profile_init);
155 extern DECL_FUNC_PTR(profile_release);
156 extern DECL_FUNC_PTR(profile_get_subsection_names);
157 extern DECL_FUNC_PTR(profile_free_list);
158 extern DECL_FUNC_PTR(profile_get_string);
159 extern DECL_FUNC_PTR(profile_release_string);
160 extern DECL_FUNC_PTR(profile_get_integer);
161 
162 // Service functions
163 
164 extern DECL_FUNC_PTR(OpenSCManagerA);
165 extern DECL_FUNC_PTR(OpenServiceA);
166 extern DECL_FUNC_PTR(QueryServiceStatus);
167 extern DECL_FUNC_PTR(CloseServiceHandle);
168 extern DECL_FUNC_PTR(LsaNtStatusToWinError);
169 
170 // LSA Functions
171 
172 extern DECL_FUNC_PTR(LsaConnectUntrusted);
173 extern DECL_FUNC_PTR(LsaLookupAuthenticationPackage);
174 extern DECL_FUNC_PTR(LsaCallAuthenticationPackage);
175 extern DECL_FUNC_PTR(LsaFreeReturnBuffer);
176 extern DECL_FUNC_PTR(LsaGetLogonSessionData);
177 
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 #endif /* _LEASHDLL_H_ */
183