From a13cddc1331aa1f5e7dca7d1b44482951d2757bf Mon Sep 17 00:00:00 2001
From: Luke Howard <lukeh@padl.com>
Date: Sun, 13 Nov 2011 17:16:14 +1100
Subject: port to new RADIUS client library

---
 lib/tests/test-udp.c | 14 ++++++--------
 lib/tests/udp.c      |  2 +-
 2 files changed, 7 insertions(+), 9 deletions(-)

(limited to 'lib/tests')

diff --git a/lib/tests/test-udp.c b/lib/tests/test-udp.c
index f264a51..e51531c 100644
--- a/lib/tests/test-udp.c
+++ b/lib/tests/test-udp.c
@@ -8,8 +8,6 @@
 #define true 1			/* FIXME: Bug report cgreen.  */
 #define false 0
 
-#define FREERADIUS_DICT "/usr/share/freeradius/dictionary"
-
 static void
 authenticate (struct rs_connection *conn, const char *user, const char *pw)
 {
@@ -21,7 +19,7 @@ authenticate (struct rs_connection *conn, const char *user, const char *pw)
   rs_request_add_reqpkt (req, msg);
   assert_true (rs_request_send (req, &resp) == 0);
   //printf ("%s\n", rs_err_msg (rs_err_conn_pop (conn), 1));
-  assert_true (rs_packet_frpkt (resp)->code == PW_AUTHENTICATION_ACK);
+  assert_true (rs_packet_frpkt (resp)->code == PW_ACCESS_ACCEPT);
 
   rs_request_destroy (req);
 }
@@ -45,9 +43,9 @@ send_large_packet (struct rs_connection *conn)
   char *buf;
   int f;
 
-  buf = malloc (4096);
+  buf = malloc (RS_MAX_PACKET_LEN);
   assert_true (buf != NULL);
-  memset (buf, 0, 4096);
+  memset (buf, 0, RS_MAX_PACKET_LEN);
 
   assert_true (rs_packet_create (conn, &msg0) == 0);
   /* 16 chunks --> heap corruption in evbuffer_drain detected by free() */
@@ -79,7 +77,7 @@ test_auth ()
   setup.username = "molgan";
   setup.pw = "password";
 
-  assert_true (rs_context_create (&ctx, FREERADIUS_DICT) == 0);
+  assert_true (rs_context_create (&ctx, NULL) == 0);
   assert_true (rs_context_read_config (ctx, setup.config_file) == 0);
   assert_true (rs_conn_create (ctx, &conn, setup.config_name) == 0);
 
@@ -98,7 +96,7 @@ test_buffering_cb (const uint8_t *buf, ssize_t len)
   hd (buf, len);
 #endif
   assert_true (len >= 20);
-  assert_true (len <= 4096);
+  assert_true (len <= RS_MAX_PACKET_LEN);
   assert_true ((buf[2] << 8) +  buf[3] == len);
   return len;
 }
@@ -111,7 +109,7 @@ test_buffering ()
   struct timeval timeout;
   struct polldata *polldata;
 
-  assert_true (rs_context_create (&ctx, FREERADIUS_DICT) == 0);
+  assert_true (rs_context_create (&ctx, NULL) == 0);
   assert_true (rs_context_read_config (ctx, "test.conf") == 0);
   assert_true (rs_conn_create (ctx, &conn, "test-udp-buffering") == 0);
 
diff --git a/lib/tests/udp.c b/lib/tests/udp.c
index a29880a..47ea595 100644
--- a/lib/tests/udp.c
+++ b/lib/tests/udp.c
@@ -60,7 +60,7 @@ udp_poll (struct polldata *data)
   long timeout;
   fd_set rfds;
   ssize_t len;
-  uint8_t buf[4096];
+  uint8_t buf[RS_MAX_PACKET_LEN];
 
   FD_ZERO (&rfds);
   FD_SET (data->s, &rfds);
-- 
cgit v1.1