diff options
author | Linus Nordberg <linus@nordberg.se> | 2012-04-27 17:00:17 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordberg.se> | 2012-04-27 17:00:17 +0200 |
commit | 4b0ff99282a91bba93eec9db37831be73b8134e4 (patch) | |
tree | 087509c14291f207260d350c9fabf07c665a4f25 /lib/tests | |
parent | c562df4b073a288862dd3c4ceaba7d6439f33b45 (diff) | |
parent | efb18a601811888127be69499cf10891aa3a4c37 (diff) |
Merge libradsec-new-client.
Diffstat (limited to 'lib/tests')
-rw-r--r-- | lib/tests/test-udp.c | 20 | ||||
-rw-r--r-- | lib/tests/udp.c | 2 |
2 files changed, 9 insertions, 13 deletions
diff --git a/lib/tests/test-udp.c b/lib/tests/test-udp.c index 13d6979..ccad607 100644 --- a/lib/tests/test-udp.c +++ b/lib/tests/test-udp.c @@ -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; 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); |