[Ttssh2-commit] [7477] keyboard-interactive 認証時、prompt の echo フラグが無視されるのを修正。

scmno****@osdn***** scmno****@osdn*****
2019年 3月 13日 (水) 12:14:00 JST


Revision: 7477
          http://sourceforge.jp/projects/ttssh2/scm/svn/commits/7477
Author:   doda
Date:     2019-03-13 12:14:00 +0900 (Wed, 13 Mar 2019)
Log Message:
-----------
keyboard-interactive 認証時、prompt の echo フラグが無視されるのを修正。

Ticket: #37294

パスワード入力では制御文字の入力を可能にしているが、表示可能にする事によって
記号等として表示されて文字化けしているように見えるのが課題。

Ticket Links:
------------
    http://sourceforge.jp/projects/ttssh2/tracker/detail/37294

Modified Paths:
--------------
    trunk/doc/en/html/about/history.html
    trunk/doc/ja/html/about/history.html
    trunk/ttssh2/ttxssh/auth.c
    trunk/ttssh2/ttxssh/auth.h
    trunk/ttssh2/ttxssh/ssh.c

-------------- next part --------------
Modified: trunk/doc/en/html/about/history.html
===================================================================
--- trunk/doc/en/html/about/history.html	2019-03-13 03:13:55 UTC (rev 7476)
+++ trunk/doc/en/html/about/history.html	2019-03-13 03:14:00 UTC (rev 7477)
@@ -3112,6 +3112,7 @@
   <li>Bug fixes
     <ul>
       <li>garbage data is added to the CipherOrder and MacOrder settings when saving settings.</li>
+      <li>when echo flag is 1 in the server's authentication informatin message, password string is masked on the keyboard-interactive authentication dialog.</li>
     </ul>
   </li>
 </ul>

Modified: trunk/doc/ja/html/about/history.html
===================================================================
--- trunk/doc/ja/html/about/history.html	2019-03-13 03:13:55 UTC (rev 7476)
+++ trunk/doc/ja/html/about/history.html	2019-03-13 03:14:00 UTC (rev 7477)
@@ -3118,6 +3118,7 @@
   <li>\x83o\x83O\x8FC\x90\xB3
     <ul>
       <li>\x90ݒ\xE8\x82̕ۑ\xB6\x8E\x9E\x81ACipherOrder, MacOrder \x90ݒ\xE8\x82ɃS\x83~\x82\xAA\x95t\x89\xC1\x82\xB3\x82\xEA\x82\xE9\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B</li>
+      <li>\x83T\x81[\x83o\x82̔F\x8F؏\xEE\x95񃁃b\x83Z\x81[\x83W\x82\xC5 echo \x83t\x83\x89\x83O\x82\xAA 1 \x82̎\x9E\x82ɂ\xE0\x83L\x81[\x83{\x81[\x83h\x83C\x83\x93\x83^\x83\x89\x83N\x83e\x83B\x83u\x94F\x8F؃_\x83C\x83A\x83\x8D\x83O\x82Ńp\x83X\x83\x8F\x81[\x83h\x82\xAA\x83}\x83X\x83N\x82\xB3\x82\xEA\x82\xE9\x96\xE2\x91\xE8\x82\xF0\x8FC\x90\xB3\x82\xB5\x82\xBD\x81B</li>
     </ul>
   </li>
 </ul>

Modified: trunk/ttssh2/ttxssh/auth.c
===================================================================
--- trunk/ttssh2/ttxssh/auth.c	2019-03-13 03:13:55 UTC (rev 7476)
+++ trunk/ttssh2/ttxssh/auth.c	2019-03-13 03:14:00 UTC (rev 7477)
@@ -1112,6 +1112,10 @@
 					   pvar->auth_state.TIS_prompt);
 		destroy_malloced_string(&pvar->auth_state.TIS_prompt);
 	}
+
+	if (pvar->auth_state.echo) {
+		SendMessage(GetDlgItem(dlg, IDC_SSHPASSWORD), EM_SETPASSWORDCHAR, 0, 0);
+	}
 }
 
 static BOOL end_TIS_dlg(PTInstVar pvar, HWND dlg)
@@ -1443,6 +1447,7 @@
 	pvar->auth_state.user = NULL;
 	pvar->auth_state.flags = 0;
 	pvar->auth_state.TIS_prompt = NULL;
+	pvar->auth_state.echo = 0;
 	pvar->auth_state.supported_types = 0;
 	pvar->auth_state.cur_cred.method = SSH_AUTH_NONE;
 	pvar->auth_state.cur_cred.password = NULL;
@@ -1457,7 +1462,7 @@
 	destroy_malloced_string(&pvar->auth_state.TIS_prompt);
 }
 
-void AUTH_set_TIS_mode(PTInstVar pvar, char *prompt, int len)
+void AUTH_set_TIS_mode(PTInstVar pvar, char *prompt, int len, int echo)
 {
 	if (pvar->auth_state.cur_cred.method == SSH_AUTH_TIS) {
 		pvar->auth_state.mode = TIS_AUTH_MODE;
@@ -1466,6 +1471,7 @@
 		pvar->auth_state.TIS_prompt = malloc(len + 1);
 		memcpy(pvar->auth_state.TIS_prompt, prompt, len);
 		pvar->auth_state.TIS_prompt[len] = 0;
+		pvar->auth_state.echo = echo;
 	} else {
 		AUTH_set_generic_mode(pvar);
 	}

Modified: trunk/ttssh2/ttxssh/auth.h
===================================================================
--- trunk/ttssh2/ttxssh/auth.h	2019-03-13 03:13:55 UTC (rev 7476)
+++ trunk/ttssh2/ttxssh/auth.h	2019-03-13 03:14:00 UTC (rev 7477)
@@ -56,6 +56,7 @@
 
   AuthMode mode;
   char *TIS_prompt;
+  int echo;
 } AUTHState;
 
 void AUTH_init(PTInstVar pvar);
@@ -62,7 +63,7 @@
 char *AUTH_get_user_name(PTInstVar pvar);
 int AUTH_set_supported_auth_types(PTInstVar pvar, int types);
 void AUTH_set_generic_mode(PTInstVar pvar);
-void AUTH_set_TIS_mode(PTInstVar pvar, char *prompt, int len);
+void AUTH_set_TIS_mode(PTInstVar pvar, char *prompt, int len, int echo);
 void AUTH_advance_to_next_cred(PTInstVar pvar);
 void AUTH_do_cred_dialog(PTInstVar pvar);
 void AUTH_do_default_cred_dialog(PTInstVar pvar);

Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2019-03-13 03:13:55 UTC (rev 7476)
+++ trunk/ttssh2/ttxssh/ssh.c	2019-03-13 03:14:00 UTC (rev 7477)
@@ -1452,7 +1452,7 @@
 		if (grab_payload(pvar, len)) {
 			logputs(LOG_LEVEL_VERBOSE, "Received TIS challenge");
 
-			AUTH_set_TIS_mode(pvar, pvar->ssh_state.payload + 4, len);
+			AUTH_set_TIS_mode(pvar, pvar->ssh_state.payload + 4, len, 0);
 			AUTH_advance_to_next_cred(pvar);
 			pvar->ssh_state.status_flags &= ~STATUS_DONT_SEND_CREDENTIALS;
 			try_send_credentials(pvar);
@@ -7200,7 +7200,7 @@
 		// keyboard-interactive method (2005.3.12 yutaka)
 		if (pvar->keyboard_interactive_password_input == 0 &&
 			pvar->auth_state.cur_cred.method == SSH_AUTH_TIS) {
-			AUTH_set_TIS_mode(pvar, prompt, slen);
+			AUTH_set_TIS_mode(pvar, prompt, slen, echo);
 			AUTH_advance_to_next_cred(pvar);
 			pvar->ssh_state.status_flags &= ~STATUS_DONT_SEND_CREDENTIALS;
 			//try_send_credentials(pvar);


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