[Ttssh2-commit] [6843] 転送タイプの識別を FWD_can_server_listen_for () 内部に移動。

svnno****@sourc***** svnno****@sourc*****
2017年 7月 5日 (水) 00:02:48 JST


Revision: 6843
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/6843
Author:   doda
Date:     2017-07-05 00:02:48 +0900 (Wed, 05 Jul 2017)
Log Message:
-----------
転送タイプの識別を FWD_can_server_listen_for() 内部に移動。

転送タイプの判断の条件変更を一箇所で行えるようにするため。

Modified Paths:
--------------
    trunk/ttssh2/ttxssh/fwd.c
    trunk/ttssh2/ttxssh/fwd.h
    trunk/ttssh2/ttxssh/fwdui.c

-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/fwd.c
===================================================================
--- trunk/ttssh2/ttxssh/fwd.c	2017-07-04 15:02:44 UTC (rev 6842)
+++ trunk/ttssh2/ttxssh/fwd.c	2017-07-04 15:02:48 UTC (rev 6843)
@@ -890,15 +890,28 @@
 	     || strcmp(listener->bind_address, spec->bind_address) == 0);
 }
 
+/*
+ * \x83|\x81[\x83g\x93]\x91\x97\x82\xF0\x97L\x8C\xF8\x82ɏo\x97\x88\x82邩\x82̔\xBB\x92\xE8\x8A֐\x94\x81B
+ * shell / subsystem \x8AJ\x8En\x91O\x82͂\xB7\x82ׂėL\x8C\xF8\x82ɂł\xAB\x82\xE9 (TRUE\x82\xF0\x95Ԃ\xB7)\x81B
+ * \x8AJ\x8En\x8C\xE3\x82͈ȉ\xBA\x82̓]\x91\x97\x83^\x83C\x83v\x82͒lj\xC1\x95s\x89\xC2 (\x8AJ\x8En\x8Dς݂̂\xDDTRUE\x82\xF0\x95Ԃ\xB7)
+ * - RtoL\x93]\x91\x97
+ * - X11\x93]\x91\x97
+ */
 BOOL FWD_can_server_listen_for(PTInstVar pvar, FWDRequestSpec *spec)
 {
+	FWDRequestSpec *listener;
 	int num_server_listening_requests =
 		pvar->fwd_state.num_server_listening_specs;
 
 	if (num_server_listening_requests < 0) {
 		return TRUE;
-	} else {
-		FWDRequestSpec *listener =
+	}
+
+	switch (spec->type) {
+	case FWD_LOCAL_TO_REMOTE:
+		return TRUE;
+	default:
+		listener =
 			bsearch(spec, pvar->fwd_state.server_listening_specs,
 			        num_server_listening_requests,
 			        sizeof(FWDRequestSpec), FWD_compare_specs);

Modified: trunk/ttssh2/ttxssh/fwd.h
===================================================================
--- trunk/ttssh2/ttxssh/fwd.h	2017-07-04 15:02:44 UTC (rev 6842)
+++ trunk/ttssh2/ttxssh/fwd.h	2017-07-04 15:02:48 UTC (rev 6843)
@@ -127,10 +127,6 @@
 } FWDState;
 
 void FWD_init(PTInstVar pvar);
-/* This function checks to see whether the server is (or can) listen for a
-   given request. Before the SSH session's prep phase, this returns true for
-   all requests. After the SSH session's prep phase, this returns true only
-   for requests that the server actually was told about during the prep phase. */
 BOOL FWD_can_server_listen_for(PTInstVar pvar, FWDRequestSpec *spec);
 int FWD_get_num_request_specs(PTInstVar pvar);
 void FWD_get_request_specs(PTInstVar pvar, FWDRequestSpec *specs, int num_specs);

Modified: trunk/ttssh2/ttxssh/fwdui.c
===================================================================
--- trunk/ttssh2/ttxssh/fwdui.c	2017-07-04 15:02:44 UTC (rev 6842)
+++ trunk/ttssh2/ttxssh/fwdui.c	2017-07-04 15:02:48 UTC (rev 6843)
@@ -939,8 +939,7 @@
 			return FALSE;
 		}
 
-		if (specs[i].type != FWD_LOCAL_TO_REMOTE
-			&& !FWD_can_server_listen_for(pvar, specs + i)) {
+		if (!FWD_can_server_listen_for(pvar, specs + i)) {
 			num_unspecified_forwardings++;
 		}
 	}
@@ -951,8 +950,7 @@
 		strncat_s(buf, sizeof(buf), pvar->ts->UIMsg, _TRUNCATE);
 
 		for (i = 0; i < num_specs; i++) {
-			if (specs[i].type != FWD_LOCAL_TO_REMOTE &&
-			    !FWD_can_server_listen_for(pvar, specs + i)) {
+			if (!FWD_can_server_listen_for(pvar, specs + i)) {
 				char buf2[1024];
 
 				get_spec_string(specs + i, buf2, sizeof(buf2), pvar);



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