[Ttssh2-commit] [3808] SSH port forward で listen_address を指定できるようにした。

svnno****@sourc***** svnno****@sourc*****
2010年 3月 11日 (木) 00:27:58 JST


Revision: 3808
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=3808
Author:   maya
Date:     2010-03-11 00:27:58 +0900 (Thu, 11 Mar 2010)

Log Message:
-----------
SSH port forward で listen_address を指定できるようにした。
  http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=19946
  LocalForwardingIdentityCheck を廃止した。
  from_port が同じで listen_address が 0.0.0.0 と 127.0.0.1 のようにかぶった場合は、どちらかが INVALID_SOCKET となり LOG_LEVEL_WARNING のエラーになる。
  SSH1 の remote to local で bind-address が指定できないのはプロトコルの仕様らしい。

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/en/html/commandline/ttssh.html
    trunk/doc/en/html/menu/setup-sshforward.html
    trunk/doc/ja/html/about/history.html
    trunk/doc/ja/html/commandline/ttssh.html
    trunk/doc/ja/html/menu/setup-sshforward.html
    trunk/installer/release/TERATERM.INI
    trunk/installer/release/lang/English.lng
    trunk/installer/release/lang/German.lng
    trunk/installer/release/lang/Japanese.lng
    trunk/ttssh2/ttxssh/fwd.c
    trunk/ttssh2/ttxssh/fwd.h
    trunk/ttssh2/ttxssh/fwdui.c
    trunk/ttssh2/ttxssh/resource.h
    trunk/ttssh2/ttxssh/ssh.c
    trunk/ttssh2/ttxssh/ssh.h
    trunk/ttssh2/ttxssh/ttxssh.c
    trunk/ttssh2/ttxssh/ttxssh.h
    trunk/ttssh2/ttxssh/ttxssh.rc


-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/doc/en/html/about/history.html	2010-03-10 15:27:58 UTC (rev 3808)
@@ -47,11 +47,11 @@
     </ul>
   </li>
 
-  <!--li>Misc
+  <li>Misc
     <ul>
-      <li></li>
+      <li>upgraded TTSSH version supporting SSH2 to <a href="#ttssh_2.53">2.53</a></li>
     </ul>
-  </li-->
+  </li>
 
 </ul>
 
@@ -1454,6 +1454,30 @@
 
 <h2><a name="ttssh">TTSSH</a></h2>
 
+<h3><a name="ttssh_2.53">2010.3.10 (Ver 2.53 unreleased)</a></h3>
+<ul class="history">
+  <li>Changes
+    <ul>
+      <!--li>ƒ|[ƒg“]‘—‚ŃŠƒbƒXƒ“‚·‚éƒAƒhƒŒƒX‚ðŽw’è‚Å‚«‚é‚悤‚É‚µ‚½B
+        <ul>
+          <li>ƒ|[ƒg“]‘—‚Å‘¼‚̃zƒXƒg‚©‚ç‚̐ڑ±‚ðŽó‚¯“ü‚ê‚é‚©‚Ç‚¤‚©‚̐ݒè‚ðíœ‚µ‚½B</li-->
+          <li>changed <a href="../commandline/ttssh.html#ssh-l">command line options</a>.</li>
+          <li>changed <a href="../menu/setup-sshforward.html">SSH Port Forwarding dialog</a>.</li>
+        </ul></li>
+    </ul>
+  </li>
+
+  <!--li>Bug fixes
+    <ul>
+    </ul>
+  </li-->
+
+  <!--li>Misc
+    <ul>
+    </ul>
+  </li-->
+</ul>
+
 <h3><a name="ttssh_2.52">2009.11.10 (Ver 2.52)</a></h3>
 <ul class="history">
   <li>Changes

Modified: trunk/doc/en/html/commandline/ttssh.html
===================================================================
--- trunk/doc/en/html/commandline/ttssh.html	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/doc/en/html/commandline/ttssh.html	2010-03-10 15:27:58 UTC (rev 3808)
@@ -104,19 +104,18 @@
     '/auth=&lt;mode&gt;' means only authentication method
   </dd>
 
-  <dt id="ssh-l">/ssh-L&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;[:1]</dt>
-  <dd>port-fowarding from local port(&lt;port1&gt;) to remote side host(&lt;host&gt;) port(&lt;port2&gt;)<br>
-      if ':1' exists after the port number of remote side, this setting accepts connection from other hosts.</dd>
+  <dt id="ssh-l">/ssh-L[&lt;listen_addr&gt;:]&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;</dt>
+  <dd>port-fowarding from local listen-address(&lt;listen_addr&gt;) port(&lt;port1&gt;) to remote side host(&lt;host&gt;) port(&lt;port2&gt;)<br>
+      if &lt;listen_addr&gt; is omitted, it liste****@127*****.</dd>
 
-  <dt id="ssh-r">/ssh-R&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;</dt>
-  <dd>port-fowarding from remote port(&lt;port1&gt;) to local side host(&lt;host&gt;) port(&lt;port2&gt;)</dd>
+  <dt id="ssh-r">/ssh-R[&lt;listen_addr&gt;:]&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;</dt>
+  <dd>port-fowarding from remote listen-address(&lt;listen_addr&gt;) port(&lt;port1&gt;) to local side host(&lt;host&gt;) port(&lt;port2&gt;)<br>
+      if &lt;listen_addr&gt; is omitted, it liste****@127*****.<br>
+      &lt;listen_addr&gt; is not used with SSH1 protocol.</dd>
 
   <dt id="ssh-x">/ssh-X</dt>
   <dd>X11 port-fowarding</dd>
 
-  <dt id="ssh-acceptall">/ssh-acceptall</dt>
-  <dd>Local forward ports accept connections from other hosts</dd>
-
   <dt id="ssh-noagent">/ssh-A</dt>
   <dd>enable agent forwarding</dd>
 

Modified: trunk/doc/en/html/menu/setup-sshforward.html
===================================================================
--- trunk/doc/en/html/menu/setup-sshforward.html	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/doc/en/html/menu/setup-sshforward.html	2010-03-10 15:27:58 UTC (rev 3808)
@@ -32,11 +32,6 @@
       <dd>
         Remove a selected entry.
       </dd>
-
-      <dt>Local ports a&ccept connections from other hosts</dt>
-      <dd>
-        Changed for local port to accept a connection request from other hosts. Unless this setup is enabled, a setup for each port forwarding cannot be enabled.
-      </dd>
     </dl>
 
     <h3>X Forwarding</h3>
@@ -60,6 +55,11 @@
         Source port to forward of local side.
       </dd>
 
+      <dt>listen</dt>
+      <dd>
+        Listen address of local side. If omitted, 127.0.0.1 is used.
+      </dd>
+
       <dt>to remote machine</dt>
       <dd>
         Destination host name of remote side.
@@ -70,11 +70,6 @@
         Destination port number.
       <dd>
       </dd>
-
-      <dt>A&ccept connections from other hosts</dt>
-      <dd>
-        Changed for this port to accept a connection request from other hosts.
-      </dd>
     </dl>
 
     <h3>remote forwarding</h3>
@@ -84,6 +79,12 @@
         Source port to forward of remote side.
       </dd>
 
+      <dt>listen</dt>
+      <dd>
+        Listen address of remote side. If omitted, 127.0.0.1 is used.<br>
+        It is not used with SSH1 protocol.
+      </dd>
+
       <dt>to local machine</dt>
       <dd>
         Destination host name of local side.

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/doc/ja/html/about/history.html	2010-03-10 15:27:58 UTC (rev 3808)
@@ -47,11 +47,11 @@
     </ul>
   </li>
 
-  <!--li>‚»‚Ì‘¼
+  <li>‚»‚Ì‘¼
     <ul>
-      <li></li>
+      <li><a href="#ttssh_2.53">SSH2‘ΉžTTSSH(2.53)</a>‚֍·‚µ‘Ö‚¦‚½B</li>
     </ul>
-  </li-->
+  </li>
 
 </ul>
 
@@ -1456,6 +1456,30 @@
 
 <h2><a name="ttssh">TTSSH</a></h2>
 
+<h3><a name="ttssh_2.53">2010.3.10 (Ver 2.53 unreleased)</a></h3>
+<ul class="history">
+  <li>•ÏX
+    <ul>
+      <li>ƒ|[ƒg“]‘—‚ŃŠƒbƒXƒ“‚·‚éƒAƒhƒŒƒX‚ðŽw’è‚Å‚«‚é‚悤‚É‚µ‚½B
+        <ul>
+          <li>ƒ|[ƒg“]‘—‚Å‘¼‚̃zƒXƒg‚©‚ç‚̐ڑ±‚ðŽó‚¯“ü‚ê‚é‚©‚Ç‚¤‚©‚̐ݒè‚ðíœ‚µ‚½B</li>
+          <li><a href="../commandline/ttssh.html#ssh-l">ƒRƒ}ƒ“ƒhƒ‰ƒCƒ“ƒIƒvƒVƒ‡ƒ“</a>‚ð•ÏX‚µ‚½B</li>
+          <li><a href="../menu/setup-sshforward.html">Ý’èƒ_ƒCƒAƒƒO</a>‚ð•ÏX‚µ‚½B</li>
+        </ul></li>
+    </ul>
+  </li>
+
+  <!--li>ƒoƒOC³
+    <ul>
+    </ul>
+  </li-->
+
+  <!--li>‚»‚Ì‘¼
+    <ul>
+    </ul>
+  </li-->
+</ul>
+
 <h3><a name="ttssh_2.52">2009.11.10 (Ver 2.52)</a></h3>
 <ul class="history">
   <li>•ÏX

Modified: trunk/doc/ja/html/commandline/ttssh.html
===================================================================
--- trunk/doc/ja/html/commandline/ttssh.html	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/doc/ja/html/commandline/ttssh.html	2010-03-10 15:27:58 UTC (rev 3808)
@@ -104,19 +104,18 @@
     /auth=&lt;mode&gt; ‚́A”FØ•ûŽ®‚Ì‚Ý‚ðˆÓ–¡‚·‚é‚悤‚É‚È‚é
   </dd>
 
-  <dt id="ssh-l">/ssh-L&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;[:1]</dt>
-  <dd>ƒ[ƒJƒ‹ƒ|[ƒg(&lt;port1&gt;)‚©‚烊ƒ‚[ƒg‘¤ƒzƒXƒg(&lt;host&gt;)‚̃|[ƒg(&lt;port2&gt;)‚Öƒ|[ƒgƒtƒHƒ[ƒfƒBƒ“ƒO‚·‚é<br>
-      ƒŠƒ‚[ƒg‘¤‚̃|[ƒg”ԍ†‚Ì‚ ‚Æ‚É":1"‚ª‚ ‚éê‡A‚±‚Ì“]‘—Ý’è‚É‚¨‚¢‚Ä‘¼‚̃zƒXƒg‚©‚ç‚̐ڑ±‚ðŽó‚¯“ü‚ê‚é</dd>
+  <dt id="ssh-l">/ssh-L[&lt;listen_addr&gt;:]&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;</dt>
+  <dd>ƒ[ƒJƒ‹‚̃ŠƒbƒXƒ“ƒAƒhƒŒƒX(&lt;listen_addr&gt;)ƒ|[ƒg(&lt;port1&gt;)‚©‚烊ƒ‚[ƒg‘¤ƒzƒXƒg(&lt;host&gt;)‚̃|[ƒg(&lt;port2&gt;)‚Öƒ|[ƒgƒtƒHƒ[ƒfƒBƒ“ƒO‚·‚é<br>
+      &lt;listen_addr&gt;‚ðÈ—ª‚·‚é‚ƁA127.0.0.1‚ŃŠƒbƒXƒ“‚·‚é</dd>
 
-  <dt id="ssh-r">/ssh-R&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;</dt>
-  <dd>ƒŠƒ‚[ƒgƒ|[ƒg(&lt;port1&gt;)‚©‚烍[ƒJƒ‹‘¤ƒzƒXƒg(&lt;host&gt;)‚̃|[ƒg(&lt;port2&gt;)‚Öƒ|[ƒgƒtƒHƒ[ƒfƒBƒ“ƒO‚·‚é</dd>
+  <dt id="ssh-r">/ssh-R[&lt;listen_addr&gt;:]&lt;port1&gt;:&lt;host&gt;:&lt;port2&gt;</dt>
+  <dd>ƒŠƒ‚[ƒg‚̃ŠƒbƒXƒ“ƒAƒhƒŒƒX(&lt;listen_addr&gt;)ƒ|[ƒg(&lt;port1&gt;)‚©‚烍[ƒJƒ‹‘¤ƒzƒXƒg(&lt;host&gt;)‚̃|[ƒg(&lt;port2&gt;)‚Öƒ|[ƒgƒtƒHƒ[ƒfƒBƒ“ƒO‚·‚é<br>
+      &lt;listen_addr&gt;‚ðÈ—ª‚·‚é‚ƁA127.0.0.1‚ŃŠƒbƒXƒ“‚·‚é<br>
+      SSH1ƒvƒƒgƒRƒ‹‚Å‚Í&lt;listen_addr&gt;‚Í—˜—p‚³‚ê‚È‚¢</dd>
 
   <dt id="ssh-x">/ssh-X</dt>
   <dd>X11‚ðƒ|[ƒgƒtƒHƒ[ƒfƒBƒ“ƒO‚·‚é</dd>
 
-  <dt id="ssh-acceptall">/ssh-acceptall</dt>
-  <dd>ƒ[ƒJƒ‹‚Ì“]‘—ƒ|[ƒg‚́A‘¼‚̃zƒXƒg‚©‚ç‚̐ڑ±‚ðŽó‚¯“ü‚ê‚é</dd>
-
   <dt id="ssh-noagent">/ssh-A</dt>
   <dd>ƒG[ƒWƒFƒ“ƒg“]‘—‚ð—LŒø‚É‚·‚é</dd>
 

Modified: trunk/doc/ja/html/menu/setup-sshforward.html
===================================================================
--- trunk/doc/ja/html/menu/setup-sshforward.html	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/doc/ja/html/menu/setup-sshforward.html	2010-03-10 15:27:58 UTC (rev 3808)
@@ -33,11 +33,6 @@
       <dd>
         ‘I‘ð‚³‚ê‚½ Forwarding ‚̐ݒè‚ðíœ‚µ‚Ü‚·B
       </dd>
-
-      <dt>Local ports a&ccept connections from other hosts</dt>
-      <dd>
-        ƒ[ƒJƒ‹‚̃|[ƒg‚́A‘¼‚̃zƒXƒg‚©‚ç‚̐ڑ±‚ðŽó‚¯“ü‚ê‚éB‚±‚̐ݒ肪—LŒø‚Å‚È‚¢‚ƁAŠeƒ|[ƒg“]‘—‚²‚Ƃ̐ݒè‚à—LŒø‚É‚È‚ç‚È‚¢B
-      </dd>
     </dl>
 
     <h3>X Forwarding</h3>
@@ -61,6 +56,11 @@
         “]‘—‚·‚郍[ƒJƒ‹‘¤‚̃|[ƒg”ԍ†
       </dd>
 
+      <dt>listen</dt>
+      <dd>
+        ƒ[ƒJƒ‹‘¤‚̃ŠƒbƒXƒ“ƒAƒhƒŒƒXBÈ—ª‚·‚é‚Æ 127.0.0.1 ‚ªŽg‚í‚ê‚éB
+      </dd>
+
       <dt>to remote machine</dt>
       <dd>
         “]‘—æ‚̃zƒXƒg–¼
@@ -71,11 +71,6 @@
         “]‘—æ‚̃|[ƒg”ԍ†
       <dd>
       </dd>
-
-      <dt>A&ccept connections from other hosts</dt>
-      <dd>
-        ‘¼‚̃zƒXƒg‚©‚ç‚̐ڑ±‚ðŽó‚¯“ü‚ê‚éB
-      </dd>
     </dl>
 
     <h3>remote forwarding</h3>
@@ -85,6 +80,12 @@
         “]‘—‚·‚郊ƒ‚[ƒg‘¤‚̃|[ƒg”ԍ†
       </dd>
 
+      <dt>listen</dt>
+      <dd>
+        ƒŠƒ‚[ƒg‘¤‚̃ŠƒbƒXƒ“ƒAƒhƒŒƒXBÈ—ª‚·‚é‚Æ 127.0.0.1 ‚ªŽg‚í‚ê‚éB<br>
+        SSH1ƒvƒƒgƒRƒ‹‚Å‚Í—˜—p‚³‚ê‚È‚¢B
+      </dd>
+
       <dt>to local machine</dt>
       <dd>
         “]‘—æ‚̃zƒXƒg–¼

Modified: trunk/installer/release/TERATERM.INI
===================================================================
--- trunk/installer/release/TERATERM.INI	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/installer/release/TERATERM.INI	2010-03-10 15:27:58 UTC (rev 3808)
@@ -609,7 +609,6 @@
 ;   LOG_LEVEL_SSHDUMP    200
 LogLevel=0
 WriteBufferSize=2097152
-LocalForwardingIdentityCheck=1
 
 ; SSH protocol version (1 or 2)
 ProtocolVersion=2

Modified: trunk/installer/release/lang/English.lng
===================================================================
--- trunk/installer/release/lang/English.lng	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/installer/release/lang/English.lng	2010-03-10 15:27:58 UTC (rev 3808)
@@ -521,10 +521,12 @@
 DLG_FWD_TITLE=SSH Port Forwarding
 DLG_FWD_BANNER=Select direction for forwarded port:
 DLG_FWD_LOCAL_PORT=Forward &local port
+DLG_FWD_LOCAL_LISTEN=l&isten
 DLG_FWD_LOCAL_REMOTE=to remote &machine
 DLG_FWD_LOCAL_REMOTE_PORT=&port
 DLG_FWD_LOCAL_CHECKIDENTITY=A&ccept connections from other hosts
 DLG_FWD_REMOTE_PORT=Forward &remote server port
+DLG_FWD_REMOTE_LISTEN=li&sten
 DLG_FWD_REMOTE_LOCAL=to local m&achine
 DLG_FWD_REMOTE_LOCAL_PORT=p&ort
 

Modified: trunk/installer/release/lang/German.lng
===================================================================
--- trunk/installer/release/lang/German.lng	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/installer/release/lang/German.lng	2010-03-10 15:27:58 UTC (rev 3808)
@@ -519,10 +519,12 @@
 DLG_FWD_TITLE=SSH Port Forwarding
 DLG_FWD_BANNER=Wähle die Richtung des Portforwardings:
 DLG_FWD_LOCAL_PORT=Forward Local Port
+DLG_FWD_LOCAL_LISTEN=l&isten
 DLG_FWD_LOCAL_REMOTE=zur Remote Maschine
 DLG_FWD_LOCAL_REMOTE_PORT=Rem. Port
 DLG_FWD_LOCAL_CHECKIDENTITY=Akzeptiere Verbindungen von andern Hosts
 DLG_FWD_REMOTE_PORT=Forward Remote Port
+DLG_FWD_REMOTE_LISTEN=li&sten
 DLG_FWD_REMOTE_LOCAL=zur lokalen Maschine
 DLG_FWD_REMOTE_LOCAL_PORT=Lok. Port
 

Modified: trunk/installer/release/lang/Japanese.lng
===================================================================
--- trunk/installer/release/lang/Japanese.lng	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/installer/release/lang/Japanese.lng	2010-03-10 15:27:58 UTC (rev 3808)
@@ -521,10 +521,12 @@
 DLG_FWD_TITLE=SSHƒ|[ƒg“]‘—
 DLG_FWD_BANNER=ƒ|[ƒg“]‘—‚ðs‚¤Œü‚«‚Ì‘I‘ð:
 DLG_FWD_LOCAL_PORT=ƒ[ƒJƒ‹‚̃|[ƒg(&L)
+DLG_FWD_LOCAL_LISTEN=ƒŠƒbƒXƒ“(&I)
 DLG_FWD_LOCAL_REMOTE=ƒŠƒ‚[ƒg‘¤ƒzƒXƒg(&M)
 DLG_FWD_LOCAL_REMOTE_PORT=ƒ|[ƒg(&P)
 DLG_FWD_LOCAL_CHECKIDENTITY=‘¼‚̃zƒXƒg‚©‚ç‚̐ڑ±‚ðŽó‚¯“ü‚ê‚é(&C)
 DLG_FWD_REMOTE_PORT=ƒŠƒ‚[ƒgƒT[ƒo‚̃|[ƒg(&R)
+DLG_FWD_REMOTE_LISTEN=ƒŠƒbƒXƒ“(&S)
 DLG_FWD_REMOTE_LOCAL=ƒ[ƒJƒ‹‘¤ƒzƒXƒg(&A)
 DLG_FWD_REMOTE_LOCAL_PORT=ƒ|[ƒg(&O)
 

Modified: trunk/ttssh2/ttxssh/fwd.c
===================================================================
--- trunk/ttssh2/ttxssh/fwd.c	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/fwd.c	2010-03-10 15:27:58 UTC (rev 3808)
@@ -469,159 +469,6 @@
 	FWD_free_channel(pvar, channel_num);
 }
 
-static void init_local_IP_numbers(PTInstVar pvar)
-{
-#ifndef NO_INET6
-	struct addrinfo hints;
-	struct addrinfo FAR *res0;
-	struct addrinfo FAR *res;
-	char buf[1024];
-	int num_addrs = 0;
-	int i;
-	struct sockaddr_storage FAR *addrs;
-
-	if (!gethostname(buf, sizeof(buf))) {
-		memset(&hints, 0, sizeof(hints));
-		if (getaddrinfo(buf, NULL, &hints, &res0))
-			res0 = NULL;
-
-		/* count number of addresses */
-		for (res = res0; res; res = res->ai_next)
-			num_addrs++;
-	}
-
-	addrs =
-		(struct sockaddr_storage FAR *)
-		malloc(sizeof(struct sockaddr_storage) * (num_addrs + 1));
-	for (res = res0, i = 0; i < num_addrs; ++i, res = res->ai_next)
-		memcpy(&addrs[i], res->ai_addr, res->ai_addrlen);
-
-	pvar->fwd_state.local_host_IP_numbers = addrs;
-
-	/* terminated by all zero filled sockaddr_storage */
-	memset(&addrs[num_addrs], 0, sizeof(struct sockaddr_storage));
-#else
-	HOSTENT FAR *hostent;
-	char buf[1024];
-	int num_addrs = 0;
-	uint32 FAR *addrs;
-
-	if (!gethostname(buf, sizeof(buf))) {
-		hostent = gethostbyname(buf);
-
-		if (hostent != NULL) {
-			for (; hostent->h_addr_list[num_addrs] != NULL; num_addrs++) {
-			}
-		}
-	} else {
-		hostent = NULL;
-	}
-
-	addrs = (uint32 FAR *) malloc(sizeof(uint32) * (num_addrs + 1));
-	pvar->fwd_state.local_host_IP_numbers = addrs;
-	if (hostent != NULL) {
-		int i;
-
-		for (i = 0; i < num_addrs; i++) {
-			addrs[i] = ntohl(*(uint32 FAR *) hostent->h_addr_list[i]);
-		}
-	}
-	addrs[num_addrs] = 0;
-#endif							/* NO_INET6 */
-}
-
-#ifndef NO_INET6
-static BOOL validate_IP_number(PTInstVar pvar, struct sockaddr FAR * addr)
-{
-#else
-static BOOL validate_IP_number(PTInstVar pvar, uint32 addr)
-{
-#endif							/* NO_INET6 */
-#ifndef NO_INET6
-	int i;
-	struct sockaddr_storage zss;	/* all bytes are filled by zero */
-
-	/* Should we allow a wider range of loopback addresses here?
-	   i.e. 127.xx.xx.xx or ::1
-	   Wouldn't want to introduce a security hole if there's
-	   some OS bug that lets an intruder get packets from us
-	   to such an address */
-	switch (addr->sa_family) {
-	case AF_INET:
-		if (((struct sockaddr_in FAR *) addr)->sin_addr.s_addr ==
-			htonl(INADDR_LOOPBACK))
-			return TRUE;
-		break;
-	case AF_INET6:
-		if (IN6_IS_ADDR_LOOPBACK
-			(&(((struct sockaddr_in6 FAR *) addr)->sin6_addr)))
-			return TRUE;
-		break;
-	default:
-		/* NOT REACHED */
-		break;
-	}
-
-	if (pvar->fwd_state.local_host_IP_numbers == NULL) {
-		init_local_IP_numbers(pvar);
-	}
-
-	memset(&zss, 0, sizeof(zss));
-	for (i = 0;; i++) {
-		if (memcmp
-			(&pvar->fwd_state.local_host_IP_numbers[i], &zss,
-			 sizeof(struct sockaddr_storage)) == 0)
-			break;
-
-		switch (addr->sa_family) {
-		case AF_INET:
-			if (memcmp
-				(&pvar->fwd_state.local_host_IP_numbers[i], addr,
-				 sizeof(struct sockaddr_in)) == 0)
-				return TRUE;
-			break;
-		case AF_INET6:
-			if (memcmp
-				(&pvar->fwd_state.local_host_IP_numbers[i], addr,
-				 sizeof(struct sockaddr_in6)) == 0)
-				return TRUE;
-			break;
-		default:
-			/* NOT REACHED */
-			break;
-		}
-	}
-	return FALSE;
-#else
-	int i;
-
-	if (pvar->settings.LocalForwardingIdentityCheck) {
-		/* Should we allow a wider range of loopback addresses here?
-		   i.e. 127.xx.xx.xx
-		   Wouldn't want to introduce a security hole if there's
-		   some OS bug that lets an intruder get packets from us
-		   to such an address */
-		if (addr == INADDR_LOOPBACK) {
-			return TRUE;
-		}
-
-		if (pvar->fwd_state.local_host_IP_numbers == NULL) {
-			init_local_IP_numbers(pvar);
-		}
-
-		for (i = 0; pvar->fwd_state.local_host_IP_numbers[i] != 0; i++) {
-			if (pvar->fwd_state.local_host_IP_numbers[i] == addr) {
-				return TRUE;
-			}
-		}
-
-		return FALSE;
-	} else {
-		return TRUE;
-	}
-#endif							/* NO_INET6 */
-}
-
 static int alloc_channel(PTInstVar pvar, int new_status,
                          int new_request_num)
 {
@@ -838,42 +685,6 @@
 #endif
 
 #ifndef NO_INET6
-	is_localhost = validate_IP_number(pvar, (struct sockaddr FAR *) &addr);
-	if ((pvar->settings.LocalForwardingIdentityCheck && !is_localhost) ||
-	    (request->spec.check_identity && !is_localhost)) {
-		char hname[NI_MAXHOST];
-		if (getnameinfo((struct sockaddr FAR *) &addr, addrlen,
-		                hname, sizeof(hname), NULL, 0, NI_NUMERICHOST)) {
-			/* NOT REACHED */
-		}
-		UTIL_get_lang_msg("MSG_FWD_HOSTILE_ATTACK_ERROR", pvar,
-		                  "Host with IP number %s tried to connect to "
-		                  "forwarded local port %d.\n"
-		                  "This could be some kind of hostile attack.");
-		_snprintf_s(buf, sizeof(buf), _TRUNCATE,
-		            pvar->ts->UIMsg, hname,
-		            request->spec.from_port);
-		notify_nonfatal_error(pvar, buf);
-		safe_closesocket(pvar, s);
-		return;
-	}
-#else
-	if (!validate_IP_number
-		(pvar,
-		 ntohl(((struct sockaddr_in *) (&addr))->sin_addr.S_un.S_addr))) {
-		_snprintf(buf, sizeof(buf),
-		          "Host with IP number %d.%d.%d.%d tried to connect to "
-		          "forwarded local port %d.\n"
-		          "This could be some kind of hostile attack.", IP[0],
-		          IP[1], IP[2], IP[3], request->spec.from_port);
-		buf[NUM_ELEM(buf) - 1] = 0;
-		notify_nonfatal_error(pvar, buf);
-		safe_closesocket(pvar, s);
-		return;
-	}
-#endif							/* NO_INET6 */
-
-#ifndef NO_INET6
 	// SSH2 port-forwarding‚ɐڑ±Œ³‚̃Šƒ‚[ƒgƒ|[ƒg‚ª•K—vB(2005.2.27 yutaka)
 	if (getnameinfo
 	    ((struct sockaddr FAR *) &addr, addrlen, hname, sizeof(hname),
@@ -1179,6 +990,10 @@
 		delta = spec1->type - spec2->type;
 	}
 
+	if (delta == 0) {
+		delta = strcmp(spec1->bind_address, spec2->bind_address);
+	}
+
 	return delta;
 }
 
@@ -1194,7 +1009,8 @@
 	    && listener->from_port == spec->from_port
 	    && listener->to_port == spec->to_port
 	    && (spec->type == FWD_REMOTE_X11_TO_LOCAL
-	     || strcmp(listener->to_host, spec->to_host) == 0);
+	     || strcmp(listener->to_host, spec->to_host) == 0)
+	    && strcmp(listener->bind_address, spec->bind_address);
 }
 
 BOOL FWD_can_server_listen_for(PTInstVar pvar, FWDRequestSpec FAR * spec)
@@ -1307,7 +1123,7 @@
 	    && spec1->from_port == spec2->from_port
 	    && spec1->to_port == spec2->to_port
 	    && strcmp(spec1->to_host, spec2->to_host) == 0
-	    && spec1->check_identity == spec2->check_identity;
+	    && strcmp(spec1->bind_address, spec2->bind_address) == 0;
 }
 
 static BOOL interactive_init_request(PTInstVar pvar, int request_num,
@@ -1322,14 +1138,17 @@
 		struct addrinfo FAR *res0;
 		SOCKET s;
 		char pname[NI_MAXSERV];
+		char bname[NI_MAXHOST];
 
 		_snprintf_s(pname, sizeof(pname), _TRUNCATE,
 		            "%d", request->spec.from_port);
+		_snprintf_s(bname, sizeof(bname), _TRUNCATE,
+		            "%s", request->spec.bind_address);
 		memset(&hints, 0, sizeof(hints));
 		hints.ai_family = AF_UNSPEC;	/* a user will be able to specify protocol in future version */
 		hints.ai_flags = AI_PASSIVE;
 		hints.ai_socktype = SOCK_STREAM;
-		if (getaddrinfo(NULL, pname, &hints, &res0))
+		if (getaddrinfo(bname, pname, &hints, &res0))
 			return FALSE;
 
 		/* count number of listening sockets and allocate area for them */
@@ -1636,7 +1455,9 @@
 		if ((request->status & FWD_DELETED) == 0) {
 			switch (request->spec.type) {
 			case FWD_REMOTE_TO_LOCAL:
-				SSH_request_forwarding(pvar, request->spec.from_port,
+				SSH_request_forwarding(pvar,
+				                       request->spec.bind_address,
+				                       request->spec.from_port,
 				                       request->spec.to_host,
 				                       request->spec.to_port);
 				num_server_listening_requests++;

Modified: trunk/ttssh2/ttxssh/fwd.h
===================================================================
--- trunk/ttssh2/ttxssh/fwd.h	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/fwd.h	2010-03-10 15:27:58 UTC (rev 3808)
@@ -92,7 +92,7 @@
   int to_port;
   char to_port_name[32];
   char to_host[256];
-  BOOL check_identity;
+  char bind_address[256];
 } FWDRequestSpec;
 
 #define FWD_DELETED                      0x01

Modified: trunk/ttssh2/ttxssh/fwdui.c
===================================================================
--- trunk/ttssh2/ttxssh/fwdui.c	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/fwdui.c	2010-03-10 15:27:58 UTC (rev 3808)
@@ -386,7 +386,7 @@
 	    || ch == '_' || ch == '-' || (ch >= '0' && ch <= '9');
 }
 
-static int parse_port_from_buf(char FAR * buf)
+static int parse_port_from_buf(char * buf)
 {
 	int i;
 
@@ -421,13 +421,13 @@
 	}
 }
 
-static int parse_port(char FAR * FAR * str, char FAR * buf, int bufsize)
+static int parse_port(char *str, char *buf, int bufsize)
 {
 	int i = 0;
 
-	while (is_service_name_char(**str) && i < bufsize - 1) {
-		buf[i] = **str;
-		(*str)++;
+	while (is_service_name_char(*str) && i < bufsize - 1) {
+		buf[i] = *str;
+		str++;
 		i++;
 	}
 	buf[i] = 0;
@@ -435,65 +435,90 @@
 	return parse_port_from_buf(buf);
 }
 
-static BOOL parse_request(FWDRequestSpec FAR * request, char FAR * str, PTInstVar pvar)
+static BOOL parse_request(FWDRequestSpec *request, char *str, PTInstVar pvar)
 {
-	char FAR *host_start;
+	char *tmp, *ch;
+	int len, i, argc = 0, bracketed = 0;
+	char *argv[4];
 
-	if (str[0] == 'L' || str[0] == 'l') {
+	if ((tmp = strchr(str, ';')) != NULL) {
+		len = tmp - str;
+	}
+	else {
+		len = strlen(str);
+	}
+	tmp = _malloca(sizeof(char) * (len+1));
+	strncpy_s(tmp, sizeof(char) * (len+1), str, _TRUNCATE);
+
+	if (*tmp == 'L' || *tmp == 'l') {
 		request->type = FWD_LOCAL_TO_REMOTE;
-	} else if (str[0] == 'R' || str[0] == 'r') {
+	} else if (*tmp == 'R' || *tmp == 'r') {
 		request->type = FWD_REMOTE_TO_LOCAL;
-	} else if (str[0] == 'X' || str[0] == 'x') {
+	} else if (*tmp == 'X' || *tmp == 'x') {
 		make_X_forwarding_spec(request, pvar);
 		return TRUE;
 	} else {
 		return FALSE;
 	}
-	str++;
+	tmp++;
 
-	request->from_port =
-		parse_port(&str, request->from_port_name,
-		           sizeof(request->from_port_name));
-	if (request->from_port < 0) {
-		return FALSE;
+	argv[argc++] = tmp;
+	for (i=0; i<len; i++ ) {
+		ch = (tmp+i);
+		if (*ch == ':' && !bracketed) {
+			if (argc >= 4) {
+				argc++;
+				break;
+			}
+			*ch = '\0';
+			argv[argc++] = tmp+i+1;
+		}
+		else if (*ch == '[' && !bracketed) {
+			bracketed = 1;
+		}
+		else if (*ch == ']' && bracketed) {
+			bracketed = 0;
+		}
 	}
 
-	if (*str != ':') {
-		return FALSE;
-	}
-	str++;
+	strncpy_s(request->bind_address, sizeof(request->bind_address),
+	          "127.0.0.1", _TRUNCATE);
+	i=0;
+	switch (argc) {
+		case 4:
+			if (*argv[i] == '\0' || strcmp(argv[i], "*") == 0) {
+				strncpy_s(request->bind_address, sizeof(request->bind_address),
+				          "0.0.0.0", _TRUNCATE);
+			}
+			else {
+				strncpy_s(request->bind_address, sizeof(request->bind_address),
+				          argv[i], _TRUNCATE);
+			}
+			i++;
+			// don't break here
 
-	host_start = str;
-	while (*str != ':' && *str != 0 && *str != ';') {
-		str++;
-	}
-	if (*str != ':') {
-		return FALSE;
-	}
-	*str = 0;
-	strncpy_s(request->to_host, sizeof(request->to_host), host_start, _TRUNCATE);
-	request->to_host[sizeof(request->to_host) - 1] = 0;
-	*str = ':';
-	str++;
+		case 3:
+			request->from_port = parse_port(argv[i], request->from_port_name,
+			                                sizeof(request->from_port_name));
+			if (request->from_port < 0) {
+				return FALSE;
+			}
+			i++;
 
-	request->to_port =
-		parse_port(&str, request->to_port_name,
-		           sizeof(request->to_port_name));
-	if (request->to_port < 0) {
-		return FALSE;
-	}
+			strncpy_s(request->to_host, sizeof(request->to_host),
+			          argv[i], _TRUNCATE);
+			i++;
 
-	if (*str == ':') {
-		str++;
-		request->check_identity = TRUE;
-		if (*str == '1') {
-			request->check_identity = FALSE;
-			str++;
-		}
-	}
+			request->to_port = parse_port(argv[i], request->to_port_name,
+			                              sizeof(request->to_port_name));
+			if (request->to_port < 0) {
+				return FALSE;
+			}
 
-	if (*str != ';' && *str != 0) {
-		return FALSE;
+			break;
+
+		default:
+			return FALSE;
 	}
 
 	return TRUE;
@@ -527,13 +552,14 @@
 
 			switch (spec->type) {
 			case FWD_LOCAL_TO_REMOTE:
-				if (spec->check_identity == 0) {
-					_snprintf_s(str, str_remaining, _TRUNCATE, "L%s:%s:%s:1",
+				if (strcmp(spec->bind_address,"127.0.0.1") == 0) {
+					_snprintf_s(str, str_remaining, _TRUNCATE, "L%s:%s:%s",
 					            spec->from_port_name, spec->to_host,
 					            spec->to_port_name);
 				}
 				else {
-					_snprintf_s(str, str_remaining, _TRUNCATE, "L%s:%s:%s",
+					_snprintf_s(str, str_remaining, _TRUNCATE, "L%s:%s:%s:%s",
+					            spec->bind_address,
 					            spec->from_port_name, spec->to_host,
 					            spec->to_port_name);
 				}
@@ -643,15 +669,17 @@
 	switch (spec->type) {
 	case FWD_REMOTE_TO_LOCAL:
 		UTIL_get_lang_msg("MSG_FWD_REMOTE", pvar,
-		                  "Remote %s to local \"%s\" port %s");
+		                  "Remote %s:%s to local \"%s\" port %s");
 		_snprintf_s(buf, bufsize, _TRUNCATE, pvar->ts->UIMsg,
-		            verbose_from_port, spec->to_host, verbose_to_port);
+		            spec->bind_address, verbose_from_port,
+		            spec->to_host, verbose_to_port);
 		break;
 	case FWD_LOCAL_TO_REMOTE:
 		UTIL_get_lang_msg("MSG_FWD_LOCAL", pvar,
-		                  "Local %s to remote \"%s\" port %s");
+		                  "Local %s:%s to remote \"%s\" port %s");
 		_snprintf_s(buf, bufsize, _TRUNCATE, pvar->ts->UIMsg,
-		            verbose_from_port, spec->to_host, verbose_to_port);
+		            spec->bind_address, verbose_from_port,
+		            spec->to_host,verbose_to_port);
 		break;
 	case FWD_REMOTE_X11_TO_LOCAL:
 		UTIL_get_lang_msg("MSG_FWD_X", pvar,
@@ -723,9 +751,6 @@
 	GetDlgItemText(dlg, IDC_REMOVE, uimsg, sizeof(uimsg));
 	UTIL_get_lang_msg("DLG_FWDSETUP_REMOVE", pvar, uimsg);
 	SetDlgItemText(dlg, IDC_REMOVE, pvar->ts->UIMsg);
-	GetDlgItemText(dlg, IDC_CHECKIDENTITY, uimsg, sizeof(uimsg));
-	UTIL_get_lang_msg("DLG_FWDSETUP_CHECKIDENTITY", pvar, uimsg);
-	SetDlgItemText(dlg, IDC_CHECKIDENTITY, pvar->ts->UIMsg);
 	GetDlgItemText(dlg, IDC_XFORWARD, uimsg, sizeof(uimsg));
 	UTIL_get_lang_msg("DLD_FWDSETUP_X", pvar, uimsg);
 	SetDlgItemText(dlg, IDC_XFORWARD, pvar->ts->UIMsg);
@@ -749,10 +774,6 @@
 		}
 	}
 
-	if (!pvar->settings.LocalForwardingIdentityCheck) {
-		CheckDlgButton(dlg, IDC_CHECKIDENTITY, TRUE);
-	}
-
 	free(requests);
 
 	init_listbox_selection(dlg);
@@ -805,13 +826,6 @@
 		make_X_forwarding_spec(specs, pvar);
 	}
 
-	if (IsDlgButtonChecked(dlg, IDC_CHECKIDENTITY)) {
-		pvar->settings.LocalForwardingIdentityCheck = FALSE;
-	}
-	else {
-		pvar->settings.LocalForwardingIdentityCheck = TRUE;
-	}
-
 	qsort(specs, num_specs, sizeof(FWDRequestSpec), FWD_compare_specs);
 
 	buf[0] = '\0';
@@ -922,21 +936,14 @@
 		? FWD_REMOTE_TO_LOCAL : FWD_LOCAL_TO_REMOTE;
 
 	shift_over_input(dlg, type, IDC_SSHRTLFROMPORT, IDC_SSHLTRFROMPORT);
+	shift_over_input(dlg, type, IDC_SSHRTLLISTENADDR, IDC_SSHLTRLISTENADDR);
 	shift_over_input(dlg, type, IDC_SSHRTLTOHOST, IDC_SSHLTRTOHOST);
 	shift_over_input(dlg, type, IDC_SSHRTLTOPORT, IDC_SSHLTRTOPORT);
-
-	if (IsDlgButtonChecked(GetParent(dlg),IDC_CHECKIDENTITY)) {
-		if (type == FWD_LOCAL_TO_REMOTE) {
-			EnableWindow(GetDlgItem(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY), TRUE);
-		}
-		else {
-			EnableWindow(GetDlgItem(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY), FALSE);
-		}
-	}
 }
 
 static void setup_edit_controls(HWND dlg, FWDRequestSpec FAR * spec,
-                                WORD radio_item, WORD from_port_item,
+                                WORD radio_item,
+                                WORD from_port_item, WORD listen_address_item,
                                 WORD to_host_item, WORD to_port_item)
 {
 	CheckDlgButton(dlg, radio_item, TRUE);
@@ -946,6 +953,9 @@
 	if (strcmp(spec->to_host, "localhost") != 0) {
 		SetDlgItemText(dlg, to_host_item, spec->to_host);
 	}
+	if (strcmp(spec->bind_address, "127.0.0.1") != 0) {
+		SetDlgItemText(dlg, listen_address_item, spec->bind_address);
+	}
 
 	set_dir_options_status(dlg);
 }
@@ -963,18 +973,21 @@
 	GetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE, uimsg, sizeof(uimsg));
 	UTIL_get_lang_msg("DLG_FWD_LOCAL_PORT", pvar, uimsg);
 	SetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE, pvar->ts->UIMsg);
+	GetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_LISTEN, uimsg, sizeof(uimsg));
+	UTIL_get_lang_msg("DLG_FWD_LOCAL_LISTEN", pvar, uimsg);
+	SetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_LISTEN, pvar->ts->UIMsg);
 	GetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_HOST, uimsg, sizeof(uimsg));
 	UTIL_get_lang_msg("DLG_FWD_LOCAL_REMOTE", pvar, uimsg);
 	SetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_HOST, pvar->ts->UIMsg);
 	GetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_PORT, uimsg, sizeof(uimsg));
 	UTIL_get_lang_msg("DLG_FWD_LOCAL_REMOTE_PORT", pvar, uimsg);
 	SetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_PORT, pvar->ts->UIMsg);
-	GetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY, uimsg, sizeof(uimsg));
-	UTIL_get_lang_msg("DLG_FWD_LOCAL_CHECKIDENTITY", pvar, uimsg);
-	SetDlgItemText(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY, pvar->ts->UIMsg);
 	GetDlgItemText(dlg, IDC_SSHFWDREMOTETOLOCAL, uimsg, sizeof(uimsg));
 	UTIL_get_lang_msg("DLG_FWD_REMOTE_PORT", pvar, uimsg);
 	SetDlgItemText(dlg, IDC_SSHFWDREMOTETOLOCAL, pvar->ts->UIMsg);
+	GetDlgItemText(dlg, IDC_SSHFWDREMOTETOLOCAL_LISTEN, uimsg, sizeof(uimsg));
+	UTIL_get_lang_msg("DLG_FWD_REMOTE_LISTEN", pvar, uimsg);
+	SetDlgItemText(dlg, IDC_SSHFWDREMOTETOLOCAL_LISTEN, pvar->ts->UIMsg);
 	GetDlgItemText(dlg, IDC_SSHFWDREMOTETOLOCAL_HOST, uimsg, sizeof(uimsg));
 	UTIL_get_lang_msg("DLG_FWD_REMOTE_LOCAL", pvar, uimsg);
 	SetDlgItemText(dlg, IDC_SSHFWDREMOTETOLOCAL_HOST, pvar->ts->UIMsg);
@@ -991,24 +1004,16 @@
 	switch (spec->type) {
 	case FWD_REMOTE_TO_LOCAL:
 		setup_edit_controls(dlg, spec, IDC_SSHFWDREMOTETOLOCAL,
-		                    IDC_SSHRTLFROMPORT, IDC_SSHRTLTOHOST,
-		                    IDC_SSHRTLTOPORT);
+		                    IDC_SSHRTLFROMPORT, IDC_SSHRTLLISTENADDR,
+		                    IDC_SSHRTLTOHOST, IDC_SSHRTLTOPORT);
 		break;
 	case FWD_LOCAL_TO_REMOTE:
 		setup_edit_controls(dlg, spec, IDC_SSHFWDLOCALTOREMOTE,
-		                    IDC_SSHLTRFROMPORT, IDC_SSHLTRTOHOST,
-		                    IDC_SSHLTRTOPORT);
-		if (!spec->check_identity) {
-			CheckDlgButton(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY, TRUE);
-		}
+		                    IDC_SSHLTRFROMPORT, IDC_SSHLTRLISTENADDR,
+		                    IDC_SSHLTRTOHOST, IDC_SSHLTRTOPORT);
 		break;
 	}
 
-	if (!IsDlgButtonChecked(GetParent(dlg),IDC_CHECKIDENTITY)) {
-		CheckDlgButton(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY, FALSE);
-		EnableWindow(GetDlgItem(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY), FALSE);
-	}
-
 	fill_service_names(dlg, IDC_SSHRTLFROMPORT);
 	fill_service_names(dlg, IDC_SSHLTRFROMPORT);
 	fill_service_names(dlg, IDC_SSHRTLTOPORT);
@@ -1035,6 +1040,14 @@
 	grab_control_text(dlg, type, IDC_SSHRTLFROMPORT, IDC_SSHLTRFROMPORT,
 	                  new_spec.from_port_name,
 	                  sizeof(new_spec.from_port_name));
+	grab_control_text(dlg, type, IDC_SSHRTLLISTENADDR, IDC_SSHLTRLISTENADDR,
+	                  new_spec.bind_address, sizeof(new_spec.bind_address));
+	if (new_spec.bind_address[0] == 0) {
+		strncpy_s(new_spec.bind_address, sizeof(new_spec.bind_address), "127.0.0.1", _TRUNCATE);
+	}
+	else if (strcmp(new_spec.bind_address, "*") == 0 ) {
+		strncpy_s(new_spec.bind_address, sizeof(new_spec.bind_address), "0.0.0.0", _TRUNCATE);
+	}
 	grab_control_text(dlg, type, IDC_SSHRTLTOHOST, IDC_SSHLTRTOHOST,
 	                  new_spec.to_host, sizeof(new_spec.to_host));
 	if (new_spec.to_host[0] == 0) {
@@ -1066,13 +1079,6 @@
 		return FALSE;
 	}
 
-	new_spec.check_identity = TRUE;
-	if (type == FWD_LOCAL_TO_REMOTE) {
-		if (IsDlgButtonChecked(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY)) {
-			new_spec.check_identity = FALSE;
-		}
-	}
-
 	*spec = new_spec;
 
 	EndDialog(dlg, 1);
@@ -1102,14 +1108,15 @@
 			SendDlgItemMessage(dlg, IDC_SSHFWDLOCALTOREMOTE, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHFWDLOCALTOREMOTE_HOST, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHFWDLOCALTOREMOTE_PORT, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(dlg, IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHFWDREMOTETOLOCAL, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHFWDREMOTETOLOCAL_HOST, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHFWDREMOTETOLOCAL_PORT, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHLTRFROMPORT, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
+			SendDlgItemMessage(dlg, IDC_SSHLTRLISTENADDR, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHLTRTOHOST, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHLTRTOPORT, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHRTLFROMPORT, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
+			SendDlgItemMessage(dlg, IDC_SSHRTLLISTENADDR, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHRTLTOHOST, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHRTLTOPORT, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDOK, WM_SETFONT, (WPARAM)DlgFwdEditFont, MAKELPARAM(TRUE,0));
@@ -1163,9 +1170,9 @@
 
 	new_spec.type = FWD_LOCAL_TO_REMOTE;
 	new_spec.from_port_name[0] = 0;
+	new_spec.bind_address[0] = 0;
 	new_spec.to_host[0] = 0;
 	new_spec.to_port_name[0] = 0;
-	new_spec.check_identity = 1;
 
 	result = DialogBoxParam(hInst, MAKEINTRESOURCE(IDD_SSHFWDEDIT),
 	                        dlg, fwd_edit_dlg_proc, (LPARAM) & closure);
@@ -1254,7 +1261,6 @@
 			SendDlgItemMessage(dlg, IDC_ADD, WM_SETFONT, (WPARAM)DlgFwdFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_EDIT, WM_SETFONT, (WPARAM)DlgFwdFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_REMOVE, WM_SETFONT, (WPARAM)DlgFwdFont, MAKELPARAM(TRUE,0));
-			SendDlgItemMessage(dlg, IDC_CHECKIDENTITY, WM_SETFONT, (WPARAM)DlgFwdFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_XFORWARD, WM_SETFONT, (WPARAM)DlgFwdFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDC_SSHFWDX11, WM_SETFONT, (WPARAM)DlgFwdFont, MAKELPARAM(TRUE,0));
 			SendDlgItemMessage(dlg, IDOK, WM_SETFONT, (WPARAM)DlgFwdFont, MAKELPARAM(TRUE,0));

Modified: trunk/ttssh2/ttxssh/resource.h
===================================================================
--- trunk/ttssh2/ttxssh/resource.h	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/resource.h	2010-03-10 15:27:58 UTC (rev 3808)
@@ -61,7 +61,9 @@
 #define IDC_SSHRTLTOPORT                1043
 #define IDC_SSHFWDLOCALTOREMOTE         1044
 #define IDC_SSHPASSWORDCAPTION          1045
+#define IDC_SSHLTRLISTENADDR            1045
 #define IDC_HOSTTCPPROTOCOLLABEL        1046
+#define IDC_SSHRTLLISTENADDR            1046
 #define IDC_HOSTTCPPROTOCOL             1047
 #define IDC_COMBO1                      1049
 #define IDC_SSH_VERSION                 1049
@@ -119,7 +121,9 @@
 #define IDD_SSHFWD_BANNER               1084
 #define IDD_SSHFWDBANNER                1084
 #define IDC_WEBSITES                    1085
+#define IDC_SSHFWDLOCALTOREMOTE_LISTEN  1085
 #define IDC_INCLUDES                    1086
+#define IDC_SSHFWDREMOTETOLOCAL_LISTEN  1086
 #define IDC_CRYPTOGRAPHY                1087
 #define IDC_CREDIT                      1088
 #define IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY 1089

Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/ssh.c	2010-03-10 15:27:58 UTC (rev 3808)
@@ -3438,7 +3438,7 @@
 	}
 }
 
-void SSH_request_forwarding(PTInstVar pvar, int from_server_port,
+void SSH_request_forwarding(PTInstVar pvar, char FAR * bind_address, int from_server_port,
                             char FAR * to_local_host, int to_local_port)
 {
 	if (SSHv1(pvar)) {
@@ -3470,8 +3470,7 @@
 		s = "tcpip-forward";
 		buffer_put_string(msg, s, strlen(s)); // ctype
 		buffer_put_char(msg, 1);  // want reply
-		s = "0.0.0.0";
-		buffer_put_string(msg, s, strlen(s));
+		buffer_put_string(msg, bind_address, strlen(bind_address));
 
 		buffer_put_int(msg, from_server_port);  // listening port
 

Modified: trunk/ttssh2/ttxssh/ssh.h
===================================================================
--- trunk/ttssh2/ttxssh/ssh.h	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/ssh.h	2010-03-10 15:27:58 UTC (rev 3808)
@@ -504,8 +504,8 @@
 void SSH_confirm_channel_open(PTInstVar pvar, uint32 remote_channel_num, uint32 local_channel_num);
 void SSH_channel_output_eof(PTInstVar pvar, uint32 remote_channel_num);
 void SSH_channel_input_eof(PTInstVar pvar, uint32 remote_channel_num, uint32 local_channel_num);
-void SSH_request_forwarding(PTInstVar pvar, int from_server_port,
-  char FAR * to_local_host, int to_local_port);
+void SSH_request_forwarding(PTInstVar pvar, char FAR * bind_address, int from_server_port,
+                            char FAR * to_local_host, int to_local_port);
 void SSH_request_X11_forwarding(PTInstVar pvar,
   char FAR * auth_protocol, unsigned char FAR * auth_data, int auth_data_len, int screen_num);
 void SSH_open_channel(PTInstVar pvar, uint32 local_channel_num,

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2010-03-10 15:27:58 UTC (rev 3808)
@@ -339,9 +339,6 @@
 		settings->WriteBufferSize = (PACKET_MAX_SIZE / 2);   // 2MB
 	}
 
-	settings->LocalForwardingIdentityCheck =
-		read_BOOL_option(fileName, "LocalForwardingIdentityCheck", TRUE);
-
 	// SSH protocol version (2004.10.11 yutaka)
 	// default is SSH2 (2004.11.30 yutaka)
 	settings->ssh_protocol_version = GetPrivateProfileInt("TTSSH", "ProtocolVersion", 2, fileName);
@@ -412,10 +409,6 @@
 	_itoa(settings->WriteBufferSize, buf, 10);
 	WritePrivateProfileString("TTSSH", "WriteBufferSize", buf, fileName);
 
-	WritePrivateProfileString("TTSSH", "LocalForwardingIdentityCheck",
-	                          settings->LocalForwardingIdentityCheck ? "1" : "0",
-	                          fileName);
-
 	// SSH protocol version (2004.10.11 yutaka)
 	WritePrivateProfileString("TTSSH", "ProtocolVersion",
 	    settings->ssh_protocol_version==2 ? "2" : "1",
@@ -1523,9 +1516,6 @@
 			           _stricmp(option + 4, "-autologon") == 0) {
 				pvar->settings.TryDefaultAuth = TRUE;
 
-			} else if (_stricmp(option + 4, "-acceptall") == 0) {
-				pvar->settings.LocalForwardingIdentityCheck = FALSE;
-
 			// -axx‚æ‚èã‚É‚µ‚Ä‚Í‚¾‚ß
 			} else if (MATCH_STR(option + 4, "-a") == 0) {
 				pvar->settings.ForwardAgent = FALSE;

Modified: trunk/ttssh2/ttxssh/ttxssh.h
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.h	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/ttxssh.h	2010-03-10 15:27:58 UTC (rev 3808)
@@ -121,7 +121,6 @@
 
 	int LogLevel;      /* 0 = NONE, 100 = Verbose */
 	int WriteBufferSize;
-	int LocalForwardingIdentityCheck;
 
 	int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
 	int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)

Modified: trunk/ttssh2/ttxssh/ttxssh.rc
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.rc	2010-03-10 03:50:57 UTC (rev 3807)
+++ trunk/ttssh2/ttxssh/ttxssh.rc	2010-03-10 15:27:58 UTC (rev 3808)
@@ -228,50 +228,50 @@
     GROUPBOX        "",IDC_STATIC,6,162,296,25
 END
 
-IDD_SSHFWDSETUP DIALOGEX 0, 0, 309, 197
+IDD_SSHFWDSETUP DIALOGEX 0, 0, 309, 185
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "TTSSH: Forwarding Setup"
 FONT 8, "Tahoma", 400, 0, 0x0
 BEGIN
-    GROUPBOX        "&Port Forwarding",IDC_PORTFORWARD,6,7,296,132
+    GROUPBOX        "&Port Forwarding",IDC_PORTFORWARD,6,8,296,118
     LISTBOX         IDC_SSHFWDLIST,17,20,275,76,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
     PUSHBUTTON      "&Add...",IDC_ADD,63,105,50,14,WS_GROUP
     PUSHBUTTON      "&Edit...",IDC_EDIT,129,105,50,14
     PUSHBUTTON      "&Remove",IDC_REMOVE,195,105,50,14
-    CONTROL         "Local ports a&ccept connections from other hosts",IDC_CHECKIDENTITY,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,124,272,10
     CONTROL         "Display remote &X applications on local X server",IDC_SSHFWDX11,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,154,248,14
-    DEFPUSHBUTTON   "OK",IDOK,86,176,50,14,WS_GROUP
-    PUSHBUTTON      "Cancel",IDCANCEL,173,176,50,14
-    GROUPBOX        "X Forwarding",IDC_XFORWARD,6,144,296,27
+                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,139,274,14
+    DEFPUSHBUTTON   "OK",IDOK,86,164,50,14,WS_GROUP
+    PUSHBUTTON      "Cancel",IDCANCEL,173,164,50,14
+    GROUPBOX        "X Forwarding",IDC_XFORWARD,6,130,296,27
 END
 
-IDD_SSHFWDEDIT DIALOGEX 0, 0, 309, 156
+IDD_SSHFWDEDIT DIALOGEX 0, 0, 309, 143
 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
 CAPTION "SSH Port Forwarding"
 FONT 8, "Tahoma", 400, 0, 0x0
 BEGIN
     LTEXT           "Select direction for forwarded port:",IDD_SSHFWDBANNER,6,8,176,11,NOT WS_GROUP
     COMBOBOX        IDC_SSHLTRFROMPORT,122,31,56,126,CBS_DROPDOWN | WS_VSCROLL | WS_GROUP | WS_TABSTOP
+    RTEXT           "l&isten",IDC_SSHFWDLOCALTOREMOTE_LISTEN,184,32,32,11,NOT WS_GROUP
+    EDITTEXT        IDC_SSHLTRLISTENADDR,219,31,75,13,ES_AUTOHSCROLL
     LTEXT           "to remote &machine",IDC_SSHFWDLOCALTOREMOTE_HOST,23,48,73,15,NOT WS_GROUP
     EDITTEXT        IDC_SSHLTRTOHOST,98,48,80,13,ES_AUTOHSCROLL
     RTEXT           "&port",IDC_SSHFWDLOCALTOREMOTE_PORT,184,50,32,11,NOT WS_GROUP
     COMBOBOX        IDC_SSHLTRTOPORT,219,48,56,136,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
-    CONTROL         "A&ccept connections from other hosts",IDC_SSHFWDLOCALTOREMOTE_CHECKIDENTITY,
-                    "Button",BS_AUTOCHECKBOX | WS_TABSTOP,23,64,267,10
-    COMBOBOX        IDC_SSHRTLFROMPORT,122,90,56,135,CBS_DROPDOWN | WS_VSCROLL | WS_GROUP | WS_TABSTOP
-    LTEXT           "to local m&achine",IDC_SSHFWDREMOTETOLOCAL_HOST,23,108,73,15,NOT WS_GROUP
-    EDITTEXT        IDC_SSHRTLTOHOST,98,108,80,13,ES_AUTOHSCROLL
-    RTEXT           "p&ort",IDC_SSHFWDREMOTETOLOCAL_PORT,184,109,32,11,NOT WS_GROUP
-    COMBOBOX        IDC_SSHRTLTOPORT,219,108,56,124,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
-    DEFPUSHBUTTON   "OK",IDOK,96,135,50,14,WS_GROUP
-    PUSHBUTTON      "Cancel",IDCANCEL,162,135,50,14
-    GROUPBOX        "",IDC_STATIC,6,21,296,58
-    GROUPBOX        "",IDC_STATIC,6,81,296,46
+    COMBOBOX        IDC_SSHRTLFROMPORT,122,78,56,135,CBS_DROPDOWN | WS_VSCROLL | WS_GROUP | WS_TABSTOP
+    RTEXT           "li&sten",IDC_SSHFWDREMOTETOLOCAL_LISTEN,184,82,32,11,NOT WS_GROUP
+    EDITTEXT        IDC_SSHRTLLISTENADDR,219,79,75,13,ES_AUTOHSCROLL
+    LTEXT           "to local m&achine",IDC_SSHFWDREMOTETOLOCAL_HOST,23,97,73,15,NOT WS_GROUP
+    EDITTEXT        IDC_SSHRTLTOHOST,98,97,80,13,ES_AUTOHSCROLL
+    RTEXT           "p&ort",IDC_SSHFWDREMOTETOLOCAL_PORT,184,98,32,11,NOT WS_GROUP
+    COMBOBOX        IDC_SSHRTLTOPORT,219,97,56,124,CBS_DROPDOWN | WS_VSCROLL | WS_TABSTOP
+    DEFPUSHBUTTON   "OK",IDOK,96,122,50,14,WS_GROUP
+    PUSHBUTTON      "Cancel",IDCANCEL,162,122,50,14
+    GROUPBOX        "",IDC_STATIC,6,21,296,47
+    GROUPBOX        "",IDC_STATIC,6,70,296,46
     CONTROL         "Forward &local port",IDC_SSHFWDLOCALTOREMOTE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,13,32,108,10
     CONTROL         "Forward &remote server port",IDC_SSHFWDREMOTETOLOCAL,
-                    "Button",BS_AUTORADIOBUTTON,13,91,108,10
+                    "Button",BS_AUTORADIOBUTTON,13,80,108,10
 END
 
 IDD_SSHTISAUTH DIALOGEX 0, 0, 216, 109
@@ -407,7 +407,7 @@
         LEFTMARGIN, 6
         RIGHTMARGIN, 302
         TOPMARGIN, 7
-        BOTTOMMARGIN, 190
+        BOTTOMMARGIN, 178
     END
 
     IDD_SSHFWDEDIT, DIALOG
@@ -415,7 +415,7 @@
         LEFTMARGIN, 6
         RIGHTMARGIN, 302
         TOPMARGIN, 7
-        BOTTOMMARGIN, 149
+        BOTTOMMARGIN, 136
     END
 
     IDD_SSHTISAUTH, DIALOG



Ttssh2-commit メーリングリストの案内