[Ttssh2-commit] [4987] SSH RtoL forwarding をキャンセルする関数を追加

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2012年 8月 22日 (水) 20:01:59 JST


Revision: 4987
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/4987
Author:   maya
Date:     2012-08-22 20:01:58 +0900 (Wed, 22 Aug 2012)
Log Message:
-----------
SSH RtoL forwarding をキャンセルする関数を追加
  この関数を呼び出す部分は未実装

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/ssh.c
    trunk/ttssh2/ttxssh/ssh.h

-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2012-08-21 14:08:40 UTC (rev 4986)
+++ trunk/ttssh2/ttxssh/ssh.c	2012-08-22 11:01:58 UTC (rev 4987)
@@ -3535,6 +3535,36 @@
 	}
 }
 
+void SSH_cancel_request_forwarding(PTInstVar pvar, char FAR * bind_address, int from_server_port, int reply)
+{
+	if (SSHv2(pvar)) {
+		buffer_t *msg;
+		char *s;
+		unsigned char *outmsg;
+		int len;
+
+		msg = buffer_init();
+		if (msg == NULL) {
+			// TODO: error check
+			return;
+		}
+		s = "cancel-tcpip-forward";
+		buffer_put_string(msg, s, strlen(s)); // ctype
+		buffer_put_char(msg, reply);  // want reply
+		buffer_put_string(msg, bind_address, strlen(bind_address));
+
+		buffer_put_int(msg, from_server_port);  // listening port
+
+		len = buffer_len(msg);
+		outmsg = begin_send_packet(pvar, SSH2_MSG_GLOBAL_REQUEST, len);
+		memcpy(outmsg, buffer_ptr(msg), len);
+		finish_send_packet(pvar);
+		buffer_free(msg);
+
+		notify_verbose_message(pvar, "SSH2_MSG_GLOBAL_REQUEST was sent at SSH_cancel_request_forwarding().", LOG_LEVEL_VERBOSE);
+	}
+}
+
 void SSH_request_X11_forwarding(PTInstVar pvar,
                                 char FAR * auth_protocol,
                                 unsigned char FAR * auth_data,

Modified: trunk/ttssh2/ttxssh/ssh.h
===================================================================
--- trunk/ttssh2/ttxssh/ssh.h	2012-08-21 14:08:40 UTC (rev 4986)
+++ trunk/ttssh2/ttxssh/ssh.h	2012-08-22 11:01:58 UTC (rev 4987)
@@ -579,6 +579,7 @@
 void SSH_channel_input_eof(PTInstVar pvar, uint32 remote_channel_num, uint32 local_channel_num);
 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_cancel_request_forwarding(PTInstVar pvar, char FAR * bind_address, int from_server_port, int reply);
 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,



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