[Ttssh2-commit] [8013] SOCKS4/5とネゴシエーション(の一部)が失敗した場合、メッセージボックスに表示する

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2019年 8月 24日 (土) 18:35:27 JST


Revision: 8013
          https://osdn.net/projects/ttssh2/scm/svn/commits/8013
Author:   yutakapon
Date:     2019-08-24 18:35:26 +0900 (Sat, 24 Aug 2019)
Log Message:
-----------
SOCKS4/5とネゴシエーション(の一部)が失敗した場合、メッセージボックスに表示する
メッセージにエラー情報を追加した。
言語ファイルをすべて修正するのは影響大なので、末尾に追記するようにした。

Modified Paths:
--------------
    trunk/TTProxy/ProxyWSockHook.h
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html

-------------- next part --------------
Modified: trunk/TTProxy/ProxyWSockHook.h
===================================================================
--- trunk/TTProxy/ProxyWSockHook.h	2019-08-24 04:38:27 UTC (rev 8012)
+++ trunk/TTProxy/ProxyWSockHook.h	2019-08-24 09:35:26 UTC (rev 8013)
@@ -1528,10 +1528,37 @@
             return SOCKET_ERROR;
         if (recieveFromSocket(s, buf, 4) == SOCKET_ERROR)
             return SOCKET_ERROR;
+		/* SOCKS\x83\x8A\x83N\x83G\x83X\x83g\x82ɑ΂\xB7\x82郊\x83v\x83\x89\x83C
+		   
+		   buf[0] VER  protocol version: X'05'
+		   buf[1] REP  Reply field: 
+ 				 o  X'00' succeeded
+				 o  X'01' general SOCKS server failure
+				 o  X'02' connection not allowed by ruleset
+				 o  X'03' Network unreachable
+				 o  X'04' Host unreachable
+				 o  X'05' Connection refused
+				 o  X'06' TTL expired
+				 o  X'07' Command not supported
+				 o  X'08' Address type not supported
+				 o  X'09' to X'FF' unassigned
+		   buf[2] RSV    RESERVED: X'00'
+		   buf[3] ATYP   address type of following address
+				 o  IP V4 address: X'01'
+				 o  DOMAINNAME: X'03'
+				 o  IP V6 address: X'04'
+		   buf[4:N] BND.ADDR       server bound address
+		   buf[N+1] BND.PORT       server bound port in network octet order 
+		 */
         if (buf[0] != SOCKS5_VERSION || buf[1] != SOCKS5_REP_SUCCEEDED) {   /* check reply code */
-            UTIL_get_lang_msg("MSG_PROXY_BAD_REQUEST", uimsg, sizeof(uimsg),
+			char tmp[MAX_UIMSG + 32];
+
+			UTIL_get_lang_msg("MSG_PROXY_BAD_REQUEST", uimsg, sizeof(uimsg),
                               "Proxy prevent this connection!");
-            return setError(s, uimsg);
+			// \x83\x8A\x83v\x83\x89\x83C\x8F\xEE\x95\xF1\x82\xF0\x92NjL\x82\xB5\x82ă\x81\x83b\x83Z\x81[\x83W\x95\\x8E\xA6\x82\xB7\x82\xE9\x81B
+			_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%s(SOCKS5:VER %u REP %u ATYP %u)", 
+				uimsg, buf[0], buf[1], buf[3]);
+			return setError(s, tmp);
         }
         // buf[2] is reserved
         switch (buf[3]) { /* case by ATYP */
@@ -1627,6 +1654,19 @@
         if (recieveFromSocket(s, buf, 8) == SOCKET_ERROR) {
             return SOCKET_ERROR;
         }
+		/* SOCKS4\x82̕ԓ\x9A\x83p\x83P\x83b\x83g
+		 
+		  buf[0] VN \x8F\xED\x82\xC90
+		  buf[1] CD
+		           90 request granted
+		           91 request rejected or failed
+		           92 request rejected becasue SOCKS server cannot connect to
+	                  identd on the client
+				   93 request rejected because the client program and identd
+	                  report different user-ids
+		  buf[2:3] DSTPORT \x83|\x81[\x83g\x94ԍ\x86
+		  buf[4:7] DSTIP   IP\x83A\x83h\x83\x8C\x83X
+		 */
         char uimsg[MAX_UIMSG];
         uimsg[0] = NULL;
         if (buf[0] != 0) {
@@ -1640,7 +1680,11 @@
                               "Proxy prevent this connection!");
         }
         if (uimsg[0] != NULL) {
-            return setError(s, uimsg);
+			char tmp[MAX_UIMSG + 32];
+
+			// SOCKS\x82̕ԓ\x9A\x83p\x83P\x83b\x83g\x82\xCCVN\x82\xC6CD\x82\xF0\x92NjL\x82\xB5\x82ă\x81\x83b\x83Z\x81[\x83W\x95\\x8E\xA6\x82\xB7\x82\xE9\x81B
+			_snprintf_s(tmp, sizeof(tmp), _TRUNCATE, "%s(SOCKS4:VN %u CD %u)", uimsg, buf[0], buf[1]);
+            return setError(s, tmp);
         }
     
         /* Conguraturation, connected via SOCKS4 server! */

Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2019-08-24 04:38:27 UTC (rev 8012)
+++ trunk/doc/en/html/about/history.html	2019-08-24 09:35:26 UTC (rev 8013)
@@ -4791,9 +4791,19 @@
 
 <h3 id="ttproxy_1.0.0.25">2019.xx.xx (Ver 1.0.0.25)</h3>
 <ul class="history">
+  <li>Changes
+    <ul>
+      <li>When the negotiation is failed with SOCKS4 and 5, an error information is added to message.</li>
+    </ul>
+  </li>
+  
+  <li>Bug fixes
+    <ul>
       <li>Bug fix: Depending on OS, it's not working correctly. This bug was introduced in 4.103.</li>
       <li>Bug fix: When the hostname setting is domain, IPv6 and IPv4 faullback does not work well. And also, when you can not connect to the proxy server, Connection refused dialog is shown three times in a row.</li>
       <li>Bug fix: When data can not receive from SOCKS server during negotiation with SOCKS4 and 5, the data may not be handled as an error.</li>
+    </ul>
+  </li>
 </ul>
 
 <h3 id="ttproxy_1.0.0.24">2016.11.30 (Ver 1.0.0.24)</h3>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2019-08-24 04:38:27 UTC (rev 8012)
+++ trunk/doc/ja/html/about/history.html	2019-08-24 09:35:26 UTC (rev 8013)
@@ -4796,9 +4796,19 @@
 
 <h3 id="ttproxy_1.0.0.25">2019.xx.xx (Ver 1.0.0.25)</h3>
 <ul class="history">
+  <li>\x95ύX
+    <ul>
+      <li>SOCKS4/5\x82ƃl\x83S\x83V\x83G\x81[\x83V\x83\x87\x83\x93\x82\xAA\x8E\xB8\x94s\x82\xB5\x82\xBD\x8Fꍇ\x81A\x83G\x83\x89\x81[\x8F\xEE\x95\xF1\x82\xF0\x83\x81\x83b\x83Z\x81[\x83W\x82ɒlj\xC1\x82\xB5\x82\xBD\x81B</li>
+    </ul>
+  </li>
+  
+  <li>\x83o\x83O\x8FC\x90\xB3
+    <ul>
       <li>OS\x82ɂ\xE6\x82\xC1\x82Đ\xB3\x82\xB5\x82\xAD\x93\xAE\x8D삵\x82Ȃ\xA2\x95s\x8B\x82\xF0\x8FC\x90\xB3\x81B<a href="#teraterm_4.103">teraterm 4.103</a>\x82ł̃G\x83\x93\x83o\x83O\x81B</li>
       <li>\x83z\x83X\x83g\x96\xBC\x82̐ݒ肪\x83h\x83\x81\x83C\x83\x93\x82̏ꍇ\x82ɂ\xA8\x82\xA2\x82āAIPv6/IPv4\x83t\x83H\x81[\x83\x8B\x83o\x83b\x83N\x82\xAA\x93\xAE\x8D삵\x82Ȃ\xA2\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B\x82\xA9\x82A\x83v\x83\x8D\x83L\x83V\x83T\x81[\x83o\x82ɐڑ\xB1\x82ł\xAB\x82Ȃ\xA2\x8Fꍇ\x81AConnection refused\x83_\x83C\x83A\x83\x8D\x83O\x82\xAA3\x89\xF1\x98A\x91\xB1\x95\\x8E\xA6\x82\xB3\x82\xEA\x82\xE9\x96\xE2\x91\xE8\x82\xE0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B</li>
       <li>SOCKS4/5\x82ƃl\x83S\x83V\x83G\x81[\x83V\x83\x87\x83\x93\x92\x86\x82ɁASOCKS\x83T\x81[\x83o\x82\xA9\x82\xE7\x83f\x81[\x83^\x8E\xF3\x90M\x82ł\xAB\x82Ȃ\xA2\x8Fꍇ\x81A\x83G\x83\x89\x81[\x88\xB5\x82\xA2\x82ɂł\xAB\x82Ă\xA2\x82Ȃ\xA2\x82\xB1\x82Ƃ\xAA\x82\xA0\x82\xE9\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B</li>
+    </ul>
+  </li>
 </ul>
 
 <h3 id="ttproxy_1.0.0.24">2016.11.30 (Ver 1.0.0.24)</h3>


Ttssh2-commit メーリングリストの案内
Back to archive index