d52582856428d257b6f59ab4dcef6ea0977df7ad
[platform/upstream/curl.git] / lib / curl_sspi.h
1 #ifndef HEADER_CURL_SSPI_H
2 #define HEADER_CURL_SSPI_H
3 /***************************************************************************
4  *                                  _   _ ____  _
5  *  Project                     ___| | | |  _ \| |
6  *                             / __| | | | |_) | |
7  *                            | (__| |_| |  _ <| |___
8  *                             \___|\___/|_| \_\_____|
9  *
10  * Copyright (C) 1998 - 2012, Daniel Stenberg, <daniel@haxx.se>, et al.
11  *
12  * This software is licensed as described in the file COPYING, which
13  * you should have received as part of this distribution. The terms
14  * are also available at http://curl.haxx.se/docs/copyright.html.
15  *
16  * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17  * copies of the Software, and permit persons to whom the Software is
18  * furnished to do so, under the terms of the COPYING file.
19  *
20  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21  * KIND, either express or implied.
22  *
23  ***************************************************************************/
24
25 #include "curl_setup.h"
26
27 #ifdef USE_WINDOWS_SSPI
28
29 #include <curl/curl.h>
30
31 /*
32  * When including the following three headers, it is mandatory to define either
33  * SECURITY_WIN32 or SECURITY_KERNEL, indicating who is compiling the code.
34  */
35
36 #undef SECURITY_WIN32
37 #undef SECURITY_KERNEL
38 #define SECURITY_WIN32 1
39 #include <security.h>
40 #include <sspi.h>
41 #include <rpc.h>
42
43 CURLcode Curl_sspi_global_init(void);
44 void Curl_sspi_global_cleanup(void);
45
46 /* Forward-declaration of global variables defined in curl_sspi.c */
47
48 extern HMODULE s_hSecDll;
49 extern PSecurityFunctionTable s_pSecFn;
50
51 /* Provide some definitions missing in old headers */
52
53 #ifndef SEC_E_INSUFFICIENT_MEMORY
54 # define SEC_E_INSUFFICIENT_MEMORY             ((HRESULT)0x80090300L)
55 #endif
56 #ifndef SEC_E_INVALID_HANDLE
57 # define SEC_E_INVALID_HANDLE                  ((HRESULT)0x80090301L)
58 #endif
59 #ifndef SEC_E_UNSUPPORTED_FUNCTION
60 # define SEC_E_UNSUPPORTED_FUNCTION            ((HRESULT)0x80090302L)
61 #endif
62 #ifndef SEC_E_TARGET_UNKNOWN
63 # define SEC_E_TARGET_UNKNOWN                  ((HRESULT)0x80090303L)
64 #endif
65 #ifndef SEC_E_INTERNAL_ERROR
66 # define SEC_E_INTERNAL_ERROR                  ((HRESULT)0x80090304L)
67 #endif
68 #ifndef SEC_E_SECPKG_NOT_FOUND
69 # define SEC_E_SECPKG_NOT_FOUND                ((HRESULT)0x80090305L)
70 #endif
71 #ifndef SEC_E_NOT_OWNER
72 # define SEC_E_NOT_OWNER                       ((HRESULT)0x80090306L)
73 #endif
74 #ifndef SEC_E_CANNOT_INSTALL
75 # define SEC_E_CANNOT_INSTALL                  ((HRESULT)0x80090307L)
76 #endif
77 #ifndef SEC_E_INVALID_TOKEN
78 # define SEC_E_INVALID_TOKEN                   ((HRESULT)0x80090308L)
79 #endif
80 #ifndef SEC_E_CANNOT_PACK
81 # define SEC_E_CANNOT_PACK                     ((HRESULT)0x80090309L)
82 #endif
83 #ifndef SEC_E_QOP_NOT_SUPPORTED
84 # define SEC_E_QOP_NOT_SUPPORTED               ((HRESULT)0x8009030AL)
85 #endif
86 #ifndef SEC_E_NO_IMPERSONATION
87 # define SEC_E_NO_IMPERSONATION                ((HRESULT)0x8009030BL)
88 #endif
89 #ifndef SEC_E_LOGON_DENIED
90 # define SEC_E_LOGON_DENIED                    ((HRESULT)0x8009030CL)
91 #endif
92 #ifndef SEC_E_UNKNOWN_CREDENTIALS
93 # define SEC_E_UNKNOWN_CREDENTIALS             ((HRESULT)0x8009030DL)
94 #endif
95 #ifndef SEC_E_NO_CREDENTIALS
96 # define SEC_E_NO_CREDENTIALS                  ((HRESULT)0x8009030EL)
97 #endif
98 #ifndef SEC_E_MESSAGE_ALTERED
99 # define SEC_E_MESSAGE_ALTERED                 ((HRESULT)0x8009030FL)
100 #endif
101 #ifndef SEC_E_OUT_OF_SEQUENCE
102 # define SEC_E_OUT_OF_SEQUENCE                 ((HRESULT)0x80090310L)
103 #endif
104 #ifndef SEC_E_NO_AUTHENTICATING_AUTHORITY
105 # define SEC_E_NO_AUTHENTICATING_AUTHORITY     ((HRESULT)0x80090311L)
106 #endif
107 #ifndef SEC_E_BAD_PKGID
108 # define SEC_E_BAD_PKGID                       ((HRESULT)0x80090316L)
109 #endif
110 #ifndef SEC_E_CONTEXT_EXPIRED
111 # define SEC_E_CONTEXT_EXPIRED                 ((HRESULT)0x80090317L)
112 #endif
113 #ifndef SEC_E_INCOMPLETE_MESSAGE
114 # define SEC_E_INCOMPLETE_MESSAGE              ((HRESULT)0x80090318L)
115 #endif
116 #ifndef SEC_E_INCOMPLETE_CREDENTIALS
117 # define SEC_E_INCOMPLETE_CREDENTIALS          ((HRESULT)0x80090320L)
118 #endif
119 #ifndef SEC_E_BUFFER_TOO_SMALL
120 # define SEC_E_BUFFER_TOO_SMALL                ((HRESULT)0x80090321L)
121 #endif
122 #ifndef SEC_E_WRONG_PRINCIPAL
123 # define SEC_E_WRONG_PRINCIPAL                 ((HRESULT)0x80090322L)
124 #endif
125 #ifndef SEC_E_TIME_SKEW
126 # define SEC_E_TIME_SKEW                       ((HRESULT)0x80090324L)
127 #endif
128 #ifndef SEC_E_UNTRUSTED_ROOT
129 # define SEC_E_UNTRUSTED_ROOT                  ((HRESULT)0x80090325L)
130 #endif
131 #ifndef SEC_E_ILLEGAL_MESSAGE
132 # define SEC_E_ILLEGAL_MESSAGE                 ((HRESULT)0x80090326L)
133 #endif
134 #ifndef SEC_E_CERT_UNKNOWN
135 # define SEC_E_CERT_UNKNOWN                    ((HRESULT)0x80090327L)
136 #endif
137 #ifndef SEC_E_CERT_EXPIRED
138 # define SEC_E_CERT_EXPIRED                    ((HRESULT)0x80090328L)
139 #endif
140 #ifndef SEC_E_ENCRYPT_FAILURE
141 # define SEC_E_ENCRYPT_FAILURE                 ((HRESULT)0x80090329L)
142 #endif
143 #ifndef SEC_E_DECRYPT_FAILURE
144 # define SEC_E_DECRYPT_FAILURE                 ((HRESULT)0x80090330L)
145 #endif
146 #ifndef SEC_E_ALGORITHM_MISMATCH
147 # define SEC_E_ALGORITHM_MISMATCH              ((HRESULT)0x80090331L)
148 #endif
149 #ifndef SEC_E_SECURITY_QOS_FAILED
150 # define SEC_E_SECURITY_QOS_FAILED             ((HRESULT)0x80090332L)
151 #endif
152 #ifndef SEC_E_UNFINISHED_CONTEXT_DELETED
153 # define SEC_E_UNFINISHED_CONTEXT_DELETED      ((HRESULT)0x80090333L)
154 #endif
155 #ifndef SEC_E_NO_TGT_REPLY
156 # define SEC_E_NO_TGT_REPLY                    ((HRESULT)0x80090334L)
157 #endif
158 #ifndef SEC_E_NO_IP_ADDRESSES
159 # define SEC_E_NO_IP_ADDRESSES                 ((HRESULT)0x80090335L)
160 #endif
161 #ifndef SEC_E_WRONG_CREDENTIAL_HANDLE
162 # define SEC_E_WRONG_CREDENTIAL_HANDLE         ((HRESULT)0x80090336L)
163 #endif
164 #ifndef SEC_E_CRYPTO_SYSTEM_INVALID
165 # define SEC_E_CRYPTO_SYSTEM_INVALID           ((HRESULT)0x80090337L)
166 #endif
167 #ifndef SEC_E_MAX_REFERRALS_EXCEEDED
168 # define SEC_E_MAX_REFERRALS_EXCEEDED          ((HRESULT)0x80090338L)
169 #endif
170 #ifndef SEC_E_MUST_BE_KDC
171 # define SEC_E_MUST_BE_KDC                     ((HRESULT)0x80090339L)
172 #endif
173 #ifndef SEC_E_STRONG_CRYPTO_NOT_SUPPORTED
174 # define SEC_E_STRONG_CRYPTO_NOT_SUPPORTED     ((HRESULT)0x8009033AL)
175 #endif
176 #ifndef SEC_E_TOO_MANY_PRINCIPALS
177 # define SEC_E_TOO_MANY_PRINCIPALS             ((HRESULT)0x8009033BL)
178 #endif
179 #ifndef SEC_E_NO_PA_DATA
180 # define SEC_E_NO_PA_DATA                      ((HRESULT)0x8009033CL)
181 #endif
182 #ifndef SEC_E_PKINIT_NAME_MISMATCH
183 # define SEC_E_PKINIT_NAME_MISMATCH            ((HRESULT)0x8009033DL)
184 #endif
185 #ifndef SEC_E_SMARTCARD_LOGON_REQUIRED
186 # define SEC_E_SMARTCARD_LOGON_REQUIRED        ((HRESULT)0x8009033EL)
187 #endif
188 #ifndef SEC_E_SHUTDOWN_IN_PROGRESS
189 # define SEC_E_SHUTDOWN_IN_PROGRESS            ((HRESULT)0x8009033FL)
190 #endif
191 #ifndef SEC_E_KDC_INVALID_REQUEST
192 # define SEC_E_KDC_INVALID_REQUEST             ((HRESULT)0x80090340L)
193 #endif
194 #ifndef SEC_E_KDC_UNABLE_TO_REFER
195 # define SEC_E_KDC_UNABLE_TO_REFER             ((HRESULT)0x80090341L)
196 #endif
197 #ifndef SEC_E_KDC_UNKNOWN_ETYPE
198 # define SEC_E_KDC_UNKNOWN_ETYPE               ((HRESULT)0x80090342L)
199 #endif
200 #ifndef SEC_E_UNSUPPORTED_PREAUTH
201 # define SEC_E_UNSUPPORTED_PREAUTH             ((HRESULT)0x80090343L)
202 #endif
203 #ifndef SEC_E_DELEGATION_REQUIRED
204 # define SEC_E_DELEGATION_REQUIRED             ((HRESULT)0x80090345L)
205 #endif
206 #ifndef SEC_E_BAD_BINDINGS
207 # define SEC_E_BAD_BINDINGS                    ((HRESULT)0x80090346L)
208 #endif
209 #ifndef SEC_E_MULTIPLE_ACCOUNTS
210 # define SEC_E_MULTIPLE_ACCOUNTS               ((HRESULT)0x80090347L)
211 #endif
212 #ifndef SEC_E_NO_KERB_KEY
213 # define SEC_E_NO_KERB_KEY                     ((HRESULT)0x80090348L)
214 #endif
215 #ifndef SEC_E_CERT_WRONG_USAGE
216 # define SEC_E_CERT_WRONG_USAGE                ((HRESULT)0x80090349L)
217 #endif
218 #ifndef SEC_E_DOWNGRADE_DETECTED
219 # define SEC_E_DOWNGRADE_DETECTED              ((HRESULT)0x80090350L)
220 #endif
221 #ifndef SEC_E_SMARTCARD_CERT_REVOKED
222 # define SEC_E_SMARTCARD_CERT_REVOKED          ((HRESULT)0x80090351L)
223 #endif
224 #ifndef SEC_E_ISSUING_CA_UNTRUSTED
225 # define SEC_E_ISSUING_CA_UNTRUSTED            ((HRESULT)0x80090352L)
226 #endif
227 #ifndef SEC_E_REVOCATION_OFFLINE_C
228 # define SEC_E_REVOCATION_OFFLINE_C            ((HRESULT)0x80090353L)
229 #endif
230 #ifndef SEC_E_PKINIT_CLIENT_FAILURE
231 # define SEC_E_PKINIT_CLIENT_FAILURE           ((HRESULT)0x80090354L)
232 #endif
233 #ifndef SEC_E_SMARTCARD_CERT_EXPIRED
234 # define SEC_E_SMARTCARD_CERT_EXPIRED          ((HRESULT)0x80090355L)
235 #endif
236 #ifndef SEC_E_NO_S4U_PROT_SUPPORT
237 # define SEC_E_NO_S4U_PROT_SUPPORT             ((HRESULT)0x80090356L)
238 #endif
239 #ifndef SEC_E_CROSSREALM_DELEGATION_FAILURE
240 # define SEC_E_CROSSREALM_DELEGATION_FAILURE   ((HRESULT)0x80090357L)
241 #endif
242 #ifndef SEC_E_REVOCATION_OFFLINE_KDC
243 # define SEC_E_REVOCATION_OFFLINE_KDC          ((HRESULT)0x80090358L)
244 #endif
245 #ifndef SEC_E_ISSUING_CA_UNTRUSTED_KDC
246 # define SEC_E_ISSUING_CA_UNTRUSTED_KDC        ((HRESULT)0x80090359L)
247 #endif
248 #ifndef SEC_E_KDC_CERT_EXPIRED
249 # define SEC_E_KDC_CERT_EXPIRED                ((HRESULT)0x8009035AL)
250 #endif
251 #ifndef SEC_E_KDC_CERT_REVOKED
252 # define SEC_E_KDC_CERT_REVOKED                ((HRESULT)0x8009035BL)
253 #endif
254 #ifndef SEC_E_INVALID_PARAMETER
255 # define SEC_E_INVALID_PARAMETER               ((HRESULT)0x8009035DL)
256 #endif
257 #ifndef SEC_E_DELEGATION_POLICY
258 # define SEC_E_DELEGATION_POLICY               ((HRESULT)0x8009035EL)
259 #endif
260 #ifndef SEC_E_POLICY_NLTM_ONLY
261 # define SEC_E_POLICY_NLTM_ONLY                ((HRESULT)0x8009035FL)
262 #endif
263
264 #ifndef SEC_I_CONTINUE_NEEDED
265 # define SEC_I_CONTINUE_NEEDED                 ((HRESULT)0x00090312L)
266 #endif
267 #ifndef SEC_I_COMPLETE_NEEDED
268 # define SEC_I_COMPLETE_NEEDED                 ((HRESULT)0x00090313L)
269 #endif
270 #ifndef SEC_I_COMPLETE_AND_CONTINUE
271 # define SEC_I_COMPLETE_AND_CONTINUE           ((HRESULT)0x00090314L)
272 #endif
273 #ifndef SEC_I_LOCAL_LOGON
274 # define SEC_I_LOCAL_LOGON                     ((HRESULT)0x00090315L)
275 #endif
276 #ifndef SEC_I_CONTEXT_EXPIRED
277 # define SEC_I_CONTEXT_EXPIRED                 ((HRESULT)0x00090317L)
278 #endif
279 #ifndef SEC_I_INCOMPLETE_CREDENTIALS
280 # define SEC_I_INCOMPLETE_CREDENTIALS          ((HRESULT)0x00090320L)
281 #endif
282 #ifndef SEC_I_RENEGOTIATE
283 # define SEC_I_RENEGOTIATE                     ((HRESULT)0x00090321L)
284 #endif
285 #ifndef SEC_I_NO_LSA_CONTEXT
286 # define SEC_I_NO_LSA_CONTEXT                  ((HRESULT)0x00090323L)
287 #endif
288 #ifndef SEC_I_SIGNATURE_NEEDED
289 # define SEC_I_SIGNATURE_NEEDED                ((HRESULT)0x0009035CL)
290 #endif
291
292 #endif /* USE_WINDOWS_SSPI */
293 #endif /* HEADER_CURL_SSPI_H */