# HG changeset patch # User Matt Johnston # Date 1392470621 -28800 # Node ID 7032deca6b90825c480e272e6a939e1ae2cc7118 # Parent 860e3522f8fc1308cc41f563aa6eaae2a53e4104 Disable immediate auth for delayed-zlib mode diff -r 860e3522f8fc -r 7032deca6b90 cli-auth.c --- a/cli-auth.c Sat Feb 15 21:13:57 2014 +0800 +++ b/cli-auth.c Sat Feb 15 21:23:41 2014 +0800 @@ -52,14 +52,22 @@ encrypt_packet(); #ifdef DROPBEAR_CLI_IMMEDIATE_AUTH - ses.authstate.authtypes = AUTH_TYPE_PUBKEY; - if (getenv(DROPBEAR_PASSWORD_ENV)) { - ses.authstate.authtypes |= AUTH_TYPE_PASSWORD | AUTH_TYPE_INTERACT; - } - if (cli_auth_try() == DROPBEAR_SUCCESS) { - TRACE(("skipped initial none auth query")) - /* Note that there will be two auth responses in-flight */ - cli_ses.ignore_next_auth_response = 1; + /* We can't haven't two auth requests in-flight with delayed zlib mode + since if the first one succeeds then the remote side will + expect the second one to be compressed. + Race described at + http://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/zlib-openssh.html + */ + if (ses.keys->trans.algo_comp != DROPBEAR_COMP_ZLIB_DELAY) { + ses.authstate.authtypes = AUTH_TYPE_PUBKEY; + if (getenv(DROPBEAR_PASSWORD_ENV)) { + ses.authstate.authtypes |= AUTH_TYPE_PASSWORD | AUTH_TYPE_INTERACT; + } + if (cli_auth_try() == DROPBEAR_SUCCESS) { + TRACE(("skipped initial none auth query")) + /* Note that there will be two auth responses in-flight */ + cli_ses.ignore_next_auth_response = 1; + } } #endif TRACE(("leave cli_auth_getmethods"))