From 67ff81ec16b8ab5f15d16efbedfecfaf0be17c13 Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Wed, 5 Oct 2011 22:05:13 +0200 Subject: [PATCH] Test corner cases in the SPTPS protocol. * Test zero-byte messages. * Test maximum size (65535 byte) messages. * Test different message types. * Test key renegotiation. --- src/sptps_test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/sptps_test.c b/src/sptps_test.c index 7b33eef..866159e 100644 --- a/src/sptps_test.c +++ b/src/sptps_test.c @@ -121,7 +121,7 @@ int main(int argc, char *argv[]) { return 1; while(true) { - char buf[4095]; + char buf[65535] = ""; struct pollfd fds[2]; fds[0].fd = 0; @@ -139,7 +139,12 @@ int main(int argc, char *argv[]) { } if(len == 0) break; - if(!send_record(&s, 0, buf, len)) + if(buf[0] == '^') + send_record(&s, SPTPS_HANDSHAKE, NULL, 0); + else if(buf[0] == '$') + force_kex(&s); + else + if(!send_record(&s, buf[0] == '!' ? 1 : 0, buf, buf[0] == '\n' ? 0 : buf[0] == '*' ? sizeof buf : len)) return 1; } -- 2.25.1