[Ttssh2-commit] [4690] スクリーン番号としてディスプレイ番号を使っていたのを修正。

svnno****@sourc***** svnno****@sourc*****
2011年 10月 27日 (木) 23:59:30 JST


Revision: 4690
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4690
Author:   doda
Date:     2011-10-27 23:59:30 +0900 (Thu, 27 Oct 2011)

Log Message:
-----------
スクリーン番号としてディスプレイ番号を使っていたのを修正。

Modified Paths:
--------------
    trunk/installer/release/lang/English.lng
    trunk/installer/release/lang/French.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/x11util.c
    trunk/ttssh2/ttxssh/x11util.h


-------------- next part --------------
Modified: trunk/installer/release/lang/English.lng
===================================================================
--- trunk/installer/release/lang/English.lng	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/installer/release/lang/English.lng	2011-10-27 14:59:30 UTC (rev 4690)
@@ -565,7 +565,7 @@
 DLG_FWDSETUP_XAPP=Display remote &X applications on local X server
 
 MSG_FWD_REMOTE_XSERVER=remote X server
-MSG_FWD_REMOTE_XSCREEN=X server (screen %d)
+MSG_FWD_REMOTE_XSCREEN=X server (display %d:%d)
 MSG_FWD_REMOTE=Remote "%s" port %s to local "%s" port %s
 MSG_FWD_LOCAL=Local "%s" port %s to remote "%s" port %s
 MSG_FWD_X=Remote X applications to local X server
@@ -693,7 +693,7 @@
 MSG_FWD_ADDRNOTFOUTD_ERROR=No address was found for the machine
 MSG_FWD_CONNECT_ERROR=The forwarding connection could not be established
 MSG_FWD_CHANNEL_ERROR=Communications error %s forwarded local %s.\n%s (code %d).\nThe forwarded connection will be closed.
-MSG_FWD_CHANNEL_OPEN_X_ERROR=The server attempted to forward a connection through this machine.\nIt requested a connection to the X server on %s (screen %d).\n%s.\nThe forwarded connection will be closed.
+MSG_FWD_CHANNEL_OPEN_X_ERROR=The server attempted to forward a connection through this machine.\nIt requested a connection to the X server on %s (display %d:%d).\n%s.\nThe forwarded connection will be closed.
 MSG_FWD_CHANNEL_OPEN_ERROR=The server attempted to forward a connection through this machine.\nIt requested a connection to %s (port %s).\n%s.\nThe forwarded connection will be closed.
 DLG_FWDMON_TITLE=TTSSH Port Forwarding Monitor
 MSG_FWD_HOSTILE_ATTACK_ERROR=Host with IP number %s tried to connect to forwarded local port %d.\nThis could be some kind of hostile attack.

Modified: trunk/installer/release/lang/French.lng
===================================================================
--- trunk/installer/release/lang/French.lng	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/installer/release/lang/French.lng	2011-10-27 14:59:30 UTC (rev 4690)
@@ -564,7 +564,7 @@
 DLG_FWDSETUP_XAPP=Afficher les applis distantes sur les serveur X local
 
 MSG_FWD_REMOTE_XSERVER=serveur X distant
-MSG_FWD_REMOTE_XSCREEN=serveur X (screen %d)
+MSG_FWD_REMOTE_XSCREEN=serveur X (display %d:%d)
 MSG_FWD_REMOTE=Distant "%s"  port %s au Local "%s" port %s
 MSG_FWD_LOCAL=Local "%s" port %s à Distant "%s" port %s
 MSG_FWD_X=Applications X distantes au serveur X local
@@ -685,7 +685,7 @@
 MSG_FWD_ADDRNOTFOUTD_ERROR=Pas d'adresse trouvée pour la machine
 MSG_FWD_CONNECT_ERROR=La connexion n'a pas pu être établie
 MSG_FWD_CHANNEL_ERROR=Erreur de communication %s redirigé en local %s.\n%s (code %d).\nLa connexion redirigée va être fermée.
-MSG_FWD_CHANNEL_OPEN_X_ERROR=Le serveur a essayé de rediriger une connexion à travers cette machine.\nIl a demandé une connexion au serveur X sur %s (screen %d).\n%s.\nLa connection redirigée va être fermée.
+MSG_FWD_CHANNEL_OPEN_X_ERROR=Le serveur a essayé de rediriger une connexion à travers cette machine.\nIl a demandé une connexion au serveur X sur %s (display %d:%d).\n%s.\nLa connection redirigée va être fermée.
 MSG_FWD_CHANNEL_OPEN_ERROR=Le serveur a essayé de rediriger une connexion à travers cette machine.\nIl a demandé une connexion sur %s (port %s).\n%s.\nLa connection redirigée va être fermée.
 DLG_FWDMON_TITLE=Moniteur de redirection de port TTSSH
 MSG_FWD_HOSTILE_ATTACK_ERROR=L4hôte d'adresse IP %s a essayé de se connecter au port local redirigé %d.\nC'est peut-être une forme d'attaque hostile.

Modified: trunk/installer/release/lang/German.lng
===================================================================
--- trunk/installer/release/lang/German.lng	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/installer/release/lang/German.lng	2011-10-27 14:59:30 UTC (rev 4690)
@@ -563,7 +563,7 @@
 DLG_FWDSETUP_XAPP=Remote-X-Sitzungen auf dem lokalen X-Server anzeigen.
 
 MSG_FWD_REMOTE_XSERVER=Remote-X-Server
-MSG_FWD_REMOTE_XSCREEN=X-Server (screen %d)
+MSG_FWD_REMOTE_XSCREEN=X-Server (anzeige %d:%d)
 MSG_FWD_REMOTE=Remote "%s" port %s to local "%s" port %s
 MSG_FWD_LOCAL=Local "%s" port %s to remote "%s" port %s
 MSG_FWD_X=Remote X applications to local X server
@@ -683,7 +683,7 @@
 MSG_FWD_ADDRNOTFOUTD_ERROR=No address was found for the machine
 MSG_FWD_CONNECT_ERROR=The forwarding connection could not be established
 MSG_FWD_CHANNEL_ERROR=Communications error %s forwarded local %s.\n%s (code %d).\nThe forwarded connection will be closed.
-MSG_FWD_CHANNEL_OPEN_X_ERROR=The server attempted to forward a connection through this machine.\nIt requested a connection to the X server on %s (screen %d).\n%s.\nThe forwarded connection will be closed.
+MSG_FWD_CHANNEL_OPEN_X_ERROR=The server attempted to forward a connection through this machine.\nIt requested a connection to the X server on %s (anzeige %d:%d).\n%s.\nThe forwarded connection will be closed.
 MSG_FWD_CHANNEL_OPEN_ERROR=The server attempted to forward a connection through this machine.\nIt requested a connection to %s (port %s).\n%s.\nThe forwarded connection will be closed.
 DLG_FWDMON_TITLE=TTSSH Port Forwarding Monitor
 MSG_FWD_HOSTILE_ATTACK_ERROR=Host with IP number %s tried to connect to forwarded local port %d.\nThis could be some kind of hostile attack.

Modified: trunk/installer/release/lang/Japanese.lng
===================================================================
--- trunk/installer/release/lang/Japanese.lng	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/installer/release/lang/Japanese.lng	2011-10-27 14:59:30 UTC (rev 4690)
@@ -565,7 +565,7 @@
 DLG_FWDSETUP_XAPP=ƒŠƒ‚[ƒg‚Ì(&X)ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ðƒ[ƒJƒ‹‚ÌXƒT[ƒo‚É•\Ž¦‚·‚é
 
 MSG_FWD_REMOTE_XSERVER=ƒŠƒ‚[ƒgX ƒT[ƒo
-MSG_FWD_REMOTE_XSCREEN=X ƒT[ƒo (‰æ–Ê %d)
+MSG_FWD_REMOTE_XSCREEN=X ƒT[ƒo (ƒfƒBƒXƒvƒŒƒC %d:%d)
 MSG_FWD_REMOTE=ƒŠƒ‚[ƒg‚Ì "%s" ‚̃|[ƒg %s ‚©‚烍[ƒJƒ‹‘¤ƒzƒXƒg "%s" ‚̃|[ƒg %s
 MSG_FWD_LOCAL=ƒ[ƒJƒ‹‚Ì "%s" ‚̃|[ƒg %s ‚©‚ç ƒŠƒ‚[ƒg‘¤ƒzƒXƒg "%s" ‚̃|[ƒg %s
 MSG_FWD_X=ƒŠƒ‚[ƒg‚ÌXƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚©‚烍[ƒJƒ‹‚ÌXƒT[ƒo
@@ -693,7 +693,7 @@
 MSG_FWD_ADDRNOTFOUTD_ERROR=ƒ}ƒVƒ“‚ɃAƒhƒŒƒX‚ª‚ ‚è‚Ü‚¹‚ñ
 MSG_FWD_CONNECT_ERROR=“]‘—Ú‘±‚ðŠm—§‚Å‚«‚Ü‚¹‚ñ‚Å‚µ‚½
 MSG_FWD_CHANNEL_ERROR=’ʐMƒGƒ‰[ %s forwarded local %s.\n%s (ƒR[ƒh %d).\n“]‘—Ú‘±‚ðI—¹‚µ‚Ü‚·.
-MSG_FWD_CHANNEL_OPEN_X_ERROR=ƒT[ƒo‚Í‚±‚̃}ƒVƒ“‚É“]‘—‚ðŽŽ‚Ý‚Ü‚µ‚½.\n%s ã‚ÌXƒT[ƒo‚ւ̐ڑ±‚ð—v‹‚µ‚Ü‚µ‚½ (‰æ–Ê %d). \n“]‘—Ú‘±‚ðI—¹‚µ‚Ü‚·.
+MSG_FWD_CHANNEL_OPEN_X_ERROR=ƒT[ƒo‚Í‚±‚̃}ƒVƒ“‚É“]‘—‚ðŽŽ‚Ý‚Ü‚µ‚½.\n%s ã‚ÌXƒT[ƒo‚ւ̐ڑ±‚ð—v‹‚µ‚Ü‚µ‚½ (ƒfƒBƒXƒvƒŒƒC %d:%d). \n“]‘—Ú‘±‚ðI—¹‚µ‚Ü‚·.
 MSG_FWD_CHANNEL_OPEN_ERROR=ƒT[ƒo‚Í‚±‚̃}ƒVƒ“‚É“]‘—‚ðŽŽ‚Ý‚Ü‚µ‚½.\n%s ‚ւ̐ڑ±‚ð—v‹‚µ‚Ü‚µ‚½ (ƒ|[ƒg %s).\n%s.\n“]‘—Ú‘±‚ðI—¹‚µ‚Ü‚·.
 DLG_FWDMON_TITLE=TTSSH ƒ|[ƒg“]‘—ƒ‚ƒjƒ^
 MSG_FWD_HOSTILE_ATTACK_ERROR=IP ”ԍ† %s ‚̃zƒXƒg‚ª, ƒ[ƒJƒ‹ƒ|[ƒg %d ‚É“]‘—Ú‘±‚ðŽŽ‚Ý‚Ü‚µ‚½.\nˆ«ˆÓ‚Ì‚ ‚éUŒ‚‚̏ꍇ‚ª‚ ‚è‚Ü‚·.

Modified: trunk/ttssh2/ttxssh/fwd.c
===================================================================
--- trunk/ttssh2/ttxssh/fwd.c	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/ttssh2/ttxssh/fwd.c	2011-10-27 14:59:30 UTC (rev 4690)
@@ -449,11 +449,11 @@
 	if (request->spec.type == FWD_REMOTE_X11_TO_LOCAL) {
 		UTIL_get_lang_msg("MSG_FWD_CHANNEL_OPEN_X_ERROR", pvar,
 		                  "The server attempted to forward a connection through this machine.\n"
-		                  "It requested a connection to the X server on %s (screen %d).\n"
+		                  "It requested a connection to the X server on %s (display %d:%d).\n"
 		                  "%s.\n" "The forwarded connection will be closed.");
 		_snprintf_s(buf, sizeof(buf), _TRUNCATE,
 		            pvar->ts->UIMsg,
-		            request->spec.to_host, request->spec.to_port - 6000,
+		            request->spec.to_host, request->spec.to_port - 6000, request->spec.x11_screen,
 		            uimsg);
 	} else {
 		UTIL_get_lang_msg("MSG_FWD_CHANNEL_OPEN_ERROR", pvar,
@@ -1464,7 +1464,7 @@
 				num_server_listening_requests++;
 				break;
 			case FWD_REMOTE_X11_TO_LOCAL:{
-					int screen_num = request->spec.to_port - 6000;
+					int screen_num = request->spec.x11_screen;
 
 					pvar->fwd_state.X11_auth_data =
 						X11_load_local_auth_data(screen_num);

Modified: trunk/ttssh2/ttxssh/fwd.h
===================================================================
--- trunk/ttssh2/ttxssh/fwd.h	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/ttssh2/ttxssh/fwd.h	2011-10-27 14:59:30 UTC (rev 4690)
@@ -79,7 +79,7 @@
 #define FWD_REMOTE_X11_TO_LOCAL          3
 
 /* If 'type' is FWD_REMOTE_X11_TO_LOCAL, then from_port must be
-   -1, to_port must be 6000 + screen number, and to_host must
+   -1, to_port must be 6000 + display number, and to_host must
    be the desired X server host.
 
    There can be no more than one spec of a given type and from_port
@@ -93,6 +93,7 @@
   char to_port_name[32];
   char to_host[256];
   char bind_address[256];
+  int x11_screen;
 } FWDRequestSpec;
 
 #define FWD_DELETED                      0x01

Modified: trunk/ttssh2/ttxssh/fwdui.c
===================================================================
--- trunk/ttssh2/ttxssh/fwdui.c	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/ttssh2/ttxssh/fwdui.c	2011-10-27 14:59:30 UTC (rev 4690)
@@ -371,13 +371,13 @@
 	spec->type = FWD_REMOTE_X11_TO_LOCAL;
 	spec->from_port = -1;
 	X11_get_DISPLAY_info(spec->to_host, sizeof(spec->to_host),
-	                     &spec->to_port);
+	                     &spec->to_port, &spec->x11_screen);
 	UTIL_get_lang_msg("MSG_FWD_REMOTE_XSERVER", pvar, "remote X server");
 	strncpy_s(spec->from_port_name, sizeof(spec->from_port_name),
 	          pvar->ts->UIMsg, _TRUNCATE);
-	UTIL_get_lang_msg("MSG_FWD_REMOTE_XSCREEN", pvar, "X server (screen %d)");
+	UTIL_get_lang_msg("MSG_FWD_REMOTE_XSCREEN", pvar, "X server (display %d:%d)");
 	_snprintf_s(spec->to_port_name, sizeof(spec->to_port_name), _TRUNCATE,
-	            pvar->ts->UIMsg, spec->to_port - 6000);
+	            pvar->ts->UIMsg, spec->to_port - 6000, spec->x11_screen);
 }
 
 static BOOL is_service_name_char(char ch)

Modified: trunk/ttssh2/ttxssh/x11util.c
===================================================================
--- trunk/ttssh2/ttxssh/x11util.c	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/ttssh2/ttxssh/x11util.c	2011-10-27 14:59:30 UTC (rev 4690)
@@ -42,12 +42,13 @@
 } X11UnspoofingFilterClosure;
 
 void X11_get_DISPLAY_info(char FAR * name_buf, int name_buf_len,
-                          int FAR * port)
+                          int FAR * port, int FAR * screen)
 {
 	char FAR *DISPLAY = getenv("DISPLAY");
 
 	strncpy_s(name_buf, name_buf_len, "localhost", _TRUNCATE);
 	*port = 6000;
+	*screen = 0;
 
 	if (DISPLAY != NULL) {
 		int i;
@@ -63,7 +64,13 @@
 		}
 
 		if (DISPLAY[i] == ':') {
-			*port = atoi(DISPLAY + i + 1) + 6000;
+			*port = atoi(&DISPLAY[++i]) + 6000;
+			while (DISPLAY[i] >= '0' && DISPLAY[i] <= '9') {
+				i++;
+			}
+			if (DISPLAY[i] == '.' && DISPLAY[i+1] != 0) {
+				*screen = atoi(&DISPLAY[++i]);
+			}
 		}
 	}
 }

Modified: trunk/ttssh2/ttxssh/x11util.h
===================================================================
--- trunk/ttssh2/ttxssh/x11util.h	2011-10-26 11:27:56 UTC (rev 4689)
+++ trunk/ttssh2/ttxssh/x11util.h	2011-10-27 14:59:30 UTC (rev 4690)
@@ -49,7 +49,7 @@
 #define X11_get_spoofed_protocol_data(d) ((d)->spoofed_data)
 #define X11_get_spoofed_protocol_data_len(d) ((d)->spoofed_data_len)
 
-void X11_get_DISPLAY_info(char FAR * name_buf, int name_buf_len, int FAR * port);
+void X11_get_DISPLAY_info(char FAR * name_buf, int name_buf_len, int FAR * port, int FAR * screen);
 X11AuthData FAR * X11_load_local_auth_data(int screen_num);
 void FAR * X11_init_unspoofing_filter(struct _TInstVar FAR * pvar,
   X11AuthData FAR * auth_data);



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