Article delegate-en/1410 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] Re: SOCKS 4 Server reply messages
14 Nov 2001 16:54:05 GMT (Yutaka Sato)


On 11/14/01(07:15) you Claudio Topolcic <> wrote
in <_A1406@delegate-en.ML_>
 |         However, we did have problems with some SOCKS Clients. I
 |took a trace and it shows that DeleGate sends 04 in the version
 |field of SOCKS response messages. The SOCKS 4 specification
 |(see says
 |that this field represents the version of the reply code and
 |should be 0. Some SOCKS Clients reject the SOCKS exchange based
 |on this field.

Thank you for your pointing out the problem.  Could you tell me the
names of the client products?

>A reply packet is sent to the client when this connection is established,
>or when the request is rejected or the operation fails. 
>                +----+----+----+----+----+----+----+----+
>                | VN | CD | DSTPORT |      DSTIP        |
>                +----+----+----+----+----+----+----+----+
> # of bytes:       1    1      2              4
>VN is the version of the reply code and should be 0. CD is the result
>code with one of the following values:

Maybe I did not read this part of document when I rapidly implemented
SocksV4 in DeleGate about 6 years ago.  Although I noticed that the
version number value in a reply message from Socks-DeleGate is different 
from that of standard NEC-socksd, I've never claimed to fix it maybe
because major SocksV4 products does not strictly check the value, and
then Socks supporting products have shifted to SocksV5 today.

#Now still I'm not sure what does "the version of the reply code" mean,
#and I think "should" should have been represented as "MUST" if other
#values are treated as error:p

Anyway, I should fix DeleGate to follow the specification.

 |         If you already have a version of DeleGate that implements
 |the SOCKS 4 version field according to the specification, please
 |tell me where to find it. I am having difficulty finding any
 |appropriate notes in the mail archive.
 |         If you do not yet have such a version of DeleGate, I
 |recommend that you consider creating one.

I will modify socks4.c as enclosed patch do.  It will be applied
to the next release of DeleGate.  Thank you.

  @ @ Yutaka Sato <>
 ( - ) National Institute of Advanced Industrial Science and Technology (AIST)
_<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan

*** ../delegate7.6.1/src/socks4.c	Fri Dec 22 16:48:52 2000
--- socks4.c	Thu Nov 15 01:29:04 2001
*** 77,83 ****
--- 77,92 ----
  	if( sscanf(addr,"%d.%d.%d.%d",av[0],av[1],av[2],av[3]) != 4 )
  		return -1;
+ 	switch( command ){
+ 		case SOCKS_RESULT:
+ 		case SOCKS_FAIL:
+ 		case SOCKS_BAD_ID:
+ 			obuf[0] = 0; /* the version of the set of reply codes */
+ 			break;
+ 	default:
  	obuf[0] = version;
+ 	}
  	obuf[1] = command;
  	obuf[2] = port >> 8;

  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]