socks_gssapi.c 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. /***************************************************************************
  2. * _ _ ____ _
  3. * Project ___| | | | _ \| |
  4. * / __| | | | |_) | |
  5. * | (__| |_| | _ <| |___
  6. * \___|\___/|_| \_\_____|
  7. *
  8. * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
  9. * Copyright (C) Markus Moeller, <markus_moeller@compuserve.com>
  10. *
  11. * This software is licensed as described in the file COPYING, which
  12. * you should have received as part of this distribution. The terms
  13. * are also available at https://curl.se/docs/copyright.html.
  14. *
  15. * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  16. * copies of the Software, and permit persons to whom the Software is
  17. * furnished to do so, under the terms of the COPYING file.
  18. *
  19. * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  20. * KIND, either express or implied.
  21. *
  22. * SPDX-License-Identifier: curl
  23. *
  24. ***************************************************************************/
  25. #include "curl_setup.h"
  26. #if defined(HAVE_GSSAPI) && !defined(CURL_DISABLE_PROXY)
  27. #include "curl_gssapi.h"
  28. #include "urldata.h"
  29. #include "sendf.h"
  30. #include "cfilters.h"
  31. #include "connect.h"
  32. #include "timeval.h"
  33. #include "socks.h"
  34. #include "warnless.h"
  35. #include "strdup.h"
  36. /* The last 3 #include files should be in this order */
  37. #include "curl_printf.h"
  38. #include "curl_memory.h"
  39. #include "memdebug.h"
  40. #define MAX_GSS_LEN 1024
  41. static gss_ctx_id_t gss_context = GSS_C_NO_CONTEXT;
  42. /*
  43. * Helper GSS-API error functions.
  44. */
  45. static int check_gss_err(struct Curl_easy *data,
  46. OM_uint32 major_status,
  47. OM_uint32 minor_status,
  48. const char *function)
  49. {
  50. if(GSS_ERROR(major_status)) {
  51. OM_uint32 maj_stat, min_stat;
  52. OM_uint32 msg_ctx = 0;
  53. gss_buffer_desc status_string = GSS_C_EMPTY_BUFFER;
  54. struct dynbuf dbuf;
  55. Curl_dyn_init(&dbuf, MAX_GSS_LEN);
  56. msg_ctx = 0;
  57. while(!msg_ctx) {
  58. /* convert major status code (GSS-API error) to text */
  59. maj_stat = gss_display_status(&min_stat, major_status,
  60. GSS_C_GSS_CODE,
  61. GSS_C_NULL_OID,
  62. &msg_ctx, &status_string);
  63. if(maj_stat == GSS_S_COMPLETE) {
  64. if(Curl_dyn_addn(&dbuf, status_string.value,
  65. status_string.length))
  66. return 1; /* error */
  67. gss_release_buffer(&min_stat, &status_string);
  68. break;
  69. }
  70. gss_release_buffer(&min_stat, &status_string);
  71. }
  72. if(Curl_dyn_addn(&dbuf, ".\n", 2))
  73. return 1; /* error */
  74. msg_ctx = 0;
  75. while(!msg_ctx) {
  76. /* convert minor status code (underlying routine error) to text */
  77. maj_stat = gss_display_status(&min_stat, minor_status,
  78. GSS_C_MECH_CODE,
  79. GSS_C_NULL_OID,
  80. &msg_ctx, &status_string);
  81. if(maj_stat == GSS_S_COMPLETE) {
  82. if(Curl_dyn_addn(&dbuf, status_string.value,
  83. status_string.length))
  84. return 1; /* error */
  85. gss_release_buffer(&min_stat, &status_string);
  86. break;
  87. }
  88. gss_release_buffer(&min_stat, &status_string);
  89. }
  90. failf(data, "GSS-API error: %s failed: %s", function, Curl_dyn_ptr(&dbuf));
  91. Curl_dyn_free(&dbuf);
  92. return 1;
  93. }
  94. return 0;
  95. }
  96. CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
  97. struct Curl_easy *data)
  98. {
  99. struct connectdata *conn = cf->conn;
  100. curl_socket_t sock = conn->sock[cf->sockindex];
  101. CURLcode code;
  102. ssize_t actualread;
  103. ssize_t nwritten;
  104. int result;
  105. OM_uint32 gss_major_status, gss_minor_status, gss_status;
  106. OM_uint32 gss_ret_flags;
  107. int gss_conf_state, gss_enc;
  108. gss_buffer_desc service = GSS_C_EMPTY_BUFFER;
  109. gss_buffer_desc gss_send_token = GSS_C_EMPTY_BUFFER;
  110. gss_buffer_desc gss_recv_token = GSS_C_EMPTY_BUFFER;
  111. gss_buffer_desc gss_w_token = GSS_C_EMPTY_BUFFER;
  112. gss_buffer_desc *gss_token = GSS_C_NO_BUFFER;
  113. gss_name_t server = GSS_C_NO_NAME;
  114. gss_name_t gss_client_name = GSS_C_NO_NAME;
  115. unsigned short us_length;
  116. char *user = NULL;
  117. unsigned char socksreq[4]; /* room for GSS-API exchange header only */
  118. const char *serviceptr = data->set.str[STRING_PROXY_SERVICE_NAME] ?
  119. data->set.str[STRING_PROXY_SERVICE_NAME] : "rcmd";
  120. const size_t serviceptr_length = strlen(serviceptr);
  121. /* GSS-API request looks like
  122. * +----+------+-----+----------------+
  123. * |VER | MTYP | LEN | TOKEN |
  124. * +----+------+----------------------+
  125. * | 1 | 1 | 2 | up to 2^16 - 1 |
  126. * +----+------+-----+----------------+
  127. */
  128. /* prepare service name */
  129. if(strchr(serviceptr, '/')) {
  130. service.length = serviceptr_length;
  131. service.value = Curl_memdup(serviceptr, service.length);
  132. if(!service.value)
  133. return CURLE_OUT_OF_MEMORY;
  134. gss_major_status = gss_import_name(&gss_minor_status, &service,
  135. (gss_OID) GSS_C_NULL_OID, &server);
  136. }
  137. else {
  138. service.value = malloc(serviceptr_length +
  139. strlen(conn->socks_proxy.host.name) + 2);
  140. if(!service.value)
  141. return CURLE_OUT_OF_MEMORY;
  142. service.length = serviceptr_length +
  143. strlen(conn->socks_proxy.host.name) + 1;
  144. msnprintf(service.value, service.length + 1, "%s@%s",
  145. serviceptr, conn->socks_proxy.host.name);
  146. gss_major_status = gss_import_name(&gss_minor_status, &service,
  147. GSS_C_NT_HOSTBASED_SERVICE, &server);
  148. }
  149. gss_release_buffer(&gss_status, &service); /* clear allocated memory */
  150. if(check_gss_err(data, gss_major_status,
  151. gss_minor_status, "gss_import_name()")) {
  152. failf(data, "Failed to create service name.");
  153. gss_release_name(&gss_status, &server);
  154. return CURLE_COULDNT_CONNECT;
  155. }
  156. (void)curlx_nonblock(sock, FALSE);
  157. /* As long as we need to keep sending some context info, and there is no */
  158. /* errors, keep sending it... */
  159. for(;;) {
  160. gss_major_status = Curl_gss_init_sec_context(data,
  161. &gss_minor_status,
  162. &gss_context,
  163. server,
  164. &Curl_krb5_mech_oid,
  165. NULL,
  166. gss_token,
  167. &gss_send_token,
  168. TRUE,
  169. &gss_ret_flags);
  170. if(gss_token != GSS_C_NO_BUFFER)
  171. gss_release_buffer(&gss_status, &gss_recv_token);
  172. if(check_gss_err(data, gss_major_status,
  173. gss_minor_status, "gss_init_sec_context")) {
  174. gss_release_name(&gss_status, &server);
  175. gss_release_buffer(&gss_status, &gss_recv_token);
  176. gss_release_buffer(&gss_status, &gss_send_token);
  177. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  178. failf(data, "Failed to initial GSS-API token.");
  179. return CURLE_COULDNT_CONNECT;
  180. }
  181. if(gss_send_token.length) {
  182. socksreq[0] = 1; /* GSS-API subnegotiation version */
  183. socksreq[1] = 1; /* authentication message type */
  184. us_length = htons((unsigned short)gss_send_token.length);
  185. memcpy(socksreq + 2, &us_length, sizeof(short));
  186. nwritten = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4,
  187. FALSE, &code);
  188. if(code || (4 != nwritten)) {
  189. failf(data, "Failed to send GSS-API authentication request.");
  190. gss_release_name(&gss_status, &server);
  191. gss_release_buffer(&gss_status, &gss_recv_token);
  192. gss_release_buffer(&gss_status, &gss_send_token);
  193. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  194. return CURLE_COULDNT_CONNECT;
  195. }
  196. nwritten = Curl_conn_cf_send(cf->next, data,
  197. (char *)gss_send_token.value,
  198. gss_send_token.length, FALSE, &code);
  199. if(code || ((ssize_t)gss_send_token.length != nwritten)) {
  200. failf(data, "Failed to send GSS-API authentication token.");
  201. gss_release_name(&gss_status, &server);
  202. gss_release_buffer(&gss_status, &gss_recv_token);
  203. gss_release_buffer(&gss_status, &gss_send_token);
  204. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  205. return CURLE_COULDNT_CONNECT;
  206. }
  207. }
  208. gss_release_buffer(&gss_status, &gss_send_token);
  209. gss_release_buffer(&gss_status, &gss_recv_token);
  210. if(gss_major_status != GSS_S_CONTINUE_NEEDED)
  211. break;
  212. /* analyse response */
  213. /* GSS-API response looks like
  214. * +----+------+-----+----------------+
  215. * |VER | MTYP | LEN | TOKEN |
  216. * +----+------+----------------------+
  217. * | 1 | 1 | 2 | up to 2^16 - 1 |
  218. * +----+------+-----+----------------+
  219. */
  220. result = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
  221. if(result || (actualread != 4)) {
  222. failf(data, "Failed to receive GSS-API authentication response.");
  223. gss_release_name(&gss_status, &server);
  224. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  225. return CURLE_COULDNT_CONNECT;
  226. }
  227. /* ignore the first (VER) byte */
  228. if(socksreq[1] == 255) { /* status / message type */
  229. failf(data, "User was rejected by the SOCKS5 server (%d %d).",
  230. socksreq[0], socksreq[1]);
  231. gss_release_name(&gss_status, &server);
  232. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  233. return CURLE_COULDNT_CONNECT;
  234. }
  235. if(socksreq[1] != 1) { /* status / message type */
  236. failf(data, "Invalid GSS-API authentication response type (%d %d).",
  237. socksreq[0], socksreq[1]);
  238. gss_release_name(&gss_status, &server);
  239. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  240. return CURLE_COULDNT_CONNECT;
  241. }
  242. memcpy(&us_length, socksreq + 2, sizeof(short));
  243. us_length = ntohs(us_length);
  244. gss_recv_token.length = us_length;
  245. gss_recv_token.value = malloc(us_length);
  246. if(!gss_recv_token.value) {
  247. failf(data,
  248. "Could not allocate memory for GSS-API authentication "
  249. "response token.");
  250. gss_release_name(&gss_status, &server);
  251. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  252. return CURLE_OUT_OF_MEMORY;
  253. }
  254. result = Curl_blockread_all(cf, data, (char *)gss_recv_token.value,
  255. gss_recv_token.length, &actualread);
  256. if(result || (actualread != us_length)) {
  257. failf(data, "Failed to receive GSS-API authentication token.");
  258. gss_release_name(&gss_status, &server);
  259. gss_release_buffer(&gss_status, &gss_recv_token);
  260. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  261. return CURLE_COULDNT_CONNECT;
  262. }
  263. gss_token = &gss_recv_token;
  264. }
  265. gss_release_name(&gss_status, &server);
  266. /* Everything is good so far, user was authenticated! */
  267. gss_major_status = gss_inquire_context(&gss_minor_status, gss_context,
  268. &gss_client_name, NULL, NULL, NULL,
  269. NULL, NULL, NULL);
  270. if(check_gss_err(data, gss_major_status,
  271. gss_minor_status, "gss_inquire_context")) {
  272. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  273. gss_release_name(&gss_status, &gss_client_name);
  274. failf(data, "Failed to determine username.");
  275. return CURLE_COULDNT_CONNECT;
  276. }
  277. gss_major_status = gss_display_name(&gss_minor_status, gss_client_name,
  278. &gss_send_token, NULL);
  279. if(check_gss_err(data, gss_major_status,
  280. gss_minor_status, "gss_display_name")) {
  281. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  282. gss_release_name(&gss_status, &gss_client_name);
  283. gss_release_buffer(&gss_status, &gss_send_token);
  284. failf(data, "Failed to determine username.");
  285. return CURLE_COULDNT_CONNECT;
  286. }
  287. user = malloc(gss_send_token.length + 1);
  288. if(!user) {
  289. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  290. gss_release_name(&gss_status, &gss_client_name);
  291. gss_release_buffer(&gss_status, &gss_send_token);
  292. return CURLE_OUT_OF_MEMORY;
  293. }
  294. memcpy(user, gss_send_token.value, gss_send_token.length);
  295. user[gss_send_token.length] = '\0';
  296. gss_release_name(&gss_status, &gss_client_name);
  297. gss_release_buffer(&gss_status, &gss_send_token);
  298. infof(data, "SOCKS5 server authenticated user %s with GSS-API.",user);
  299. free(user);
  300. user = NULL;
  301. /* Do encryption */
  302. socksreq[0] = 1; /* GSS-API subnegotiation version */
  303. socksreq[1] = 2; /* encryption message type */
  304. gss_enc = 0; /* no data protection */
  305. /* do confidentiality protection if supported */
  306. if(gss_ret_flags & GSS_C_CONF_FLAG)
  307. gss_enc = 2;
  308. /* else do integrity protection */
  309. else if(gss_ret_flags & GSS_C_INTEG_FLAG)
  310. gss_enc = 1;
  311. infof(data, "SOCKS5 server supports GSS-API %s data protection.",
  312. (gss_enc == 0) ? "no" :
  313. ((gss_enc == 1) ? "integrity" : "confidentiality"));
  314. /* force for the moment to no data protection */
  315. gss_enc = 0;
  316. /*
  317. * Sending the encryption type in clear seems wrong. It should be
  318. * protected with gss_seal()/gss_wrap(). See RFC1961 extract below
  319. * The NEC reference implementations on which this is based is
  320. * therefore at fault
  321. *
  322. * +------+------+------+.......................+
  323. * + ver | mtyp | len | token |
  324. * +------+------+------+.......................+
  325. * + 0x01 | 0x02 | 0x02 | up to 2^16 - 1 octets |
  326. * +------+------+------+.......................+
  327. *
  328. * Where:
  329. *
  330. * - "ver" is the protocol version number, here 1 to represent the
  331. * first version of the SOCKS/GSS-API protocol
  332. *
  333. * - "mtyp" is the message type, here 2 to represent a protection
  334. * -level negotiation message
  335. *
  336. * - "len" is the length of the "token" field in octets
  337. *
  338. * - "token" is the GSS-API encapsulated protection level
  339. *
  340. * The token is produced by encapsulating an octet containing the
  341. * required protection level using gss_seal()/gss_wrap() with conf_req
  342. * set to FALSE. The token is verified using gss_unseal()/
  343. * gss_unwrap().
  344. *
  345. */
  346. if(data->set.socks5_gssapi_nec) {
  347. us_length = htons((short)1);
  348. memcpy(socksreq + 2, &us_length, sizeof(short));
  349. }
  350. else {
  351. gss_send_token.length = 1;
  352. gss_send_token.value = Curl_memdup(&gss_enc, 1);
  353. if(!gss_send_token.value) {
  354. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  355. return CURLE_OUT_OF_MEMORY;
  356. }
  357. gss_major_status = gss_wrap(&gss_minor_status, gss_context, 0,
  358. GSS_C_QOP_DEFAULT, &gss_send_token,
  359. &gss_conf_state, &gss_w_token);
  360. if(check_gss_err(data, gss_major_status, gss_minor_status, "gss_wrap")) {
  361. gss_release_buffer(&gss_status, &gss_send_token);
  362. gss_release_buffer(&gss_status, &gss_w_token);
  363. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  364. failf(data, "Failed to wrap GSS-API encryption value into token.");
  365. return CURLE_COULDNT_CONNECT;
  366. }
  367. gss_release_buffer(&gss_status, &gss_send_token);
  368. us_length = htons((unsigned short)gss_w_token.length);
  369. memcpy(socksreq + 2, &us_length, sizeof(short));
  370. }
  371. nwritten = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 4, FALSE,
  372. &code);
  373. if(code || (4 != nwritten)) {
  374. failf(data, "Failed to send GSS-API encryption request.");
  375. gss_release_buffer(&gss_status, &gss_w_token);
  376. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  377. return CURLE_COULDNT_CONNECT;
  378. }
  379. if(data->set.socks5_gssapi_nec) {
  380. memcpy(socksreq, &gss_enc, 1);
  381. nwritten = Curl_conn_cf_send(cf->next, data, (char *)socksreq, 1, FALSE,
  382. &code);
  383. if(code || ( 1 != nwritten)) {
  384. failf(data, "Failed to send GSS-API encryption type.");
  385. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  386. return CURLE_COULDNT_CONNECT;
  387. }
  388. }
  389. else {
  390. nwritten = Curl_conn_cf_send(cf->next, data,
  391. (char *)gss_w_token.value,
  392. gss_w_token.length, FALSE, &code);
  393. if(code || ((ssize_t)gss_w_token.length != nwritten)) {
  394. failf(data, "Failed to send GSS-API encryption type.");
  395. gss_release_buffer(&gss_status, &gss_w_token);
  396. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  397. return CURLE_COULDNT_CONNECT;
  398. }
  399. gss_release_buffer(&gss_status, &gss_w_token);
  400. }
  401. result = Curl_blockread_all(cf, data, (char *)socksreq, 4, &actualread);
  402. if(result || (actualread != 4)) {
  403. failf(data, "Failed to receive GSS-API encryption response.");
  404. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  405. return CURLE_COULDNT_CONNECT;
  406. }
  407. /* ignore the first (VER) byte */
  408. if(socksreq[1] == 255) { /* status / message type */
  409. failf(data, "User was rejected by the SOCKS5 server (%d %d).",
  410. socksreq[0], socksreq[1]);
  411. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  412. return CURLE_COULDNT_CONNECT;
  413. }
  414. if(socksreq[1] != 2) { /* status / message type */
  415. failf(data, "Invalid GSS-API encryption response type (%d %d).",
  416. socksreq[0], socksreq[1]);
  417. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  418. return CURLE_COULDNT_CONNECT;
  419. }
  420. memcpy(&us_length, socksreq + 2, sizeof(short));
  421. us_length = ntohs(us_length);
  422. gss_recv_token.length = us_length;
  423. gss_recv_token.value = malloc(gss_recv_token.length);
  424. if(!gss_recv_token.value) {
  425. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  426. return CURLE_OUT_OF_MEMORY;
  427. }
  428. result = Curl_blockread_all(cf, data, (char *)gss_recv_token.value,
  429. gss_recv_token.length, &actualread);
  430. if(result || (actualread != us_length)) {
  431. failf(data, "Failed to receive GSS-API encryption type.");
  432. gss_release_buffer(&gss_status, &gss_recv_token);
  433. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  434. return CURLE_COULDNT_CONNECT;
  435. }
  436. if(!data->set.socks5_gssapi_nec) {
  437. gss_major_status = gss_unwrap(&gss_minor_status, gss_context,
  438. &gss_recv_token, &gss_w_token,
  439. 0, GSS_C_QOP_DEFAULT);
  440. if(check_gss_err(data, gss_major_status, gss_minor_status, "gss_unwrap")) {
  441. gss_release_buffer(&gss_status, &gss_recv_token);
  442. gss_release_buffer(&gss_status, &gss_w_token);
  443. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  444. failf(data, "Failed to unwrap GSS-API encryption value into token.");
  445. return CURLE_COULDNT_CONNECT;
  446. }
  447. gss_release_buffer(&gss_status, &gss_recv_token);
  448. if(gss_w_token.length != 1) {
  449. failf(data, "Invalid GSS-API encryption response length (%zu).",
  450. gss_w_token.length);
  451. gss_release_buffer(&gss_status, &gss_w_token);
  452. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  453. return CURLE_COULDNT_CONNECT;
  454. }
  455. memcpy(socksreq, gss_w_token.value, gss_w_token.length);
  456. gss_release_buffer(&gss_status, &gss_w_token);
  457. }
  458. else {
  459. if(gss_recv_token.length != 1) {
  460. failf(data, "Invalid GSS-API encryption response length (%zu).",
  461. gss_recv_token.length);
  462. gss_release_buffer(&gss_status, &gss_recv_token);
  463. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  464. return CURLE_COULDNT_CONNECT;
  465. }
  466. memcpy(socksreq, gss_recv_token.value, gss_recv_token.length);
  467. gss_release_buffer(&gss_status, &gss_recv_token);
  468. }
  469. (void)curlx_nonblock(sock, TRUE);
  470. infof(data, "SOCKS5 access with%s protection granted.",
  471. (socksreq[0] == 0) ? "out GSS-API data":
  472. ((socksreq[0] == 1) ? " GSS-API integrity" :
  473. " GSS-API confidentiality"));
  474. conn->socks5_gssapi_enctype = socksreq[0];
  475. if(socksreq[0] == 0)
  476. gss_delete_sec_context(&gss_status, &gss_context, NULL);
  477. return CURLE_OK;
  478. }
  479. #endif /* HAVE_GSSAPI && !CURL_DISABLE_PROXY */