mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-29 13:01:13 +03:00
tests: send more packets of various sizes
Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be> Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
committed by
Andreas Schneider
parent
321ec2cb1c
commit
23accdde1a
@ -26,6 +26,7 @@
|
||||
#include "torture.h"
|
||||
#include "libssh/libssh.h"
|
||||
#include "libssh/priv.h"
|
||||
#include "libssh/session.h"
|
||||
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
@ -49,7 +50,6 @@ static int session_setup(void **state) {
|
||||
int verbosity = torture_libssh_verbosity();
|
||||
struct passwd *pwd;
|
||||
int rc;
|
||||
|
||||
pwd = getpwnam("bob");
|
||||
assert_non_null(pwd);
|
||||
|
||||
@ -80,6 +80,15 @@ static void test_algorithm(ssh_session session,
|
||||
const char *cipher,
|
||||
const char *hmac) {
|
||||
int rc;
|
||||
char data[256];
|
||||
size_t len_to_test[] = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8, 10,
|
||||
12, 15, 16, 20,
|
||||
31, 32, 33,
|
||||
63, 64, 65,
|
||||
100, 127, 128
|
||||
};
|
||||
unsigned int i;
|
||||
|
||||
int verbosity = torture_libssh_verbosity();
|
||||
ssh_options_set(session, SSH_OPTIONS_LOG_VERBOSITY, &verbosity);
|
||||
@ -106,6 +115,14 @@ static void test_algorithm(ssh_session session,
|
||||
rc = ssh_connect(session);
|
||||
assert_int_equal(rc, SSH_OK);
|
||||
|
||||
/* send ignore packets of all sizes */
|
||||
memset(data, 0, sizeof(data));
|
||||
for (i = 0; i < (sizeof(len_to_test) / sizeof(size_t)); i++) {
|
||||
memset(data, 'A', len_to_test[i]);
|
||||
ssh_send_ignore(session, data);
|
||||
ssh_handle_packets(session, 50);
|
||||
}
|
||||
|
||||
rc = ssh_userauth_none(session, NULL);
|
||||
if (rc != SSH_OK) {
|
||||
rc = ssh_get_error_code(session);
|
||||
|
Reference in New Issue
Block a user