comparison 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
comparison
equal deleted inserted replaced
729:fedfb8ede1fd 730:714b9106e335
38 } 38 }
39 39
40 40
41 /* Send a "none" auth request to get available methods */ 41 /* Send a "none" auth request to get available methods */
42 void cli_auth_getmethods() { 42 void cli_auth_getmethods() {
43
44 TRACE(("enter cli_auth_getmethods")) 43 TRACE(("enter cli_auth_getmethods"))
45 44 #ifdef CLI_IMMEDIATE_AUTH
45 ses.authstate.authtypes = AUTH_TYPE_PUBKEY | AUTH_TYPE_PASSWORD | AUTH_TYPE_INTERACT;
46 cli_auth_try();
47 #else
46 CHECKCLEARTOWRITE(); 48 CHECKCLEARTOWRITE();
47
48 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST); 49 buf_putbyte(ses.writepayload, SSH_MSG_USERAUTH_REQUEST);
49 buf_putstring(ses.writepayload, cli_opts.username, 50 buf_putstring(ses.writepayload, cli_opts.username,
50 strlen(cli_opts.username)); 51 strlen(cli_opts.username));
51 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION, 52 buf_putstring(ses.writepayload, SSH_SERVICE_CONNECTION,
52 SSH_SERVICE_CONNECTION_LEN); 53 SSH_SERVICE_CONNECTION_LEN);
53 buf_putstring(ses.writepayload, "none", 4); /* 'none' method */ 54 buf_putstring(ses.writepayload, "none", 4); /* 'none' method */
54 55
55 encrypt_packet(); 56 encrypt_packet();
57 #endif
56 TRACE(("leave cli_auth_getmethods")) 58 TRACE(("leave cli_auth_getmethods"))
57
58 } 59 }
59 60
60 void recv_msg_userauth_banner() { 61 void recv_msg_userauth_banner() {
61 62
62 unsigned char* banner = NULL; 63 unsigned char* banner = NULL;