diff cli-session.c @ 34:e2a1eaa19f22

Client mostly works up to password auth Need to rework algo-choosing etc, since server is now broken.
author Matt Johnston <matt@ucc.asn.au>
date Wed, 28 Jul 2004 16:44:16 +0000
parents f789045062e6
children 0ad5fb979f42
line wrap: on
line diff
--- a/cli-session.c	Tue Jul 27 16:30:46 2004 +0000
+++ b/cli-session.c	Wed Jul 28 16:44:16 2004 +0000
@@ -21,6 +21,7 @@
 	{SSH_MSG_KEXINIT, recv_msg_kexinit},
 	{SSH_MSG_KEXDH_REPLY, recv_msg_kexdh_reply}, // client
 	{SSH_MSG_NEWKEYS, recv_msg_newkeys},
+	{SSH_MSG_SERVICE_ACCEPT, recv_msg_service_accept}, // client
 	{SSH_MSG_CHANNEL_DATA, recv_msg_channel_data},
 	{SSH_MSG_CHANNEL_WINDOW_ADJUST, recv_msg_channel_window_adjust},
 	{SSH_MSG_GLOBAL_REQUEST, recv_msg_global_request_remotetcp},
@@ -30,8 +31,8 @@
 	{SSH_MSG_CHANNEL_CLOSE, recv_msg_channel_close},
 	{SSH_MSG_CHANNEL_OPEN_CONFIRMATION, recv_msg_channel_open_confirmation},
 	{SSH_MSG_CHANNEL_OPEN_FAILURE, recv_msg_channel_open_failure},
-	{SSH_MSG_USERAUTH_FAILURE, recv_msg_userauth_failure},
-	{SSH_MSG_USERAUTH_SUCCESS, recv_msg_userauth_success},
+	{SSH_MSG_USERAUTH_FAILURE, recv_msg_userauth_failure}, // client
+	{SSH_MSG_USERAUTH_SUCCESS, recv_msg_userauth_success}, // client
 	{0, 0} /* End */
 };
 
@@ -90,11 +91,11 @@
 
 	TRACE(("enter cli_sessionloop"));
 
-	if (cli_ses.kex_state == KEX_NOTHING && ses.kexstate.recvkexinit) {
-		cli_ses.state = KEXINIT_RCVD;
+	if (ses.lastpacket == SSH_MSG_KEXINIT && cli_ses.kex_state == KEX_NOTHING) {
+		cli_ses.kex_state = KEXINIT_RCVD;
 	}
 
-	if (cli_ses.state == KEXINIT_RCVD) {
+	if (cli_ses.kex_state == KEXINIT_RCVD) {
 
 		/* We initiate the KEXDH. If DH wasn't the correct type, the KEXINIT
 		 * negotiation would have failed. */
@@ -120,6 +121,7 @@
 	 * in normal operation */
 	if (ses.kexstate.donefirstkex == 0) {
 		TRACE(("XXX XXX might be bad! leave cli_sessionloop: haven't donefirstkex"));
+		return;
 	}
 
 	switch (cli_ses.state) {
@@ -129,6 +131,7 @@
 			 * userauth */
 			send_msg_service_request(SSH_SERVICE_USERAUTH);
 			cli_ses.state = SERVICE_AUTH_REQ_SENT;
+			TRACE(("leave cli_sessionloop: sent userauth service req"));
 			return;
 
 		/* userauth code */
@@ -136,10 +139,12 @@
 			cli_get_user();
 			cli_auth_getmethods();
 			cli_ses.state = USERAUTH_METHODS_SENT;
+			TRACE(("leave cli_sessionloop: sent userauth methods req"));
 			return;
 			
 		case USERAUTH_FAIL_RCVD:
 			cli_auth_try();
+			TRACE(("leave cli_sessionloop: cli_auth_try"));
 			return;
 
 		/* XXX more here needed */
@@ -149,6 +154,7 @@
 		break;
 	}
 
+	TRACE(("leave cli_sessionloop: fell out"));
 
 }