• R/O
  • SSH
  • HTTPS

ttssh2: Commit


Commit MetaInfo

Revision5422 (tree)
Time2013-11-21 23:24:32
Author(del#1144)

Log Message

SSH2 でポートフォワードを繰り返すと新たにポートフォワード接続できなくなる問題を修正

SSH_MSG_CHANNEL_CLOSE を受信したときに SSH_MSG_CHANNEL_CLOSE を送り返していなかった
http://sourceforge.jp/ticket/browse.php?group_id=1412&tid=32468

Change Summary

Incremental Difference

--- trunk/doc/en/html/about/history.html (revision 5421)
+++ trunk/doc/en/html/about/history.html (revision 5422)
@@ -61,6 +61,7 @@
6161
6262 <li>Misc
6363 <ul>
64+ <li>upgraded TTSSH to <a href="#ttssh_2.67">2.67</a></li>
6465 <li>upgraded TTXRecurringCommand Plugin to <a href="#recurringcommand_1.03">1.03</a></li>
6566 <li>added support for Microsoft Windows 8.1.</li>
6667 <li>upgraded Oniguruma to 5.9.5.</li>
@@ -2335,6 +2336,15 @@
23352336
23362337 <h2><a name="ttssh">TTSSH</a></h2>
23372338
2339+<h3><a name="ttssh_2.67">2013.xx.xx (Ver 2.67)</a></h3>
2340+<ul class="history">
2341+ <li>Bug fixes
2342+ <ul>
2343+ <!--li>SSH2 でポートフォワードを繰り返すと新たにポートフォワード接続できなくなる問題を修正した。</li-->
2344+ </ul>
2345+ </li>
2346+</ul>
2347+
23382348 <h3><a name="ttssh_2.66">2013.09.01 (Ver 2.66)</a></h3>
23392349 <ul class="history">
23402350 <li>Changes
--- trunk/doc/ja/html/about/history.html (revision 5421)
+++ trunk/doc/ja/html/about/history.html (revision 5422)
@@ -61,6 +61,7 @@
6161
6262 <li>その他
6363 <ul>
64+ <li><a href="#ttssh_2.67">TTSSH(2.67)</a>へ差し替えた。</li>
6465 <li><a href="#recurringcommand_1.03">TTXRecurringCommand Plugin(1.03)</a>へ差し替えた。</li>
6566 <li>対応する動作環境にWindows 8.1を追加した。</li>
6667 <li>Oniguruma 5.9.5へ差し替えた</li>
@@ -2340,6 +2341,15 @@
23402341
23412342 <h2><a name="ttssh">TTSSH</a></h2>
23422343
2344+<h3><a name="ttssh_2.67">2013.xx.xx (Ver 2.67)</a></h3>
2345+<ul class="history">
2346+ <li>バグ修正
2347+ <ul>
2348+ <li>SSH2 でポートフォワードを繰り返すと新たにポートフォワード接続できなくなる問題を修正した。</li>
2349+ </ul>
2350+ </li>
2351+</ul>
2352+
23432353 <h3><a name="ttssh_2.66">2013.09.01 (Ver 2.66)</a></h3>
23442354 <ul class="history">
23452355 <li>変更
--- trunk/ttssh2/ttxssh/ssh.h (revision 5421)
+++ trunk/ttssh2/ttxssh/ssh.h (revision 5422)
@@ -697,6 +697,8 @@
697697 buffer_t *agent_msg;
698698 int agent_request_len;
699699 sftp_t sftp;
700+#define SSH_CHANNEL_STATE_CLOSE_SENT 0x00000001
701+ unsigned int state;
700702 } Channel_t;
701703
702704 unsigned char FAR *begin_send_packet(PTInstVar pvar, int type, int len);
--- trunk/ttssh2/ttxssh/ssh.c (revision 5421)
+++ trunk/ttssh2/ttxssh/ssh.c (revision 5422)
@@ -164,6 +164,7 @@
164164 c->agent_msg = buffer_init();
165165 c->agent_request_len = 0;
166166 }
167+ c->state = 0;
167168
168169 return (c);
169170 }
@@ -2742,6 +2743,8 @@
27422743 finish_send_packet(pvar);
27432744 buffer_free(msg);
27442745
2746+ c->state |= SSH_CHANNEL_STATE_CLOSE_SENT;
2747+
27452748 notify_verbose_message(pvar, "SSH2_MSG_CHANNEL_CLOSE was sent at SSH_notify_disconnecting().", LOG_LEVEL_VERBOSE);
27462749 }
27472750
@@ -7540,6 +7543,11 @@
75407543 int len;
75417544 char log[128];
75427545
7546+ // このchannelについてcloseを送信済みなら送らない
7547+ if (c->state & SSH_CHANNEL_STATE_CLOSE_SENT) {
7548+ return;
7549+ }
7550+
75437551 // SSH2 serverにchannel closeを伝える
75447552 msg = buffer_init();
75457553 if (msg == NULL) {
@@ -7554,6 +7562,8 @@
75547562 finish_send_packet(pvar);
75557563 buffer_free(msg);
75567564
7565+ c->state |= SSH_CHANNEL_STATE_CLOSE_SENT;
7566+
75577567 _snprintf_s(log, sizeof(log), _TRUNCATE, "SSH2_MSG_CHANNEL_CLOSE was sent at ssh2_channel_send_close(). local:%d remote:%d", c->self_id, c->remote_id);
75587568 notify_verbose_message(pvar, log, LOG_LEVEL_VERBOSE);
75597569 }
@@ -8491,6 +8501,10 @@
84918501 notify_closed_connection(pvar);
84928502
84938503 } else if (c->type == TYPE_PORTFWD) {
8504+ // CHANNEL_CLOSE を送り返さないとリモートのchannelが開放されない
8505+ // c.f. RFC 4253 5.3. Closing a Channel
8506+ ssh2_channel_send_close(pvar, c);
8507+
84948508 // 転送チャネル内にあるソケットの解放漏れを修正 (2007.7.26 maya)
84958509 FWD_free_channel(pvar, c->local_num);
84968510
@@ -8503,7 +8517,7 @@
85038517 } else if (c->type == TYPE_AGENT) {
85048518 ssh2_channel_delete(c);
85058519
8506- } else { // TYPE_PORTFWD
8520+ } else {
85078521 ssh2_channel_delete(c);
85088522
85098523 }
Show on old repository browser