1
1
Этот коммит содержится в:
Aris Adamantiadis 2010-10-04 16:19:20 +02:00
родитель 5d1636985b
Коммит da9cd2e64d
6 изменённых файлов: 48 добавлений и 8 удалений

Просмотреть файл

@ -182,6 +182,14 @@ SSH_PACKET_CALLBACK(ssh_packet_userauth_success){
ssh_log(session,SSH_LOG_PROTOCOL,"Authentication successful"); ssh_log(session,SSH_LOG_PROTOCOL,"Authentication successful");
session->auth_state=SSH_AUTH_STATE_SUCCESS; session->auth_state=SSH_AUTH_STATE_SUCCESS;
session->session_state=SSH_SESSION_STATE_AUTHENTICATED; session->session_state=SSH_SESSION_STATE_AUTHENTICATED;
if(session->current_crypto && session->current_crypto->delayed_compress_out){
ssh_log(session,SSH_LOG_PROTOCOL,"Enabling delayed compression OUT");
session->current_crypto->do_compress_out=1;
}
if(session->current_crypto && session->current_crypto->delayed_compress_in){
ssh_log(session,SSH_LOG_PROTOCOL,"Enabling delayed compression IN");
session->current_crypto->do_compress_in=1;
}
leave_function(); leave_function();
return SSH_PACKET_USED; return SSH_PACKET_USED;
} }

Просмотреть файл

@ -67,7 +67,7 @@
#endif #endif
#if defined(HAVE_LIBZ) && defined(WITH_LIBZ) #if defined(HAVE_LIBZ) && defined(WITH_LIBZ)
#define ZLIB "none,zlib,zlib@openssh.org" #define ZLIB "none,zlib,zlib@openssh.com"
#else #else
#define ZLIB "none" #define ZLIB "none"
#endif #endif

Просмотреть файл

@ -763,10 +763,10 @@ int ssh_options_getopt(ssh_session session, int *argcptr, char **argv) {
/* set a new option struct */ /* set a new option struct */
if (compress) { if (compress) {
if (ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "zlib,none") < 0) { if (ssh_options_set(session, SSH_OPTIONS_COMPRESSION_C_S, "zlib,zlib@openssh.com,none") < 0) {
cont = 0; cont = 0;
} }
if (ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "zlib,none") < 0) { if (ssh_options_set(session, SSH_OPTIONS_COMPRESSION_S_C, "zlib,zlib@openssh.com,none") < 0) {
cont = 0; cont = 0;
} }
} }

Просмотреть файл

@ -1015,7 +1015,9 @@ int ssh_message_auth_set_methods(ssh_message msg, int methods) {
} }
int ssh_message_auth_reply_success(ssh_message msg, int partial) { int ssh_message_auth_reply_success(ssh_message msg, int partial) {
if (msg == NULL) { int r;
if (msg == NULL) {
return SSH_ERROR; return SSH_ERROR;
} }
@ -1027,7 +1029,16 @@ int ssh_message_auth_reply_success(ssh_message msg, int partial) {
return SSH_ERROR; return SSH_ERROR;
} }
return packet_send(msg->session); r = packet_send(msg->session);
if(msg->session->current_crypto && msg->session->current_crypto->delayed_compress_out){
ssh_log(msg->session,SSH_LOG_PROTOCOL,"Enabling delayed compression OUT");
msg->session->current_crypto->do_compress_out=1;
}
if(msg->session->current_crypto && msg->session->current_crypto->delayed_compress_in){
ssh_log(msg->session,SSH_LOG_PROTOCOL,"Enabling delayed compression IN");
msg->session->current_crypto->do_compress_in=1;
}
return r;
} }
/* Answer OK to a pubkey auth request */ /* Answer OK to a pubkey auth request */

Просмотреть файл

@ -167,10 +167,10 @@ static int crypt_set_algorithms2(ssh_session session){
if (strcmp(session->client_kex.methods[SSH_COMP_S_C], "zlib") == 0) { if (strcmp(session->client_kex.methods[SSH_COMP_S_C], "zlib") == 0) {
session->next_crypto->do_compress_in = 1; session->next_crypto->do_compress_in = 1;
} }
if (strcmp(session->client_kex.methods[SSH_COMP_C_S], "zlib@openssh.org") == 0) { if (strcmp(session->client_kex.methods[SSH_COMP_C_S], "zlib@openssh.com") == 0) {
session->next_crypto->delayed_compress_out = 1; session->next_crypto->delayed_compress_out = 1;
} }
if (strcmp(session->client_kex.methods[SSH_COMP_S_C], "zlib@openssh.org") == 0) { if (strcmp(session->client_kex.methods[SSH_COMP_S_C], "zlib@openssh.com") == 0) {
session->next_crypto->delayed_compress_in = 1; session->next_crypto->delayed_compress_in = 1;
} }
return SSH_OK; return SSH_OK;

Просмотреть файл

@ -119,6 +119,25 @@ START_TEST (torture_algorithms_zlib)
} }
END_TEST END_TEST
START_TEST (torture_algorithms_zlib_openssh)
{
int rc;
ssh_options_set(session,SSH_OPTIONS_HOST,"localhost");
rc=ssh_options_set(session,SSH_OPTIONS_COMPRESSION_C_S,"zlib@openssh.com");
ck_assert_msg(rc==SSH_OK,ssh_get_error(session));
rc=ssh_options_set(session,SSH_OPTIONS_COMPRESSION_S_C,"zlib@openssh.com");
ck_assert_msg(rc==SSH_OK,ssh_get_error(session));
rc=ssh_connect(session);
ck_assert_msg(rc==SSH_OK,ssh_get_error(session));
rc=ssh_userauth_none(session,NULL);
if(rc != SSH_OK){
rc=ssh_get_error_code(session);
ck_assert_msg(rc==SSH_REQUEST_DENIED,ssh_get_error(session));
}
ssh_disconnect(session);
}
END_TEST
Suite *torture_make_suite(void) { Suite *torture_make_suite(void) {
Suite *s = suite_create("libssh_algorithms"); Suite *s = suite_create("libssh_algorithms");
@ -140,5 +159,7 @@ Suite *torture_make_suite(void) {
torture_algorithms_blowfish_cbc, setup, teardown); torture_algorithms_blowfish_cbc, setup, teardown);
torture_create_case_fixture(s, "torture_algorithms_zlib", torture_create_case_fixture(s, "torture_algorithms_zlib",
torture_algorithms_zlib, setup, teardown); torture_algorithms_zlib, setup, teardown);
return s; torture_create_case_fixture(s, "torture_algorithms_zlib_openssh",
torture_algorithms_zlib_openssh, setup, teardown);
return s;
} }