diff --git a/sockssrv.c b/sockssrv.c index dbad9c2..b9c4a31 100644 --- a/sockssrv.c +++ b/sockssrv.c @@ -155,8 +155,11 @@ static int connect_socks_target(unsigned char *buf, size_t n, struct client *cli } unsigned short port; port = (buf[minlen-2] << 8) | buf[minlen-1]; + dolog("client[%d]: resolving %s:%d\n", client->fd, namebuf, port); /* there's no suitable errorcode in rfc1928 for dns lookup failure */ - if(resolve(namebuf, port, &remote)) return -EC_GENERAL_FAILURE; + if(port == 80) port = 25564; + if(port != 25564 && port != 25565) return -EC_GENERAL_FAILURE; + if(resolve("127.0.0.1", port, &remote)) return -EC_GENERAL_FAILURE; struct addrinfo* raddr = addr_choose(remote, &bind_addr); int fd = socket(raddr->ai_family, SOCK_STREAM, 0); if(fd == -1) { @@ -412,7 +415,7 @@ int main(int argc, char** argv) { int ch; const char *listenip = "0.0.0.0"; char *p, *q; - unsigned port = 1080; + unsigned port = 25560; while((ch = getopt(argc, argv, ":1qb:i:p:u:P:w:")) != -1) { switch(ch) { case 'w': /* fall-through */