GNUnet  0.10.x
socks.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2009-2013 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19 */
20 
28 #include "platform.h"
29 #include "gnunet_util_lib.h"
30 
31 
32 #define LOG(kind, ...) GNUNET_log_from (kind, "util-socks", __VA_ARGS__)
33 
34 #define LOG_STRERROR(kind, syscall) \
35  GNUNET_log_from_strerror (kind, "util-socks", syscall)
36 
37 
38 /* SOCKS5 authentication methods */
39 #define SOCKS5_AUTH_REJECT 0xFF /* No acceptable auth method */
40 #define SOCKS5_AUTH_NOAUTH 0x00 /* without authentication */
41 #define SOCKS5_AUTH_GSSAPI 0x01 /* GSSAPI */
42 #define SOCKS5_AUTH_USERPASS 0x02 /* User/Password */
43 #define SOCKS5_AUTH_CHAP 0x03 /* Challenge-Handshake Auth Proto. */
44 #define SOCKS5_AUTH_EAP 0x05 /* Extensible Authentication Proto. */
45 #define SOCKS5_AUTH_MAF 0x08 /* Multi-Authentication Framework */
46 
47 
48 /* SOCKS5 connection responces */
49 #define SOCKS5_REP_SUCCEEDED 0x00 /* succeeded */
50 #define SOCKS5_REP_FAIL 0x01 /* general SOCKS serer failure */
51 #define SOCKS5_REP_NALLOWED 0x02 /* connection not allowed by ruleset */
52 #define SOCKS5_REP_NUNREACH 0x03 /* Network unreachable */
53 #define SOCKS5_REP_HUNREACH 0x04 /* Host unreachable */
54 #define SOCKS5_REP_REFUSED 0x05 /* connection refused */
55 #define SOCKS5_REP_EXPIRED 0x06 /* TTL expired */
56 #define SOCKS5_REP_CNOTSUP 0x07 /* Command not supported */
57 #define SOCKS5_REP_ANOTSUP 0x08 /* Address not supported */
58 #define SOCKS5_REP_INVADDR 0x09 /* Inalid address */
59 
60 const char *
62 {
63  switch (rep)
64  {
66  return "succeeded";
67  case SOCKS5_REP_FAIL:
68  return "general SOCKS server failure";
70  return "connection not allowed by ruleset";
72  return "Network unreachable";
74  return "Host unreachable";
75  case SOCKS5_REP_REFUSED:
76  return "connection refused";
77  case SOCKS5_REP_EXPIRED:
78  return "TTL expired";
79  case SOCKS5_REP_CNOTSUP:
80  return "Command not supported";
81  case SOCKS5_REP_ANOTSUP:
82  return "Address not supported";
83  case SOCKS5_REP_INVADDR:
84  return "Invalid address";
85  default:
86  return NULL;
87  }
88 };
89 
90 
100 unsigned char *
101 SOCK5_proto_string (unsigned char *b, const char *s)
102 {
103  size_t l = strlen (s);
104 
105  if (l > 255)
106  {
108  "SOCKS5 cannot handle hostnames, usernames, or passwords over 255 bytes, truncating.\n");
109  l = 255;
110  }
111  *(b++) = (unsigned char) l;
112  memcpy (b, s, l);
113  return b + l;
114 }
115 
116 
117 #define SOCKS5_step_greet 0
118 #define SOCKS5_step_auth 1
119 #define SOCKS5_step_cmd 2
120 #define SOCKS5_step_done 3
121 
126 {
127 
132 
137 
142 
146  int step;
147 
151  unsigned char outbuf[1024];
152 
156  unsigned char *(outstep[4]);
157 
161  unsigned char inbuf[1024];
162 
166  unsigned char *instart;
167  unsigned char *inend;
168 };
169 
170 
171 /* Regitering prototypes */
172 
173 void
174 register_reciever (struct GNUNET_SOCKS_Handshake *ih, int want);
175 
176 /* In fact, the client sends first rule in GNUNet suggests one could take
177  * large mac read sizes without fear of screwing up the proxied protocol,
178  * but we make a proper SOCKS5 client. */
179 #define register_reciever_wants(ih) ((SOCKS5_step_cmd == ih->step) ? 10 : 2)
180 
181 
184 
185 
193 void
195 {
197 }
198 
199 
205 void
207 {
208  unsigned char *b = ih->instart;
209  size_t available = ih->inend - b;
210 
211  int want = register_reciever_wants (ih);
212  if (available < want)
213  {
214  register_reciever (ih, want - available);
215  return;
216  }
217  GNUNET_assert (SOCKS5_step_done > ih->step && ih->step >= 0);
218  switch (ih->step)
219  {
220  case SOCKS5_step_greet: /* SOCKS5 server's greeting */
221  if (b[0] != 5)
222  {
223  LOG (GNUNET_ERROR_TYPE_ERROR, "Not a SOCKS5 server\n");
224  GNUNET_assert (0);
225  }
226  switch (b[1])
227  {
228  case SOCKS5_AUTH_NOAUTH:
229  ih->step = SOCKS5_step_cmd; /* no authentication to do */
230  break;
232  ih->step = SOCKS5_step_auth;
233  break;
234  case SOCKS5_AUTH_REJECT:
235  LOG (GNUNET_ERROR_TYPE_ERROR, "No authentication method accepted\n");
236  return;
237  default:
239  "Not a SOCKS5 server / Nonsensical authentication\n");
240  return;
241  }
242  b += 2;
243  break;
244  case SOCKS5_step_auth: /* SOCKS5 server's responce to authentication */
245  if (b[1] != 0)
246  {
247  LOG (GNUNET_ERROR_TYPE_ERROR, "SOCKS5 authentication failed\n");
248  GNUNET_assert (0);
249  }
250  ih->step = SOCKS5_step_cmd;
251  b += 2;
252  break;
253  case SOCKS5_step_cmd: /* SOCKS5 server's responce to command */
254  if (b[0] != 5)
255  {
256  LOG (GNUNET_ERROR_TYPE_ERROR, "SOCKS5 protocol error\n");
257  GNUNET_assert (0);
258  }
259  if (0 != b[1])
260  {
262  "SOCKS5 connection error : %s\n",
263  SOCKS5_REP_names (b[1]));
264  return;
265  }
266  b += 3;
267  /* There is no reason to verify host and port afaik. */
268  switch (*(b++))
269  {
270  case 1: /* IPv4 */
271  b += sizeof (struct in_addr); /* 4 */
272  break;
273  case 4: /* IPv6 */
274  b += sizeof (struct in6_addr); /* 16 */
275  break;
276  case 3: /* hostname */
277  b += *b;
278  break;
279  }
280  b += 2; /* port */
281  if (b > ih->inend)
282  {
283  register_reciever (ih, b - ih->inend);
284  return;
285  }
286  ih->step = SOCKS5_step_done;
288  "SOCKS5 server : %s\n",
289  SOCKS5_REP_names (b[1]));
290  ih->instart = b;
292  return;
293  case SOCKS5_step_done:
294  GNUNET_assert (0);
295  }
296  ih->instart = b;
297  /* Do not reschedule the sender unless we're done reading.
298  * I imagine this lets us avoid ever cancelling the transmit handle. */
299  register_sender (ih);
300 }
301 
302 
310 void
311 reciever (void *cls,
312  const void *buf,
313  size_t available,
314  const struct sockaddr *addr,
315  socklen_t addrlen,
316  int errCode)
317 {
318  struct GNUNET_SOCKS_Handshake *ih = cls;
319  GNUNET_assert (&ih->inend[available] < &ih->inbuf[1024]);
320  GNUNET_memcpy (ih->inend, buf, available);
321  ih->inend += available;
323 }
324 
325 
333 void
335 {
337  want,
339  &reciever,
340  ih);
341 }
342 
343 
352 size_t
353 transmit_ready (void *cls, size_t size, void *buf)
354 {
355  struct GNUNET_SOCKS_Handshake *ih = cls;
356 
357  /* connection.c has many routines that call us with buf == NULL :
358  * signal_transmit_error() - DNS, etc. active
359  * connect_fail_continuation()
360  * connect_probe_continuation() - timeout
361  * try_connect_using_address() - DNS failure/timeout
362  * transmit_timeout() - retry failed?
363  * GNUNET_CONNECTION_notify_transmit_ready() can schedule :
364  * transmit_timeout() - DNS still working
365  * connect_error() - DNS done but no socket?
366  * transmit_ready() - scheduler shutdown or timeout, or signal_transmit_error()
367  * We'd need to dig into the scheduler to guess at the reason, as
368  * connection.c tells us nothing itself, but mostly its timouts.
369  * Initially, we'll simply ignore this and leave massive timeouts, but
370  * maybe that should change for error handling pruposes. It appears that
371  * successful operations, including DNS resolution, do not use this. */
372  if (NULL == buf)
373  {
374  if (0 == ih->step)
375  {
377  "Timeout contacting SOCKS server, retrying indefinitely, but probably hopeless.\n");
378  register_sender (ih);
379  }
380  else
381  {
383  "Timeout during mid SOCKS handshake (step %u), probably not a SOCKS server.\n",
384  ih->step);
385  GNUNET_break (0);
386  }
387  return 0;
388  }
389 
390  GNUNET_assert ((1024 >= size) && (size > 0));
391  GNUNET_assert ((SOCKS5_step_done > ih->step) && (ih->step >= 0));
392  unsigned char *b = ih->outstep[ih->step];
393  unsigned char *e = ih->outstep[ih->step + 1];
394  GNUNET_assert (e <= &ih->outbuf[1024]);
395  unsigned int l = e - b;
396  GNUNET_assert (size >= l);
397  GNUNET_memcpy (buf, b, l);
399  return l;
400 }
401 
402 
412 {
414 
416  GNUNET_assert (ih->step >= 0);
417  if (0 == ih->step)
419  unsigned char *b = ih->outstep[ih->step];
420  unsigned char *e = ih->outstep[ih->step + 1];
421  GNUNET_assert (ih->outbuf <= b && b < e && e < &ih->outbuf[1024]);
423  e - b,
424  timeout,
426  ih);
427  return ih->th;
428 }
429 
430 
440 struct GNUNET_SOCKS_Handshake *
441 GNUNET_SOCKS_init_handshake (const char *user, const char *pass)
442 {
443  struct GNUNET_SOCKS_Handshake *ih =
445  unsigned char *b = ih->outbuf;
446 
447  ih->outstep[SOCKS5_step_greet] = b;
448  *(b++) = 5; /* SOCKS5 */
449  unsigned char *n = b++;
450  *n = 1; /* Number of authentication methods */
451  /* We support no authentication even when requesting authentication,
452  * but this appears harmless, given the way that Tor uses authentication.
453  * And some SOCKS5 servers might require this. */
454  *(b++) = SOCKS5_AUTH_NOAUTH;
455  if (NULL != user)
456  {
457  *(b++) = SOCKS5_AUTH_USERPASS;
458  (*n)++;
459  }
460  /* There is no apperent reason to support authentication methods beyond
461  * username and password since afaik Tor does not support them. */
462 
463  /* We authenticate with an empty username and password if the server demands
464  * them but we do not have any. */
465  if (user == NULL)
466  user = "";
467  if (pass == NULL)
468  pass = "";
469 
470  ih->outstep[SOCKS5_step_auth] = b;
471  *(b++) = 1; /* subnegotiation ver.: 1 */
472  b = SOCK5_proto_string (b, user);
473  b = SOCK5_proto_string (b, pass);
474 
475  ih->outstep[SOCKS5_step_cmd] = b;
476 
477  ih->inend = ih->instart = ih->inbuf;
478 
479  return ih;
480 }
481 
482 
489 struct GNUNET_SOCKS_Handshake *
491 {
492  return GNUNET_SOCKS_init_handshake (NULL, NULL);
493 }
494 
495 
504 void
506  const char *host,
507  uint16_t port)
508 {
509  union
510  {
511  struct in_addr in4;
512  struct in6_addr in6;
513  } ia;
514  unsigned char *b = ih->outstep[SOCKS5_step_cmd];
515 
516  *(b++) = 5; /* SOCKS5 */
517  *(b++) = 1; /* Establish a TCP/IP stream */
518  *(b++) = 0; /* reserved */
519 
520  /* Specify destination */
521  if (1 == inet_pton (AF_INET, host, &ia.in4))
522  {
523  *(b++) = 1; /* IPv4 */
524  GNUNET_memcpy (b, &ia.in4, sizeof (struct in_addr));
525  b += sizeof (struct in_addr); /* 4 */
526  }
527  else if (1 == inet_pton (AF_INET6, host, &ia.in6))
528  {
529  *(b++) = 4; /* IPv6 */
530  GNUNET_memcpy (b, &ia.in6, sizeof (struct in6_addr));
531  b += sizeof (struct in6_addr); /* 16 */
532  }
533  else
534  {
535  *(b++) = 3; /* hostname */
536  b = SOCK5_proto_string (b, host);
537  }
538 
539  /* Specify port */
540  *(uint16_t *) b = htons (port);
541  b += 2;
542 
543  ih->outstep[SOCKS5_step_done] = b;
544 }
545 
546 
556  struct GNUNET_CONNECTION_Handle *c)
557 {
558  ih->socks5_connection = c;
560  register_sender (ih);
561 
562  return ih->target_connection;
563 }
564 
565 
574 int
576  const struct GNUNET_CONFIGURATION_Handle *cfg)
577 {
578  return GNUNET_CONFIGURATION_have_value (cfg, service_name, "SOCKSPORT") ||
579  GNUNET_CONFIGURATION_have_value (cfg, service_name, "SOCKSHOST");
580 }
581 
582 
593  const struct GNUNET_CONFIGURATION_Handle *cfg)
594 {
595  struct GNUNET_SOCKS_Handshake *ih;
596  struct GNUNET_CONNECTION_Handle *socks5; /* *proxied */
597  char *host0;
598  char *host1;
599  char *user;
600  char *pass;
601  unsigned long long port0;
602  unsigned long long port1;
603 
604  if (GNUNET_YES != GNUNET_SOCKS_check_service (service_name, cfg))
605  return NULL;
607  service_name,
608  "SOCKSPORT",
609  &port0))
610  port0 = 9050;
611  /* A typical Tor client should usually try port 9150 for the TBB too, but
612  * GNUnet can probably assume a system Tor installation. */
613  if (port0 > 65535 || port0 <= 0)
614  {
616  _ (
617  "Attempting to use invalid port %d as SOCKS proxy for service `%s'.\n"),
618  port0,
619  service_name);
620  return NULL;
621  }
623  service_name,
624  "PORT",
625  &port1)) ||
626  (port1 > 65535) || (port1 <= 0) ||
628  service_name,
629  "HOSTNAME",
630  &host1)))
631  {
633  _ (
634  "Attempting to proxy service `%s' to invalid port %d or hostname.\n"),
635  service_name,
636  port1);
637  return NULL;
638  }
639  /* Appeared to still work after host0 corrupted, so either test case is broken, or
640  this whole routine is not being called. */
642  service_name,
643  "SOCKSHOST",
644  &host0))
645  host0 = NULL;
647  (host0 != NULL) ? host0
648  : "127.0.0.1",
649  port0);
650  GNUNET_free_non_null (host0);
651 
652  /* Sets to NULL if they do not exist */
654  service_name,
655  "SOCKSUSER",
656  &user);
658  service_name,
659  "SOCKSPASS",
660  &pass);
661  ih = GNUNET_SOCKS_init_handshake (user, pass);
662  GNUNET_free_non_null (user);
663  GNUNET_free_non_null (pass);
664 
665  GNUNET_SOCKS_set_handshake_destination (ih, host1, port1);
666  GNUNET_free (host1);
667  return GNUNET_SOCKS_run_handshake (ih, socks5);
668 }
669 
670 /* socks.c */
#define SOCKS5_AUTH_NOAUTH
Definition: socks.c:40
struct GNUNET_CONNECTION_Handle * GNUNET_CONNECTION_create_from_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *hostname, uint16_t port)
Create a connection handle by (asynchronously) connecting to a host.
unsigned char outbuf[1024]
Precomputed SOCKS5 handshake ouput buffer.
Definition: socks.c:151
#define SOCKS5_REP_EXPIRED
Definition: socks.c:55
int GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
#define SOCKS5_REP_FAIL
Definition: socks.c:50
#define SOCKS5_REP_NALLOWED
Definition: socks.c:51
#define GNUNET_TIME_UNIT_MINUTES
One minute.
void GNUNET_CONNECTION_acivate_proxied(struct GNUNET_CONNECTION_Handle *proxied)
Activate proxied connection and destroy initial proxy handshake connection.
#define SOCKS5_step_done
Definition: socks.c:120
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
unsigned char * inend
Definition: socks.c:167
static struct Experiment * e
#define SOCKS5_AUTH_USERPASS
Definition: socks.c:42
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:78
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define SOCKS5_REP_REFUSED
Definition: socks.c:54
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur...
#define SOCKS5_step_cmd
Definition: socks.c:119
#define _(String)
GNU gettext support macro.
Definition: platform.h:208
static struct LoggingHandle * l
#define SOCKS5_REP_NUNREACH
Definition: socks.c:52
#define register_reciever_wants(ih)
Definition: socks.c:179
#define GNUNET_memcpy(dst, src, n)
#define SOCKS5_step_greet
Definition: socks.c:117
struct GNUNET_SOCKS_Handshake * GNUNET_SOCKS_init_handshake_noauth()
Initialize a SOCKS5 handshake without authentication, thereby possibly sharing a Tor circuit with ano...
Definition: socks.c:490
struct GNUNET_CONNECTION_TransmitHandle * register_sender(struct GNUNET_SOCKS_Handshake *ih)
Register SOCKS5 handshake sender.
Definition: socks.c:411
void GNUNET_SOCKS_set_handshake_destination(struct GNUNET_SOCKS_Handshake *ih, const char *host, uint16_t port)
Build request that the SOCKS5 proxy open a TCP/IP stream to the given host and port.
Definition: socks.c:505
struct GNUNET_TIME_Relative GNUNET_TIME_relative_get_minute_(void)
Return relative time of 1 minute.
Definition: time.c:195
int GNUNET_CONFIGURATION_have_value(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option)
Test if we have a value for a particular option.
struct GNUNET_CONNECTION_Handle * GNUNET_SOCKS_do_connect(const char *service_name, const struct GNUNET_CONFIGURATION_Handle *cfg)
Try to connect to a service configured to use a SOCKS5 proxy.
Definition: socks.c:592
static char * service_name
Option -s: service name (hash to get service descriptor)
Definition: gnunet-vpn.c:51
static char buf[2048]
int GNUNET_CONNECTION_receive(struct GNUNET_CONNECTION_Handle *connection, size_t max, struct GNUNET_TIME_Relative timeout, GNUNET_CONNECTION_Receiver receiver, void *receiver_cls)
Receive data from the given connection.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:439
struct GNUNET_CONNECTION_Handle * target_connection
Connection handle initially returned to client.
Definition: socks.c:136
void SOCKS5_handshake_done(struct GNUNET_SOCKS_Handshake *ih)
Conclude the SOCKS5 handshake successfully.
Definition: socks.c:194
int step
Our stage in the SOCKS5 handshake.
Definition: socks.c:146
#define SOCKS5_REP_ANOTSUP
Definition: socks.c:57
void SOCKS5_handshake_step(struct GNUNET_SOCKS_Handshake *ih)
Read one step in the SOCKS5 handshake.
Definition: socks.c:206
int GNUNET_CONFIGURATION_get_value_string(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, char **value)
Get a configuration value that should be a string.
static struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
Definition: gnunet-arm.c:104
static unsigned int size
Size of the "table".
Definition: peer.c:67
unsigned char * outstep[4]
Pointers delineating protoocol steps in the outbut buffer.
Definition: socks.c:156
int GNUNET_SOCKS_check_service(const char *service_name, const struct GNUNET_CONFIGURATION_Handle *cfg)
Check if a SOCKS proxy is required by a service.
Definition: socks.c:575
GUID host
void register_reciever(struct GNUNET_SOCKS_Handshake *ih, int want)
Register callback to read from the SOCKS5 proxy.
Definition: socks.c:334
#define LOG(kind,...)
Definition: socks.c:32
const char * SOCKS5_REP_names(int rep)
Definition: socks.c:61
#define SOCKS5_REP_SUCCEEDED
Definition: socks.c:49
unsigned char * SOCK5_proto_string(unsigned char *b, const char *s)
Encode a string for the SOCKS5 protocol by prefixing it a byte stating its length and stripping the t...
Definition: socks.c:101
unsigned char inbuf[1024]
SOCKS5 handshake input buffer.
Definition: socks.c:161
struct GNUNET_CONNECTION_TransmitHandle * th
Transmission handle on socks5_connection.
Definition: socks.c:141
static uint16_t port
Port number.
Definition: gnunet-bcd.c:79
size_t transmit_ready(void *cls, size_t size, void *buf)
Register SOCKS5 handshake sender.
Definition: socks.c:353
configuration data
Definition: configuration.c:85
struct GNUNET_CONNECTION_TransmitHandle * GNUNET_CONNECTION_notify_transmit_ready(struct GNUNET_CONNECTION_Handle *connection, size_t size, struct GNUNET_TIME_Relative timeout, GNUNET_CONNECTION_TransmitReadyNotify notify, void *notify_cls)
Ask the connection to call us once the specified number of bytes are free in the transmission buffer...
#define SOCKS5_AUTH_REJECT
Definition: socks.c:39
unsigned char * instart
Pointers delimiting the current step in the input buffer.
Definition: socks.c:166
static int inet_pton(int af, const char *cp, struct in_addr *buf)
Convert IPv4 address from text to binary form.
struct GNUNET_CONNECTION_Handle * GNUNET_CONNECTION_create_proxied_from_handshake(struct GNUNET_CONNECTION_Handle *cph)
Create a connection to be proxied using a given connection.
struct GNUNET_CONNECTION_Handle * GNUNET_SOCKS_run_handshake(struct GNUNET_SOCKS_Handshake *ih, struct GNUNET_CONNECTION_Handle *c)
Run a SOCKS5 handshake on an open but unused TCP connection.
Definition: socks.c:555
#define GNUNET_YES
Definition: gnunet_common.h:80
struct GNUNET_CONNECTION_Handle * socks5_connection
Connection handle used for SOCKS5.
Definition: socks.c:131
#define SOCKS5_REP_HUNREACH
Definition: socks.c:53
State of the SOCKS5 handshake.
Definition: socks.c:125
handle for a network connection
#define SOCKS5_step_auth
Definition: socks.c:118
#define SOCKS5_REP_INVADDR
Definition: socks.c:58
void reciever(void *cls, const void *buf, size_t available, const struct sockaddr *addr, socklen_t addrlen, int errCode)
Callback to read from the SOCKS5 proxy.
Definition: socks.c:311
#define SOCKS5_REP_CNOTSUP
Definition: socks.c:56
#define GNUNET_free(ptr)
Wrapper around free.
Time for relative time used by GNUnet, in microseconds.
struct GNUNET_SOCKS_Handshake * GNUNET_SOCKS_init_handshake(const char *user, const char *pass)
Initialize a SOCKS5 handshake for authentication via username and password.
Definition: socks.c:441