summaryrefslogtreecommitdiff
path: root/lib/debug.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2011-02-19 18:55:51 +0100
committerLinus Nordberg <linus@nordu.net>2011-02-19 18:55:51 +0100
commite0749025f259754aa031d997457a308686136909 (patch)
treea0c9c98e09c6089c780f06053e9abbaec4a24438 /lib/debug.c
parent020e7688d91f2db00d1b573c8496119ede15e773 (diff)
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.
Diffstat (limited to 'lib/debug.c')
-rw-r--r--lib/debug.c9
1 files changed, 6 insertions, 3 deletions
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;