![]() |
The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
|
Tests for the RADIUS bio verify callbacks. More...
#include <freeradius-devel/util/test/acutest_common_init.h>#include <freeradius-devel/util/test/acutest_helpers.h>#include <freeradius-devel/bio/bio_priv.h>#include <freeradius-devel/bio/mem.h>#include <freeradius-devel/bio/pipe.h>#include <freeradius-devel/radius/bio.h>
Include dependency graph for radius_bio_tests.c:Go to the source code of this file.
Macros | |
| #define | BAD(_name, ...) { _name, (uint8_t const[]) { __VA_ARGS__ }, sizeof((uint8_t const[]) { __VA_ARGS__ }) } |
| #define | MAX_PACKET_SIZE 4096 |
| #define | MESSAGE_AUTHENTICATOR 80 |
Functions | |
| static int | cb_noop (fr_bio_t *bio) |
| static void | cb_noop_void (fr_bio_t *bio) |
| static fr_bio_verify_action_t | datagram_verify (fr_radius_bio_verify_t *ctx, uint8_t const *buf, size_t in_buffer, size_t *size_out) |
| Call the datagram verify callback on a buffer holding in_buffer bytes. | |
| static size_t | make_packet (uint8_t *out, uint8_t code, uint8_t const *attrs, size_t attrs_len) |
| Build a packet with a header, and the given attributes. | |
| static size_t | make_valid (uint8_t *out, uint8_t code) |
| Make a packet whose attributes are a User-Name of "ab". | |
| static fr_bio_verify_action_t | stream_verify (fr_radius_bio_verify_t *ctx, uint8_t const *buf, size_t in_buffer, size_t *size_out) |
| Call the stream verify callback on a buffer holding in_buffer bytes. | |
| static fr_radius_bio_verify_t | test_ctx (void) |
| Make a verify context which allows Access-Request and Access-Accept. | |
| static void | test_datagram_discard (void) |
| A datagram which is not a good packet is discarded, and never closes the socket. | |
| static void | test_datagram_one_packet (void) |
| A datagram holds one packet, and trailing bytes are padding. | |
| static fr_bio_t * | test_mem_alloc (TALLOC_CTX *ctx, fr_bio_t **source_p, fr_radius_bio_verify_t *vctx) |
| A memory bio in front of a pipe, which stands in for the network. | |
| static void | test_mem_fatal (void) |
| A packet which cannot be skipped fails the read. | |
| static void | test_mem_split_packet (void) |
| A packet which arrives in pieces is returned when the packet is complete, and the connection stays open. | |
| static void | test_mem_two_packets (void) |
| Packets which arrive together are returned one at a time. | |
| static void | test_mem_unknown_code_keeps_next_packet (void) |
| A packet which the module does not accept does not take the packets after it. | |
| static ssize_t | test_source_write (fr_bio_t *source, uint8_t const *data, size_t size) |
| Put bytes where the memory bio's reads will find them. | |
| static void | test_stream_fatal (void) |
| Errors which leave the stream without a known start of the next packet close the connection. | |
| static void | test_stream_not_allowed (void) |
| A packet with a code which is known, but not allowed, is skipped. | |
| static void | test_stream_one_packet (void) |
| A complete packet is returned, and only that packet. | |
| static void | test_stream_partial_packet (void) |
| A packet which is not all in the buffer asks for the rest of the packet. | |
| static void | test_stream_short_buffer (void) |
| A buffer which holds less than a header asks for the header. | |
| static void | test_stream_too_large (void) |
| A packet which is larger than the module allows closes the connection, even when only the header has arrived. | |
| static void | test_stream_too_many_attributes (void) |
| A packet with more attributes than the limit is skipped, and the packets after it are kept. | |
| static void | test_stream_unknown_code (void) |
| A packet with a code which the module does not know is skipped, and the packets after it are kept. | |
Variables | |
| static fr_bio_cb_funcs_t | test_cb |
| TEST_LIST | |
Tests for the RADIUS bio verify callbacks.
The verify callbacks are fr_radius_bio_verify() for stream sockets, and fr_radius_bio_verify_datagram() for datagram sockets. The tests call the callbacks directly, and the stream callback also through a memory bio.
Definition in file radius_bio_tests.c.
| #define BAD | ( | _name, | |
| ... | |||
| ) | { _name, (uint8_t const[]) { __VA_ARGS__ }, sizeof((uint8_t const[]) { __VA_ARGS__ }) } |
| #define MAX_PACKET_SIZE 4096 |
Definition at line 37 of file radius_bio_tests.c.
| #define MESSAGE_AUTHENTICATOR 80 |
Definition at line 35 of file radius_bio_tests.c.
|
static |
Definition at line 39 of file radius_bio_tests.c.
|
static |
Definition at line 40 of file radius_bio_tests.c.
|
static |
Call the datagram verify callback on a buffer holding in_buffer bytes.
Definition at line 113 of file radius_bio_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Build a packet with a header, and the given attributes.
| [out] | out | where to write the packet. |
| [in] | code | of the packet. |
| [in] | attrs | to copy after the header, which may be NULL. |
| [in] | attrs_len | length of the attributes. |
Definition at line 72 of file radius_bio_tests.c.
Here is the caller graph for this function:Make a packet whose attributes are a User-Name of "ab".
Definition at line 89 of file radius_bio_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Call the stream verify callback on a buffer holding in_buffer bytes.
Definition at line 98 of file radius_bio_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Make a verify context which allows Access-Request and Access-Accept.
Definition at line 52 of file radius_bio_tests.c.
Here is the caller graph for this function:
|
static |
A datagram which is not a good packet is discarded, and never closes the socket.
Definition at line 374 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A datagram holds one packet, and trailing bytes are padding.
Definition at line 354 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A memory bio in front of a pipe, which stands in for the network.
Definition at line 437 of file radius_bio_tests.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
A packet which cannot be skipped fails the read.
Definition at line 563 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A packet which arrives in pieces is returned when the packet is complete, and the connection stays open.
Definition at line 494 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
Packets which arrive together are returned one at a time.
Definition at line 533 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A packet which the module does not accept does not take the packets after it.
Definition at line 462 of file radius_bio_tests.c.
Here is the call graph for this function:Put bytes where the memory bio's reads will find them.
Definition at line 455 of file radius_bio_tests.c.
Here is the caller graph for this function:
|
static |
Errors which leave the stream without a known start of the next packet close the connection.
Definition at line 264 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A packet with a code which is known, but not allowed, is skipped.
Definition at line 225 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A complete packet is returned, and only that packet.
Definition at line 155 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A packet which is not all in the buffer asks for the rest of the packet.
Definition at line 179 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A buffer which holds less than a header asks for the header.
Definition at line 132 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A packet which is larger than the module allows closes the connection, even when only the header has arrived.
Definition at line 316 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A packet with more attributes than the limit is skipped, and the packets after it are kept.
Definition at line 240 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
A packet with a code which the module does not know is skipped, and the packets after it are kept.
Definition at line 198 of file radius_bio_tests.c.
Here is the call graph for this function:
|
static |
Definition at line 42 of file radius_bio_tests.c.
| TEST_LIST |
Definition at line 585 of file radius_bio_tests.c.
1.9.8