OpenSSH 3.0
Shun-ichi GOTO
gotoh at taiyo.co.jp
Wed Nov 7 17:07:30 EST 2001
Hi,
>>>>> at Tue, 6 Nov 2001 16:48:41 -0500
>>>>> Markus Friedl <markus at openbsd.org> said,>
> OpenSSH 3.0 has just been released. It will be available from the
> mirrors listed at http://www.openssh.com/ shortly.
...snip...
> 6) dynamic forwarding (use ssh(1) as your socks server)
This feature is interesting and userfull.
However, it does not supports SOCKS4a hostname resolving extention.
I made small patch to support this extension.
--- Regards,
Shun-ichi Goto <gotoh at taiyo.co.jp>
R&D Group, TAIYO Corp., Tokyo, JAPAN
-------------- next part --------------
Index: channels.c
===================================================================
RCS file: /usr/home/gotoh/Repository/openssh/channels.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 channels.c
--- channels.c 2001/11/07 01:18:29 1.1.1.2
+++ channels.c 2001/11/07 06:03:46
@@ -927,6 +927,27 @@
buffer_consume(&c->input, len);
buffer_consume(&c->input, 1); /* trailing '\0' */
+ if (memcmp(&s4_req.dest_addr, "\0\0\0", 3) == 0 &&
+ memcmp(&s4_req.dest_addr, "\0\0\0\0", 4) != 0) {
+ /* SOCKS version 4a */
+ struct hostent *he;
+ have = buffer_len(&c->input);
+ if (have < 2)
+ fatal("channel %d: decode socks4: hostname expected", c->self);
+ p = buffer_ptr(&c->input);
+ len = strlen(p);
+ debug2("channel %d: hostname: %s/%d", c->self, p, len);
+ if (len > have)
+ fatal("channel %d: decode socks4: len %d > have %d",
+ c->self, len, have);
+ he = gethostbyname(p);
+ if (he == NULL)
+ fatal("channel %d: decode socks4: Could not get IP address for"
+ " hostname %s", c->self, p);
+ memcpy(&s4_req.dest_addr, he->h_addr_list[0], sizeof(struct in_addr));
+ buffer_consume(&c->input, len);
+ buffer_consume(&c->input, 1); /* trailing '\0' */
+ }
host = inet_ntoa(s4_req.dest_addr);
strlcpy(c->path, host, sizeof(c->path));
c->host_port = ntohs(s4_req.dest_port);
More information about the openssh-unix-dev
mailing list