Added user ID support to SOCKS4.
This commit is contained in:
parent
4b23ddc002
commit
a39ac3d94a
13
lib/url.c
13
lib/url.c
@ -1820,9 +1820,9 @@ ConnectionStore(struct SessionHandle *data,
|
|||||||
* Nonsupport "SOCKS 4A (Simple Extension to SOCKS 4 Protocol)"
|
* Nonsupport "SOCKS 4A (Simple Extension to SOCKS 4 Protocol)"
|
||||||
* Nonsupport "Identification Protocol (RFC1413)"
|
* Nonsupport "Identification Protocol (RFC1413)"
|
||||||
*/
|
*/
|
||||||
static int handleSock4Proxy(struct connectdata *conn)
|
static int handleSock4Proxy(const char *proxy_name, struct connectdata *conn)
|
||||||
{
|
{
|
||||||
unsigned char socksreq[9]; /* room for SOCKS4 request */
|
unsigned char socksreq[262]; /* room for SOCKS4 request incl. user id */
|
||||||
int result;
|
int result;
|
||||||
CURLcode code;
|
CURLcode code;
|
||||||
curl_socket_t sock = conn->sock[FIRSTSOCKET];
|
curl_socket_t sock = conn->sock[FIRSTSOCKET];
|
||||||
@ -1895,7 +1895,9 @@ static int handleSock4Proxy(struct connectdata *conn)
|
|||||||
/*
|
/*
|
||||||
* This is currently not supporting "Identification Protocol (RFC1413)".
|
* This is currently not supporting "Identification Protocol (RFC1413)".
|
||||||
*/
|
*/
|
||||||
socksreq[8] = 0; /* NUL ending the nonexistent userid */
|
socksreq[8] = 0; /* ensure empty userid is NUL-terminated */
|
||||||
|
if (proxy_name)
|
||||||
|
strlcat((char*)socksreq + 8, proxy_name, sizeof(socksreq) - 8);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make connection
|
* Make connection
|
||||||
@ -1903,7 +1905,7 @@ static int handleSock4Proxy(struct connectdata *conn)
|
|||||||
{
|
{
|
||||||
ssize_t actualread;
|
ssize_t actualread;
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
int packetsize = 9; /* request data size (include NULL) */
|
int packetsize = 9 + strlen((char*)socksreq + 8); /* size including NUL */
|
||||||
|
|
||||||
/* Send request */
|
/* Send request */
|
||||||
code = Curl_write(conn, sock, (char *)socksreq, packetsize, &written);
|
code = Curl_write(conn, sock, (char *)socksreq, packetsize, &written);
|
||||||
@ -2252,7 +2254,8 @@ static CURLcode ConnectPlease(struct connectdata *conn,
|
|||||||
/* do nothing here. handled later. */
|
/* do nothing here. handled later. */
|
||||||
break;
|
break;
|
||||||
case CURLPROXY_SOCKS4:
|
case CURLPROXY_SOCKS4:
|
||||||
return handleSock4Proxy(conn) ? CURLE_COULDNT_CONNECT : CURLE_OK;
|
return handleSock4Proxy(conn->proxyuser, conn) ?
|
||||||
|
CURLE_COULDNT_CONNECT : CURLE_OK;
|
||||||
default:
|
default:
|
||||||
failf(conn->data, "unknown proxytype option given");
|
failf(conn->data, "unknown proxytype option given");
|
||||||
return CURLE_COULDNT_CONNECT;
|
return CURLE_COULDNT_CONNECT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user