From e0749025f259754aa031d997457a308686136909 Mon Sep 17 00:00:00 2001 From: Linus Nordberg Date: Sat, 19 Feb 2011 18:55:51 +0100 Subject: Improve protocol robustness and invoke user callbacks. All aborts are removed, as well as all asserts which aren't programming errors. When an invalid packet is received, the connection is closed, as per draft-ietf-radext-tcp-transport-08 (2.6.4). Use new rs_debug() macro rather than fprintf() for debug printouts. Coding style overhaul. --- lib/debug.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/debug.c') diff --git a/lib/debug.c b/lib/debug.c index 485e29a..4544f3c 100644 --- a/lib/debug.c +++ b/lib/debug.c @@ -14,8 +14,11 @@ void rs_dump_packet (const struct rs_packet *pkt) { - const RADIUS_PACKET *p = pkt->rpkt; - assert(p); + const RADIUS_PACKET *p = NULL; + + if (!pkt || !pkt->rpkt) + return; + p = pkt->rpkt; fprintf (stderr, "\tCode: %u, Identifier: %u, Lenght: %u\n", p->code, @@ -32,7 +35,7 @@ rs_dump_attr (const struct rs_attr *attr) #if defined DEBUG int -rs_debug (const char *fmt, ...) +_rs_debug (const char *fmt, ...) { int n; va_list args; -- cgit v1.1