diff cli-auth.c @ 730:714b9106e335

Send an auth packet straight away, save another roundtrip This needs a bit of testing to make sure it doesn't have side-effects.
author Matt Johnston <matt@ucc.asn.au>
date Sun, 31 Mar 2013 23:48:25 +0800
parents 983a817f8e41
children 2e5f2bc60e40
line wrap: on
line diff
--- a/cli-auth.c	Sun Mar 31 23:29:03 2013 +0800
+++ b/cli-auth.c	Sun Mar 31 23:48:25 2013 +0800
@@ -40,11 +40,12 @@
 
 /* Send a "none" auth request to get available methods */
 void cli_auth_getmethods() {
-
 	TRACE(("enter cli_auth_getmethods"))
-
+#ifdef CLI_IMMEDIATE_AUTH
+	ses.authstate.authtypes = AUTH_TYPE_PUBKEY | AUTH_TYPE_PASSWORD | AUTH_TYPE_INTERACT;
+	cli_auth_try();
+#else
 	CHECKCLEARTOWRITE();
-
 	buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);
 	buf_putstring(ses.writepayload, cli_opts.username, 
 			strlen(cli_opts.username));
@@ -53,8 +54,8 @@
 	buf_putstring(ses.writepayload, "none", 4); /* 'none' method */
 
 	encrypt_packet();
+#endif
 	TRACE(("leave cli_auth_getmethods"))
-
 }
 
 void recv_msg_userauth_banner() {