[Ttssh2-commit] [4407] SSH1 で認証情報を送る際 \0 を詰めて文字数を 32 の倍数に切り上げていたが、

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2011年 3月 30日 (水) 21:24:00 JST


Revision: 4407
          http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=4407
Author:   maya
Date:     2011-03-30 21:24:00 +0900 (Wed, 30 Mar 2011)

Log Message:
-----------
SSH1 で認証情報を送る際 \0 を詰めて文字数を 32 の倍数に切り上げていたが、
サーバが OpenSSH 5.8 以降だと接続できないので切り上げないようにした。
  http://www.openssh.com/cgi-bin/cvsweb/src/usr.bin/ssh/bufaux.c#rev1.50

Revision Links:
--------------
    http://sourceforge.jp/projects/ttssh2/svn/view?view=rev&revision=1

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


-------------- next part --------------
Modified: trunk/ttssh2/ttxssh/ssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ssh.c	2011-03-30 12:10:17 UTC (rev 4406)
+++ trunk/ttssh2/ttxssh/ssh.c	2011-03-30 12:24:00 UTC (rev 4407)
@@ -2407,13 +2407,6 @@
 	return FALSE;
 }
 
-#define OBFUSCATING_ROUND_TO 32
-
-static int obfuscating_round_up(PTInstVar pvar, int size)
-{
-	return (size + OBFUSCATING_ROUND_TO - 1) & ~(OBFUSCATING_ROUND_TO - 1);
-}
-
 static void try_send_credentials(PTInstVar pvar)
 {
 	if ((pvar->ssh_state.status_flags & STATUS_DONT_SEND_CREDENTIALS) == 0) {
@@ -2436,19 +2429,16 @@
 			return;
 		case SSH_AUTH_PASSWORD:{
 				int len = strlen(cred->password);
-				// Round up password length to discourage traffic analysis
-				int obfuscated_len = obfuscating_round_up(pvar, len);
 				unsigned char FAR *outmsg =
 					begin_send_packet(pvar, SSH_CMSG_AUTH_PASSWORD,
-					                  4 + obfuscated_len);
+					                  4 + len);
 
 				notify_verbose_message(pvar,
 				                       "Trying PASSWORD authentication...",
 				                       LOG_LEVEL_VERBOSE);
 
-				set_uint32(outmsg, obfuscated_len);
+				set_uint32(outmsg, len);
 				memcpy(outmsg + 4, cred->password, len);
-				memset(outmsg + 4 + len, 0, obfuscated_len - len);
 				
 				// ƒZƒbƒVƒ‡ƒ“•¡»Žž‚ɃpƒXƒ[ƒh‚ðŽg‚¢‰ñ‚µ‚½‚¢‚̂ŁA‚±‚±‚ł̃Šƒ\[ƒX‰ð•ú‚Í‚â‚ß‚éB
 				// socket closeŽž‚É‚à‚±‚̊֐”‚͌Ă΂ê‚Ä‚¢‚é‚̂ŁA‚½‚Ô‚ñ–â‘è‚È‚¢B(2005.4.8 yutaka)
@@ -2564,22 +2554,21 @@
 						begin_send_packet(pvar, SSH_CMSG_AUTH_TIS, 0);
 
 					notify_verbose_message(pvar,
-					                    "Trying TIS authentication...",
-					                    LOG_LEVEL_VERBOSE);
+					                       "Trying TIS authentication...",
+					                       LOG_LEVEL_VERBOSE);
 					enque_handlers(pvar, 2, TIS_msgs, TIS_handlers);
 				} else {
 					int len = strlen(cred->password);
-					int obfuscated_len = obfuscating_round_up(pvar, len);
 					unsigned char FAR *outmsg =
 						begin_send_packet(pvar, SSH_CMSG_AUTH_TIS_RESPONSE,
-						                  4 + obfuscated_len);
+						                  4 + len);
 
-					notify_verbose_message(pvar, "Sending TIS response",
-											LOG_LEVEL_VERBOSE);
+					notify_verbose_message(pvar,
+					                       "Sending TIS response",
+					                       LOG_LEVEL_VERBOSE);
 
-					set_uint32(outmsg, obfuscated_len);
+					set_uint32(outmsg, len);
 					memcpy(outmsg + 4, cred->password, len);
-					memset(outmsg + 4 + len, 0, obfuscated_len - len);
 					enque_simple_auth_handlers(pvar);
 				}
 
@@ -2609,18 +2598,16 @@
 
 		if (username != NULL) {
 			int len = strlen(username);
-			int obfuscated_len = obfuscating_round_up(pvar, len);
 			unsigned char FAR *outmsg =
-				begin_send_packet(pvar, SSH_CMSG_USER, 4 + obfuscated_len);
+				begin_send_packet(pvar, SSH_CMSG_USER, 4 + len);
 			char buf[1024] = "Sending user name: ";
 			static const int msgs[] =
 				{ SSH_SMSG_SUCCESS, SSH_SMSG_FAILURE };
 			static const SSHPacketHandler handlers[]
 			= { handle_noauth_success, handle_auth_required };
 
-			set_uint32(outmsg, obfuscated_len);
+			set_uint32(outmsg, len);
 			memcpy(outmsg + 4, username, len);
-			memset(outmsg + 4 + len, 0, obfuscated_len - len);
 			finish_send_packet(pvar);
 
 			pvar->ssh_state.status_flags |= STATUS_DONT_SEND_USER_NAME;



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