mirror of
https://github.com/3proxy/3proxy.git
synced 2026-05-13 13:30:12 +08:00
Fix socks v5 derivations from standard
This commit is contained in:
parent
0e13f57139
commit
88a09bc3ff
10
src/socks.c
10
src/socks.c
@ -247,6 +247,8 @@ fflush(stderr);
|
|||||||
sin = param->sincl;
|
sin = param->sincl;
|
||||||
*SAPORT(&sin) = 0;
|
*SAPORT(&sin) = 0;
|
||||||
if(param->srv->so._bind(param->sostate, param->clisock,(struct sockaddr *)&sin,SASIZE(&sin))) {RETURN (12);}
|
if(param->srv->so._bind(param->sostate, param->clisock,(struct sockaddr *)&sin,SASIZE(&sin))) {RETURN (12);}
|
||||||
|
sasize = SASIZE(&sin);
|
||||||
|
param->srv->so._getsockname(param->sostate, param->clisock, (struct sockaddr *)&sin, &sasize);
|
||||||
#if SOCKSTRACE > 0
|
#if SOCKSTRACE > 0
|
||||||
fprintf(stderr, "%hu binded to communicate with client\n",
|
fprintf(stderr, "%hu binded to communicate with client\n",
|
||||||
ntohs(*SAPORT(&sin))
|
ntohs(*SAPORT(&sin))
|
||||||
@ -264,7 +266,7 @@ fflush(stderr);
|
|||||||
|
|
||||||
CLEANRET:
|
CLEANRET:
|
||||||
|
|
||||||
if(param->clisock != INVALID_SOCKET){
|
if(param->clisock != INVALID_SOCKET && buf){
|
||||||
int repcode;
|
int repcode;
|
||||||
|
|
||||||
sasize = sizeof(sin);
|
sasize = sizeof(sin);
|
||||||
@ -285,7 +287,7 @@ CLEANRET:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if SOCKSTRACE > 0
|
#if SOCKSTRACE > 0
|
||||||
myinet_ntop(*SAFAMILY(&sin), &sin, tracebuf, SASIZE(&sin));
|
myinet_ntop(*SAFAMILY(&sin), SAADDR(&sin), tracebuf, SASIZE(&sin));
|
||||||
fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n",
|
fprintf(stderr, "Sending confirmation to client with code %d for %s with %s:%hu\n",
|
||||||
param->res,
|
param->res,
|
||||||
commands[command],
|
commands[command],
|
||||||
@ -299,6 +301,8 @@ fflush(stderr);
|
|||||||
else if (param->res < 20) repcode = 5;
|
else if (param->res < 20) repcode = 5;
|
||||||
else if (param->res < 30) repcode = 1;
|
else if (param->res < 30) repcode = 1;
|
||||||
else if (param->res < 100) repcode = 4;
|
else if (param->res < 100) repcode = 4;
|
||||||
|
else if (param->res == 100) repcode = 4;
|
||||||
|
else if (param->res == 997) repcode = 8;
|
||||||
else repcode = param->res%10;
|
else repcode = param->res%10;
|
||||||
|
|
||||||
if(ver == 5){
|
if(ver == 5){
|
||||||
@ -365,7 +369,7 @@ fflush(stderr);
|
|||||||
param->res = 462;
|
param->res = 462;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if(SAISNULL(¶m->req) &&
|
if(!SAISNULL(¶m->req) &&
|
||||||
memcmp(SAADDR(¶m->req),SAADDR(¶m->sinsr),SAADDRLEN(¶m->req))) {
|
memcmp(SAADDR(¶m->req),SAADDR(¶m->sinsr),SAADDRLEN(¶m->req))) {
|
||||||
param->res = 470;
|
param->res = 470;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user