Merge libradsec-new-client.
[radsecproxy.git] / lib / tests / test-udp.c
index 13d6979..ccad607 100644 (file)
@@ -1,6 +1,5 @@
 #include <stdlib.h>
 #include <cgreen/cgreen.h>
-#include <freeradius/libradius.h>
 #include "radsec/radsec.h"
 #include "radsec/request.h"
 #include "udp.h"
@@ -19,7 +18,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_code(resp) == PW_ACCESS_ACCEPT);
 
   rs_request_destroy (req);
 }
@@ -35,6 +34,7 @@ send_more_than_one_msg_in_one_packet (struct rs_connection *conn)
   assert_true (rs_packet_send (msg1, NULL) == 0);
 }
 
+#if 0
 static void
 send_large_packet (struct rs_connection *conn)
 {
@@ -43,24 +43,21 @@ 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);
-  frpkt = rs_packet_frpkt (msg0);
-  assert_true (frpkt != NULL);
   /* 16 chunks --> heap corruption in evbuffer_drain detected by free() */
   for (f = 0; f < 15; f++)
     {
-      VALUE_PAIR *vp = NULL;
       memset (buf, 'a' + f, 252);
-      vp = pairmake ("EAP-Message", buf, T_OP_EQ);
-      assert_true (vp != NULL);
-      pairadd (&frpkt->vps, vp);
+      //vp = pairmake ("EAP-Message", buf, T_OP_EQ);
+      assert_true (rs_packet_append_avp (msg0, fixme...) == RSE_OK);
     }
   assert_true (rs_packet_send (msg0, NULL) == 0);
 }
+#endif  /* 0 */
 
 /* ************************************************************ */
 static struct setup {
@@ -101,7 +98,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;
 }
@@ -116,7 +113,6 @@ test_buffering ()
 
   assert_true (rs_context_create (&ctx) == 0);
   assert_true (rs_context_read_config (ctx, "test.conf") == 0);
-  assert_true (rs_context_init_freeradius_dict (ctx, NULL) == 0);
   assert_true (rs_conn_create (ctx, &conn, "test-udp-buffering") == 0);
 
   timeout.tv_sec = 0;