socks_gssapi.c 20 KB

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