Mercurial > dropbear
diff fuzz/fuzz-common.c @ 1782:a6da10ac64b5 fuzz
fuzz: make postauth set authdone properly
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Thu, 03 Dec 2020 22:18:51 +0800 |
parents | b5aedadc0008 |
children | 9026f976eee8 |
line wrap: on
line diff
--- a/fuzz/fuzz-common.c Thu Dec 03 21:19:19 2020 +0800 +++ b/fuzz/fuzz-common.c Thu Dec 03 22:18:51 2020 +0800 @@ -102,6 +102,13 @@ load_fixed_hostkeys(); } +void fuzz_svr_hook_preloop() { + if (fuzz.svr_postauth) { + ses.authstate.authdone = 1; + fill_passwd("root"); + } +} + void fuzz_cli_setup(void) { fuzz_common_setup(); @@ -242,7 +249,7 @@ return NULL; } -int fuzz_run_server(const uint8_t *Data, size_t Size, int skip_kexmaths, int authdone) { +int fuzz_run_server(const uint8_t *Data, size_t Size, int skip_kexmaths, int postauth) { static int once = 0; if (!once) { fuzz_svr_setup(); @@ -250,6 +257,8 @@ once = 1; } + fuzz.svr_postauth = postauth; + if (fuzz_set_input(Data, Size) == DROPBEAR_FAILURE) { return 0; } @@ -260,11 +269,6 @@ int fakesock = wrapfd_new_fuzzinput(); - if (authdone) { - ses.authstate.authdone = 1; - fill_passwd("root"); - } - m_malloc_set_epoch(1); fuzz.do_jmp = 1; if (setjmp(fuzz.jmp) == 0) {