cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: ??: Socks4 proxy support

From: <Peter_Su_at_trend.com.tw>
Date: Thu, 23 Feb 2006 13:24:04 +0800

Thanks for your review, Dan.

Yes, in current implemention, it doesn't support "SOCKS4 userids" (In actually...I am not familiar this featue yet, can anyone help?),
so the socksreq only needs 9 bytes.

         unsigned char socksreq[9] ; /* room for SOCKS4 request */

Second, sorry for I mistake in merging codes,
in my local codes, It was
        unsigned char socksreq[600] = {0}; /* room for large user/pw (255 max each) */
so the buffer has been initialized 0, but I think your revision is better.
        ....
        socksreq[8] = 0; /* NUL ending the nonexistent userid */

Again, thanks for your collection.
I have revised all, please refer the attached diff result.

Dear Daniel, can you help me to checkin this revision code, thanks a lot.

> -----Original Message-----
> From: curl-library-bounces_at_cool.haxx.se
> [mailto:curl-library-bounces_at_cool.haxx.se] On Behalf Of Dan Fandrich
> Sent: Thursday, February 23, 2006 3:10 AM
> To: curl-library_at_cool.haxx.se
> Subject: Re: ??: Socks4 proxy support
>
> On Tue, Feb 21, 2006 at 01:27:56PM +0800, Peter_Su_at_trend.com.tw wrote:
> > -static int handleSock4Proxy(struct connectdata *conn)
> > -{
> > - unsigned char socksreq[600]; /* room for large user/pw
> (255 max each) */
>
> It looks to me like socksreq needs to be only 9 bytes long,
> since the code
> doesn't support SOCKS4 userids. (Question: why not? Or is
> everyone who needs
> accounting using SOCKS5?)
> > - int result;
> > - CURLcode code;
> > - curl_socket_t sock = conn->sock[FIRSTSOCKET];
> > - struct SessionHandle *data = conn->data;
> > -
> > - Curl_nonblock(sock, FALSE);
> > -
> > - /*
> > - * Compose socks4 request
> > - *
> > - * Request format
> > - *
> > - *
> +----+----+----+----+----+----+----+----+----+----+....+----+
> > - * | VN | CD | DSTPORT | DSTIP | USERID
> |NULL|
> > - *
> +----+----+----+----+----+----+----+----+----+----+....+----+
> > - * # of bytes: 1 1 2 4
> variable 1
> > - */
> > -
> > - socksreq[0] = 4; /* version (SOCKS4) */
> > - socksreq[1] = 1; /* connect */
>
> What's missing here is a line
> socksreq[8] = 0; /* NUL ending the nonexistent userid */
> to terminate the SOCKS4 request packet. The code as is could
> sporadically
> fail depending on what data is at this location on the stack.
>
> >>> Dan
> --
> http://www.MoveAnnouncer.com The web change of
> address service
> Let webmasters know that your web site has moved
>

TREND MICRO EMAIL NOTICE
The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.

Received on 2006-02-23