Line | Count | Source |
1 | | /*************************************************************************** |
2 | | * _ _ ____ _ |
3 | | * Project ___| | | | _ \| | |
4 | | * / __| | | | |_) | | |
5 | | * | (__| |_| | _ <| |___ |
6 | | * \___|\___/|_| \_\_____| |
7 | | * |
8 | | * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. |
9 | | * |
10 | | * This software is licensed as described in the file COPYING, which |
11 | | * you should have received as part of this distribution. The terms |
12 | | * are also available at https://curl.se/docs/copyright.html. |
13 | | * |
14 | | * You may opt to use, copy, modify, merge, publish, distribute and/or sell |
15 | | * copies of the Software, and permit persons to whom the Software is |
16 | | * furnished to do so, under the terms of the COPYING file. |
17 | | * |
18 | | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY |
19 | | * KIND, either express or implied. |
20 | | * |
21 | | * SPDX-License-Identifier: curl |
22 | | * |
23 | | ***************************************************************************/ |
24 | | #include "curl_setup.h" |
25 | | |
26 | | #ifdef USE_WINDOWS_SSPI |
27 | | #include "curl_sspi.h" |
28 | | #endif |
29 | | |
30 | | #include "curlx/winapi.h" |
31 | | #include "strerror.h" |
32 | | #include "curlx/strcopy.h" |
33 | | |
34 | | const char *curl_easy_strerror(CURLcode error) |
35 | 0 | { |
36 | 0 | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
37 | 0 | switch(error) { |
38 | 0 | case CURLE_OK: |
39 | 0 | return "No error"; |
40 | | |
41 | 0 | case CURLE_UNSUPPORTED_PROTOCOL: |
42 | 0 | return "Unsupported protocol"; |
43 | | |
44 | 0 | case CURLE_FAILED_INIT: |
45 | 0 | return "Failed initialization"; |
46 | | |
47 | 0 | case CURLE_URL_MALFORMAT: |
48 | 0 | return "URL using bad/illegal format or missing URL"; |
49 | | |
50 | 0 | case CURLE_NOT_BUILT_IN: |
51 | 0 | return "A requested feature, protocol or option was not found built-in in" |
52 | 0 | " this libcurl due to a build-time decision."; |
53 | | |
54 | 0 | case CURLE_COULDNT_RESOLVE_PROXY: |
55 | 0 | return "Could not resolve proxy name"; |
56 | | |
57 | 0 | case CURLE_COULDNT_RESOLVE_HOST: |
58 | 0 | return "Could not resolve hostname"; |
59 | | |
60 | 0 | case CURLE_COULDNT_CONNECT: |
61 | 0 | return "Could not connect to server"; |
62 | | |
63 | 0 | case CURLE_WEIRD_SERVER_REPLY: |
64 | 0 | return "Weird server reply"; |
65 | | |
66 | 0 | case CURLE_REMOTE_ACCESS_DENIED: |
67 | 0 | return "Access denied to remote resource"; |
68 | | |
69 | 0 | case CURLE_FTP_ACCEPT_FAILED: |
70 | 0 | return "FTP: The server failed to connect to data port"; |
71 | | |
72 | 0 | case CURLE_FTP_ACCEPT_TIMEOUT: |
73 | 0 | return "FTP: Accepting server connect has timed out"; |
74 | | |
75 | 0 | case CURLE_FTP_PRET_FAILED: |
76 | 0 | return "FTP: The server did not accept the PRET command."; |
77 | | |
78 | 0 | case CURLE_FTP_WEIRD_PASS_REPLY: |
79 | 0 | return "FTP: unknown PASS reply"; |
80 | | |
81 | 0 | case CURLE_FTP_WEIRD_PASV_REPLY: |
82 | 0 | return "FTP: unknown PASV reply"; |
83 | | |
84 | 0 | case CURLE_FTP_WEIRD_227_FORMAT: |
85 | 0 | return "FTP: unknown 227 response format"; |
86 | | |
87 | 0 | case CURLE_FTP_CANT_GET_HOST: |
88 | 0 | return "FTP: cannot figure out the host in the PASV response"; |
89 | | |
90 | 0 | case CURLE_HTTP2: |
91 | 0 | return "Error in the HTTP2 framing layer"; |
92 | | |
93 | 0 | case CURLE_FTP_COULDNT_SET_TYPE: |
94 | 0 | return "FTP: could not set file type"; |
95 | | |
96 | 0 | case CURLE_PARTIAL_FILE: |
97 | 0 | return "Transferred a partial file"; |
98 | | |
99 | 0 | case CURLE_FTP_COULDNT_RETR_FILE: |
100 | 0 | return "FTP: could not retrieve (RETR failed) the specified file"; |
101 | | |
102 | 0 | case CURLE_QUOTE_ERROR: |
103 | 0 | return "Quote command returned error"; |
104 | | |
105 | 0 | case CURLE_HTTP_RETURNED_ERROR: |
106 | 0 | return "HTTP response code said error"; |
107 | | |
108 | 0 | case CURLE_WRITE_ERROR: |
109 | 0 | return "Failed writing received data to disk/application"; |
110 | | |
111 | 0 | case CURLE_UPLOAD_FAILED: |
112 | 0 | return "Upload failed (at start/before it took off)"; |
113 | | |
114 | 0 | case CURLE_READ_ERROR: |
115 | 0 | return "Failed to open/read local data from file/application"; |
116 | | |
117 | 0 | case CURLE_OUT_OF_MEMORY: |
118 | 0 | return "Out of memory"; |
119 | | |
120 | 0 | case CURLE_OPERATION_TIMEDOUT: |
121 | 0 | return "Timeout was reached"; |
122 | | |
123 | 0 | case CURLE_FTP_PORT_FAILED: |
124 | 0 | return "FTP: command PORT failed"; |
125 | | |
126 | 0 | case CURLE_FTP_COULDNT_USE_REST: |
127 | 0 | return "FTP: command REST failed"; |
128 | | |
129 | 0 | case CURLE_RANGE_ERROR: |
130 | 0 | return "Requested range was not delivered by the server"; |
131 | | |
132 | 0 | case CURLE_SSL_CONNECT_ERROR: |
133 | 0 | return "SSL connect error"; |
134 | | |
135 | 0 | case CURLE_BAD_DOWNLOAD_RESUME: |
136 | 0 | return "Could not resume download"; |
137 | | |
138 | 0 | case CURLE_FILE_COULDNT_READ_FILE: |
139 | 0 | return "Could not read a file:// file"; |
140 | | |
141 | 0 | case CURLE_LDAP_CANNOT_BIND: |
142 | 0 | return "LDAP: cannot bind"; |
143 | | |
144 | 0 | case CURLE_LDAP_SEARCH_FAILED: |
145 | 0 | return "LDAP: search failed"; |
146 | | |
147 | 0 | case CURLE_ABORTED_BY_CALLBACK: |
148 | 0 | return "Operation was aborted by an application callback"; |
149 | | |
150 | 0 | case CURLE_BAD_FUNCTION_ARGUMENT: |
151 | 0 | return "A libcurl function was given a bad argument"; |
152 | | |
153 | 0 | case CURLE_INTERFACE_FAILED: |
154 | 0 | return "Failed binding local connection end"; |
155 | | |
156 | 0 | case CURLE_TOO_MANY_REDIRECTS: |
157 | 0 | return "Number of redirects hit maximum amount"; |
158 | | |
159 | 0 | case CURLE_UNKNOWN_OPTION: |
160 | 0 | return "An unknown option was passed in to libcurl"; |
161 | | |
162 | 0 | case CURLE_SETOPT_OPTION_SYNTAX: |
163 | 0 | return "Malformed option provided in a setopt"; |
164 | | |
165 | 0 | case CURLE_GOT_NOTHING: |
166 | 0 | return "Server returned nothing (no headers, no data)"; |
167 | | |
168 | 0 | case CURLE_SSL_ENGINE_NOTFOUND: |
169 | 0 | return "SSL crypto engine not found"; |
170 | | |
171 | 0 | case CURLE_SSL_ENGINE_SETFAILED: |
172 | 0 | return "Can not set SSL crypto engine as default"; |
173 | | |
174 | 0 | case CURLE_SSL_ENGINE_INITFAILED: |
175 | 0 | return "Failed to initialise SSL crypto engine"; |
176 | | |
177 | 0 | case CURLE_SEND_ERROR: |
178 | 0 | return "Failed sending data to the peer"; |
179 | | |
180 | 0 | case CURLE_RECV_ERROR: |
181 | 0 | return "Failure when receiving data from the peer"; |
182 | | |
183 | 0 | case CURLE_SSL_CERTPROBLEM: |
184 | 0 | return "Problem with the local SSL certificate"; |
185 | | |
186 | 0 | case CURLE_SSL_CIPHER: |
187 | 0 | return "Could not use specified SSL cipher"; |
188 | | |
189 | 0 | case CURLE_PEER_FAILED_VERIFICATION: |
190 | 0 | return "SSL peer certificate or SSH remote key was not OK"; |
191 | | |
192 | 0 | case CURLE_SSL_CACERT_BADFILE: |
193 | 0 | return "Problem with the SSL CA cert (path? access rights?)"; |
194 | | |
195 | 0 | case CURLE_BAD_CONTENT_ENCODING: |
196 | 0 | return "Unrecognized or bad HTTP Content or Transfer-Encoding"; |
197 | | |
198 | 0 | case CURLE_FILESIZE_EXCEEDED: |
199 | 0 | return "Maximum file size exceeded"; |
200 | | |
201 | 0 | case CURLE_USE_SSL_FAILED: |
202 | 0 | return "Requested SSL level failed"; |
203 | | |
204 | 0 | case CURLE_SSL_SHUTDOWN_FAILED: |
205 | 0 | return "Failed to shut down the SSL connection"; |
206 | | |
207 | 0 | case CURLE_SSL_CRL_BADFILE: |
208 | 0 | return "Failed to load CRL file (path? access rights?, format?)"; |
209 | | |
210 | 0 | case CURLE_SSL_ISSUER_ERROR: |
211 | 0 | return "Issuer check against peer certificate failed"; |
212 | | |
213 | 0 | case CURLE_SEND_FAIL_REWIND: |
214 | 0 | return "Send failed since rewinding of the data stream failed"; |
215 | | |
216 | 0 | case CURLE_LOGIN_DENIED: |
217 | 0 | return "Login denied"; |
218 | | |
219 | 0 | case CURLE_TFTP_NOTFOUND: |
220 | 0 | return "TFTP: File Not Found"; |
221 | | |
222 | 0 | case CURLE_TFTP_PERM: |
223 | 0 | return "TFTP: Access Violation"; |
224 | | |
225 | 0 | case CURLE_REMOTE_DISK_FULL: |
226 | 0 | return "Disk full or allocation exceeded"; |
227 | | |
228 | 0 | case CURLE_TFTP_ILLEGAL: |
229 | 0 | return "TFTP: Illegal operation"; |
230 | | |
231 | 0 | case CURLE_TFTP_UNKNOWNID: |
232 | 0 | return "TFTP: Unknown transfer ID"; |
233 | | |
234 | 0 | case CURLE_REMOTE_FILE_EXISTS: |
235 | 0 | return "Remote file already exists"; |
236 | | |
237 | 0 | case CURLE_TFTP_NOSUCHUSER: |
238 | 0 | return "TFTP: No such user"; |
239 | | |
240 | 0 | case CURLE_REMOTE_FILE_NOT_FOUND: |
241 | 0 | return "Remote file not found"; |
242 | | |
243 | 0 | case CURLE_SSH: |
244 | 0 | return "Error in the SSH layer"; |
245 | | |
246 | 0 | case CURLE_AGAIN: |
247 | 0 | return "Socket not ready for send/recv"; |
248 | | |
249 | 0 | case CURLE_RTSP_CSEQ_ERROR: |
250 | 0 | return "RTSP CSeq mismatch or invalid CSeq"; |
251 | | |
252 | 0 | case CURLE_RTSP_SESSION_ERROR: |
253 | 0 | return "RTSP session error"; |
254 | | |
255 | 0 | case CURLE_FTP_BAD_FILE_LIST: |
256 | 0 | return "Unable to parse FTP file list"; |
257 | | |
258 | 0 | case CURLE_CHUNK_FAILED: |
259 | 0 | return "Chunk callback failed"; |
260 | | |
261 | 0 | case CURLE_NO_CONNECTION_AVAILABLE: |
262 | 0 | return "The max connection limit is reached"; |
263 | | |
264 | 0 | case CURLE_SSL_PINNEDPUBKEYNOTMATCH: |
265 | 0 | return "SSL public key does not match pinned public key"; |
266 | | |
267 | 0 | case CURLE_SSL_INVALIDCERTSTATUS: |
268 | 0 | return "SSL server certificate status verification FAILED"; |
269 | | |
270 | 0 | case CURLE_HTTP2_STREAM: |
271 | 0 | return "Stream error in the HTTP/2 framing layer"; |
272 | | |
273 | 0 | case CURLE_RECURSIVE_API_CALL: |
274 | 0 | return "API function called from within callback"; |
275 | | |
276 | 0 | case CURLE_AUTH_ERROR: |
277 | 0 | return "An authentication function returned an error"; |
278 | | |
279 | 0 | case CURLE_HTTP3: |
280 | 0 | return "HTTP/3 error"; |
281 | | |
282 | 0 | case CURLE_QUIC_CONNECT_ERROR: |
283 | 0 | return "QUIC connection error"; |
284 | | |
285 | 0 | case CURLE_PROXY: |
286 | 0 | return "proxy handshake error"; |
287 | | |
288 | 0 | case CURLE_SSL_CLIENTCERT: |
289 | 0 | return "SSL Client Certificate required"; |
290 | | |
291 | 0 | case CURLE_UNRECOVERABLE_POLL: |
292 | 0 | return "Unrecoverable error in select/poll"; |
293 | | |
294 | 0 | case CURLE_TOO_LARGE: |
295 | 0 | return "A value or data field grew larger than allowed"; |
296 | | |
297 | 0 | case CURLE_ECH_REQUIRED: |
298 | 0 | return "ECH attempted but failed"; |
299 | | |
300 | | /* error codes not used by current libcurl */ |
301 | 0 | default: |
302 | 0 | break; |
303 | 0 | } |
304 | | /* |
305 | | * By using a switch, gcc -Wall will complain about enum values |
306 | | * which do not appear, helping keep this function up-to-date. |
307 | | * By using gcc -Wall -Werror, you cannot forget. |
308 | | * |
309 | | * A table would not have the same benefit. Most compilers will generate |
310 | | * code similar to a table in any case, so there is little performance gain |
311 | | * from a table. Something is broken for the user's application, anyways, so |
312 | | * does it matter how fast it _does not_ work? |
313 | | * |
314 | | * The line number for the error will be near this comment, which is why it |
315 | | * is here, and not at the start of the switch. |
316 | | */ |
317 | 0 | return "Unknown error"; |
318 | | #else |
319 | | if(!error) |
320 | | return "No error"; |
321 | | else |
322 | | return "Error"; |
323 | | #endif |
324 | 0 | } |
325 | | |
326 | | const char *curl_multi_strerror(CURLMcode error) |
327 | 0 | { |
328 | 0 | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
329 | 0 | switch(error) { |
330 | 0 | case CURLM_CALL_MULTI_PERFORM: |
331 | 0 | return "Please call curl_multi_perform() soon"; |
332 | | |
333 | 0 | case CURLM_OK: |
334 | 0 | return "No error"; |
335 | | |
336 | 0 | case CURLM_BAD_HANDLE: |
337 | 0 | return "Invalid multi handle"; |
338 | | |
339 | 0 | case CURLM_BAD_EASY_HANDLE: |
340 | 0 | return "Invalid easy handle"; |
341 | | |
342 | 0 | case CURLM_OUT_OF_MEMORY: |
343 | 0 | return "Out of memory"; |
344 | | |
345 | 0 | case CURLM_INTERNAL_ERROR: |
346 | 0 | return "Internal error"; |
347 | | |
348 | 0 | case CURLM_BAD_SOCKET: |
349 | 0 | return "Invalid socket argument"; |
350 | | |
351 | 0 | case CURLM_UNKNOWN_OPTION: |
352 | 0 | return "Unknown option"; |
353 | | |
354 | 0 | case CURLM_ADDED_ALREADY: |
355 | 0 | return "The easy handle is already added to a multi handle"; |
356 | | |
357 | 0 | case CURLM_RECURSIVE_API_CALL: |
358 | 0 | return "API function called from within callback"; |
359 | | |
360 | 0 | case CURLM_WAKEUP_FAILURE: |
361 | 0 | return "Wakeup is unavailable or failed"; |
362 | | |
363 | 0 | case CURLM_BAD_FUNCTION_ARGUMENT: |
364 | 0 | return "A libcurl function was given a bad argument"; |
365 | | |
366 | 0 | case CURLM_ABORTED_BY_CALLBACK: |
367 | 0 | return "Operation was aborted by an application callback"; |
368 | | |
369 | 0 | case CURLM_UNRECOVERABLE_POLL: |
370 | 0 | return "Unrecoverable error in select/poll"; |
371 | | |
372 | 0 | case CURLM_LAST: |
373 | 0 | break; |
374 | 0 | } |
375 | | |
376 | 0 | return "Unknown error"; |
377 | | #else |
378 | | if(error == CURLM_OK) |
379 | | return "No error"; |
380 | | else |
381 | | return "Error"; |
382 | | #endif |
383 | 0 | } |
384 | | |
385 | | const char *curl_share_strerror(CURLSHcode error) |
386 | 0 | { |
387 | 0 | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
388 | 0 | switch(error) { |
389 | 0 | case CURLSHE_OK: |
390 | 0 | return "No error"; |
391 | | |
392 | 0 | case CURLSHE_BAD_OPTION: |
393 | 0 | return "Unknown share option"; |
394 | | |
395 | 0 | case CURLSHE_IN_USE: |
396 | 0 | return "Share currently in use"; |
397 | | |
398 | 0 | case CURLSHE_INVALID: |
399 | 0 | return "Invalid share handle"; |
400 | | |
401 | 0 | case CURLSHE_NOMEM: |
402 | 0 | return "Out of memory"; |
403 | | |
404 | 0 | case CURLSHE_NOT_BUILT_IN: |
405 | 0 | return "Feature not enabled in this library"; |
406 | | |
407 | 0 | case CURLSHE_LAST: |
408 | 0 | break; |
409 | 0 | } |
410 | | |
411 | 0 | return "CURLSHcode unknown"; |
412 | | #else |
413 | | if(error == CURLSHE_OK) |
414 | | return "No error"; |
415 | | else |
416 | | return "Error"; |
417 | | #endif |
418 | 0 | } |
419 | | |
420 | | const char *curl_url_strerror(CURLUcode error) |
421 | 0 | { |
422 | 0 | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
423 | 0 | switch(error) { |
424 | 0 | case CURLUE_OK: |
425 | 0 | return "No error"; |
426 | | |
427 | 0 | case CURLUE_BAD_HANDLE: |
428 | 0 | return "An invalid CURLU pointer was passed as argument"; |
429 | | |
430 | 0 | case CURLUE_BAD_PARTPOINTER: |
431 | 0 | return "An invalid 'part' argument was passed as argument"; |
432 | | |
433 | 0 | case CURLUE_MALFORMED_INPUT: |
434 | 0 | return "Malformed input to a URL function"; |
435 | | |
436 | 0 | case CURLUE_BAD_PORT_NUMBER: |
437 | 0 | return "Port number was not a decimal number between 0 and 65535"; |
438 | | |
439 | 0 | case CURLUE_UNSUPPORTED_SCHEME: |
440 | 0 | return "Unsupported URL scheme"; |
441 | | |
442 | 0 | case CURLUE_URLDECODE: |
443 | 0 | return "URL decode error, most likely because of rubbish in the input"; |
444 | | |
445 | 0 | case CURLUE_OUT_OF_MEMORY: |
446 | 0 | return "A memory function failed"; |
447 | | |
448 | 0 | case CURLUE_USER_NOT_ALLOWED: |
449 | 0 | return "Credentials was passed in the URL when prohibited"; |
450 | | |
451 | 0 | case CURLUE_UNKNOWN_PART: |
452 | 0 | return "An unknown part ID was passed to a URL API function"; |
453 | | |
454 | 0 | case CURLUE_NO_SCHEME: |
455 | 0 | return "No scheme part in the URL"; |
456 | | |
457 | 0 | case CURLUE_NO_USER: |
458 | 0 | return "No user part in the URL"; |
459 | | |
460 | 0 | case CURLUE_NO_PASSWORD: |
461 | 0 | return "No password part in the URL"; |
462 | | |
463 | 0 | case CURLUE_NO_OPTIONS: |
464 | 0 | return "No options part in the URL"; |
465 | | |
466 | 0 | case CURLUE_NO_HOST: |
467 | 0 | return "No host part in the URL"; |
468 | | |
469 | 0 | case CURLUE_NO_PORT: |
470 | 0 | return "No port part in the URL"; |
471 | | |
472 | 0 | case CURLUE_NO_QUERY: |
473 | 0 | return "No query part in the URL"; |
474 | | |
475 | 0 | case CURLUE_NO_FRAGMENT: |
476 | 0 | return "No fragment part in the URL"; |
477 | | |
478 | 0 | case CURLUE_NO_ZONEID: |
479 | 0 | return "No zoneid part in the URL"; |
480 | | |
481 | 0 | case CURLUE_BAD_LOGIN: |
482 | 0 | return "Bad login part"; |
483 | | |
484 | 0 | case CURLUE_BAD_IPV6: |
485 | 0 | return "Bad IPv6 address"; |
486 | | |
487 | 0 | case CURLUE_BAD_HOSTNAME: |
488 | 0 | return "Bad hostname"; |
489 | | |
490 | 0 | case CURLUE_BAD_FILE_URL: |
491 | 0 | return "Bad file:// URL"; |
492 | | |
493 | 0 | case CURLUE_BAD_SLASHES: |
494 | 0 | return "Unsupported number of slashes following scheme"; |
495 | | |
496 | 0 | case CURLUE_BAD_SCHEME: |
497 | 0 | return "Bad scheme"; |
498 | | |
499 | 0 | case CURLUE_BAD_PATH: |
500 | 0 | return "Bad path"; |
501 | | |
502 | 0 | case CURLUE_BAD_FRAGMENT: |
503 | 0 | return "Bad fragment"; |
504 | | |
505 | 0 | case CURLUE_BAD_QUERY: |
506 | 0 | return "Bad query"; |
507 | | |
508 | 0 | case CURLUE_BAD_PASSWORD: |
509 | 0 | return "Bad password"; |
510 | | |
511 | 0 | case CURLUE_BAD_USER: |
512 | 0 | return "Bad user"; |
513 | | |
514 | 0 | case CURLUE_LACKS_IDN: |
515 | 0 | return "libcurl lacks IDN support"; |
516 | | |
517 | 0 | case CURLUE_TOO_LARGE: |
518 | 0 | return "A value or data field is larger than allowed"; |
519 | | |
520 | 0 | case CURLUE_LAST: |
521 | 0 | break; |
522 | 0 | } |
523 | | |
524 | 0 | return "CURLUcode unknown"; |
525 | | #else |
526 | | if(error == CURLUE_OK) |
527 | | return "No error"; |
528 | | else |
529 | | return "Error"; |
530 | | #endif |
531 | 0 | } |
532 | | |
533 | | #ifdef USE_WINDOWS_SSPI |
534 | | /* |
535 | | * Curl_sspi_strerror: |
536 | | * Variant of curlx_strerror if the error code is definitely Windows SSPI. |
537 | | */ |
538 | | const char *Curl_sspi_strerror(SECURITY_STATUS err, char *buf, size_t buflen) |
539 | | { |
540 | | #ifdef _WIN32 |
541 | | DWORD old_win_err = GetLastError(); |
542 | | #endif |
543 | | int old_errno = errno; |
544 | | const char *txt; |
545 | | |
546 | | if(!buflen) |
547 | | return NULL; |
548 | | |
549 | | *buf = '\0'; |
550 | | |
551 | | #ifndef CURL_DISABLE_VERBOSE_STRINGS |
552 | | |
553 | | switch(err) { |
554 | | case SEC_E_OK: |
555 | | txt = "No error"; |
556 | | break; |
557 | | #define SEC2TXT(sec) case sec: txt = #sec; break |
558 | | SEC2TXT(CRYPT_E_REVOKED); |
559 | | SEC2TXT(CRYPT_E_NO_REVOCATION_DLL); |
560 | | SEC2TXT(CRYPT_E_NO_REVOCATION_CHECK); |
561 | | SEC2TXT(CRYPT_E_REVOCATION_OFFLINE); |
562 | | SEC2TXT(CRYPT_E_NOT_IN_REVOCATION_DATABASE); |
563 | | SEC2TXT(SEC_E_ALGORITHM_MISMATCH); |
564 | | SEC2TXT(SEC_E_BAD_BINDINGS); |
565 | | SEC2TXT(SEC_E_BAD_PKGID); |
566 | | SEC2TXT(SEC_E_BUFFER_TOO_SMALL); |
567 | | SEC2TXT(SEC_E_CANNOT_INSTALL); |
568 | | SEC2TXT(SEC_E_CANNOT_PACK); |
569 | | SEC2TXT(SEC_E_CERT_EXPIRED); |
570 | | SEC2TXT(SEC_E_CERT_UNKNOWN); |
571 | | SEC2TXT(SEC_E_CERT_WRONG_USAGE); |
572 | | SEC2TXT(SEC_E_CONTEXT_EXPIRED); |
573 | | SEC2TXT(SEC_E_CROSSREALM_DELEGATION_FAILURE); |
574 | | SEC2TXT(SEC_E_CRYPTO_SYSTEM_INVALID); |
575 | | SEC2TXT(SEC_E_DECRYPT_FAILURE); |
576 | | SEC2TXT(SEC_E_DELEGATION_POLICY); |
577 | | SEC2TXT(SEC_E_DELEGATION_REQUIRED); |
578 | | SEC2TXT(SEC_E_DOWNGRADE_DETECTED); |
579 | | SEC2TXT(SEC_E_ENCRYPT_FAILURE); |
580 | | SEC2TXT(SEC_E_ILLEGAL_MESSAGE); |
581 | | SEC2TXT(SEC_E_INCOMPLETE_CREDENTIALS); |
582 | | SEC2TXT(SEC_E_INCOMPLETE_MESSAGE); |
583 | | SEC2TXT(SEC_E_INSUFFICIENT_MEMORY); |
584 | | SEC2TXT(SEC_E_INTERNAL_ERROR); |
585 | | SEC2TXT(SEC_E_INVALID_HANDLE); |
586 | | SEC2TXT(SEC_E_INVALID_PARAMETER); |
587 | | SEC2TXT(SEC_E_INVALID_TOKEN); |
588 | | SEC2TXT(SEC_E_ISSUING_CA_UNTRUSTED); |
589 | | SEC2TXT(SEC_E_ISSUING_CA_UNTRUSTED_KDC); |
590 | | SEC2TXT(SEC_E_KDC_CERT_EXPIRED); |
591 | | SEC2TXT(SEC_E_KDC_CERT_REVOKED); |
592 | | SEC2TXT(SEC_E_KDC_INVALID_REQUEST); |
593 | | SEC2TXT(SEC_E_KDC_UNABLE_TO_REFER); |
594 | | SEC2TXT(SEC_E_KDC_UNKNOWN_ETYPE); |
595 | | SEC2TXT(SEC_E_LOGON_DENIED); |
596 | | SEC2TXT(SEC_E_MAX_REFERRALS_EXCEEDED); |
597 | | SEC2TXT(SEC_E_MESSAGE_ALTERED); |
598 | | SEC2TXT(SEC_E_MULTIPLE_ACCOUNTS); |
599 | | SEC2TXT(SEC_E_MUST_BE_KDC); |
600 | | SEC2TXT(SEC_E_NOT_OWNER); |
601 | | SEC2TXT(SEC_E_NO_AUTHENTICATING_AUTHORITY); |
602 | | SEC2TXT(SEC_E_NO_CREDENTIALS); |
603 | | SEC2TXT(SEC_E_NO_IMPERSONATION); |
604 | | SEC2TXT(SEC_E_NO_IP_ADDRESSES); |
605 | | SEC2TXT(SEC_E_NO_KERB_KEY); |
606 | | SEC2TXT(SEC_E_NO_PA_DATA); |
607 | | SEC2TXT(SEC_E_NO_S4U_PROT_SUPPORT); |
608 | | SEC2TXT(SEC_E_NO_TGT_REPLY); |
609 | | SEC2TXT(SEC_E_OUT_OF_SEQUENCE); |
610 | | SEC2TXT(SEC_E_PKINIT_CLIENT_FAILURE); |
611 | | SEC2TXT(SEC_E_PKINIT_NAME_MISMATCH); |
612 | | SEC2TXT(SEC_E_POLICY_NLTM_ONLY); |
613 | | SEC2TXT(SEC_E_QOP_NOT_SUPPORTED); |
614 | | SEC2TXT(SEC_E_REVOCATION_OFFLINE_C); |
615 | | SEC2TXT(SEC_E_REVOCATION_OFFLINE_KDC); |
616 | | SEC2TXT(SEC_E_SECPKG_NOT_FOUND); |
617 | | SEC2TXT(SEC_E_SECURITY_QOS_FAILED); |
618 | | SEC2TXT(SEC_E_SHUTDOWN_IN_PROGRESS); |
619 | | SEC2TXT(SEC_E_SMARTCARD_CERT_EXPIRED); |
620 | | SEC2TXT(SEC_E_SMARTCARD_CERT_REVOKED); |
621 | | SEC2TXT(SEC_E_SMARTCARD_LOGON_REQUIRED); |
622 | | SEC2TXT(SEC_E_STRONG_CRYPTO_NOT_SUPPORTED); |
623 | | SEC2TXT(SEC_E_TARGET_UNKNOWN); |
624 | | SEC2TXT(SEC_E_TIME_SKEW); |
625 | | SEC2TXT(SEC_E_TOO_MANY_PRINCIPALS); |
626 | | SEC2TXT(SEC_E_UNFINISHED_CONTEXT_DELETED); |
627 | | SEC2TXT(SEC_E_UNKNOWN_CREDENTIALS); |
628 | | SEC2TXT(SEC_E_UNSUPPORTED_FUNCTION); |
629 | | SEC2TXT(SEC_E_UNSUPPORTED_PREAUTH); |
630 | | SEC2TXT(SEC_E_UNTRUSTED_ROOT); |
631 | | SEC2TXT(SEC_E_WRONG_CREDENTIAL_HANDLE); |
632 | | SEC2TXT(SEC_E_WRONG_PRINCIPAL); |
633 | | SEC2TXT(SEC_I_COMPLETE_AND_CONTINUE); |
634 | | SEC2TXT(SEC_I_COMPLETE_NEEDED); |
635 | | SEC2TXT(SEC_I_CONTEXT_EXPIRED); |
636 | | SEC2TXT(SEC_I_CONTINUE_NEEDED); |
637 | | SEC2TXT(SEC_I_INCOMPLETE_CREDENTIALS); |
638 | | SEC2TXT(SEC_I_LOCAL_LOGON); |
639 | | SEC2TXT(SEC_I_NO_LSA_CONTEXT); |
640 | | SEC2TXT(SEC_I_RENEGOTIATE); |
641 | | SEC2TXT(SEC_I_SIGNATURE_NEEDED); |
642 | | default: |
643 | | txt = "Unknown error"; |
644 | | } |
645 | | |
646 | | if(err == SEC_E_ILLEGAL_MESSAGE) { |
647 | | curl_msnprintf(buf, buflen, |
648 | | "SEC_E_ILLEGAL_MESSAGE (0x%08lx) - This error usually " |
649 | | "occurs when a fatal SSL/TLS alert is received (e.g. " |
650 | | "handshake failed). More detail may be available in " |
651 | | "the Windows System event log.", err); |
652 | | } |
653 | | else { |
654 | | char msgbuf[256]; |
655 | | if(curlx_get_winapi_error((DWORD)err, msgbuf, sizeof(msgbuf))) |
656 | | curl_msnprintf(buf, buflen, "%s (0x%08lx) - %s", txt, err, msgbuf); |
657 | | else |
658 | | curl_msnprintf(buf, buflen, "%s (0x%08lx)", txt, err); |
659 | | } |
660 | | |
661 | | #else |
662 | | if(err == SEC_E_OK) |
663 | | txt = "No error"; |
664 | | else |
665 | | txt = "Error"; |
666 | | curlx_strcopy(buf, buflen, txt, strlen(txt)); |
667 | | #endif |
668 | | |
669 | | if(errno != old_errno) |
670 | | errno = old_errno; |
671 | | |
672 | | #ifdef _WIN32 |
673 | | if(old_win_err != GetLastError()) |
674 | | SetLastError(old_win_err); |
675 | | #endif |
676 | | |
677 | | return buf; |
678 | | } |
679 | | #endif /* USE_WINDOWS_SSPI */ |