![]() |
The FreeRADIUS server $Id: a4e7f8c94e8038b7627bcf52356b7ed15955c1d7 $
|
Provides a test harness for various internal libraries and functions. More...
#include <freeradius-devel/io/test_point.h>#include <freeradius-devel/server/cf_parse.h>#include <freeradius-devel/server/command.h>#include <freeradius-devel/server/dependency.h>#include <freeradius-devel/server/dl_module.h>#include <freeradius-devel/server/log.h>#include <freeradius-devel/server/map.h>#include <freeradius-devel/unlang/base.h>#include <freeradius-devel/unlang/xlat_func.h>#include <freeradius-devel/util/lsan.h>#include <freeradius-devel/util/atexit.h>#include <freeradius-devel/util/base64.h>#include <freeradius-devel/util/calc.h>#include <freeradius-devel/util/conf.h>#include <freeradius-devel/util/dns.h>#include <freeradius-devel/util/file.h>#include <freeradius-devel/util/skip.h>#include <freeradius-devel/util/pair_legacy.h>#include <freeradius-devel/util/rand.h>#include <freeradius-devel/util/sha1.h>#include <freeradius-devel/util/syserror.h>#include <freeradius-devel/util/dict_priv.h>#include <assert.h>#include <fcntl.h>#include <libgen.h>#include <sys/file.h>#include <sys/stat.h>#include <sys/wait.h>
Include dependency graph for unit_test_attribute.c:Go to the source code of this file.
Data Structures | |
| struct | command_config_t |
| Configuration parameters passed to command functions. More... | |
| struct | command_entry_t |
| struct | command_file_ctx_t |
| struct | command_line_range_t |
| struct | command_result_t |
| union | command_result_t.__unnamed24__ |
Macros | |
| #define | ATTR_COMMON |
| #define | BUFF_POISON_END 0 |
| #define | BUFF_POISON_START 0 |
| #define | CLEAR_TEST_POINT(_cc) |
| #define | COMMAND_OUTPUT_MAX 8192 |
| #define | DEFAULT_BUFFER_SIZE 1024 |
| Default buffer size for a command_file_ctx_t. | |
| #define | EXIT_WITH_FAILURE |
| #define | EXIT_WITH_FAILURE |
| #define | POISONED_BUFFER_END(_p) ((_p) + BUFF_POISON_START + (talloc_array_length(_p) - (BUFF_POISON_START + BUFF_POISON_END))) |
| #define | POISONED_BUFFER_START(_p) ((_p) + BUFF_POISON_START) |
| #define | RETURN_COMMAND_ERROR() |
| #define | RETURN_EXIT(_ret) |
| #define | RETURN_MISMATCH(_len) |
| #define | RETURN_NOOP(_len) |
| #define | RETURN_OK(_len) |
| #define | RETURN_OK_WITH_ERROR() |
| #define | RETURN_PARSE_ERROR(_offset) |
| #define | RETURN_SKIP_FILE() |
| #define | SBUFF_RETURN_OK_WITH_ERROR(_function, ...) |
Typedefs | |
| typedef size_t(* | command_func_t) (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| Command to execute. | |
| typedef ssize_t(* | command_tmpl_rule_func) (TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
| Callback for a tmpl rule parser. | |
| typedef struct request_s | request_t |
Enumerations | |
| enum | command_rcode_t : uint8_t { RESULT_OK = 0 , RESULT_NOOP , RESULT_SKIP_FILE , RESULT_PARSE_ERROR , RESULT_COMMAND_ERROR , RESULT_MISMATCH , RESULT_EXIT } |
Functions | |
| static int | _command_ctx_free (command_file_ctx_t *cc) |
| static size_t | command_allow_unresolved (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Determine if unresolved attributes are allowed. | |
| static size_t | command_attr_children (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Print attribute information. | |
| static size_t | command_attr_flags (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Print attribute information. | |
| static size_t | command_attr_name (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Print attribute information. | |
| static size_t | command_attr_oid (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Print attribute information. | |
| static size_t | command_attr_type (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Print attribute information. | |
| static size_t | command_calc (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Perform calculations. | |
| static size_t | command_calc_nary (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Perform calculations on multi-valued ops. | |
| static size_t | command_cast (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Perform casting. | |
| static size_t | command_cd (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Change the working directory. | |
| static size_t | command_clear (command_result_t *result, UNUSED command_file_ctx_t *cc, char *data, size_t UNUSED data_used, UNUSED char *in, UNUSED size_t inlen) |
| static size_t | command_comment (UNUSED command_result_t *result, UNUSED command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, UNUSED char *in, UNUSED size_t inlen) |
| Placeholder function for comments. | |
| static size_t | command_condition_normalise (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Parse and reprint a condition. | |
| static size_t | command_count (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, UNUSED char *in, UNUSED size_t inlen) |
| static command_file_ctx_t * | command_ctx_alloc (TALLOC_CTX *ctx, command_config_t const *config, char const *path, char const *filename) |
| static void | command_ctx_reset (command_file_ctx_t *cc, TALLOC_CTX *ctx) |
| static size_t | command_de_encode_pair (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| Decode hex data into pairs, and then encode the pairs again. | |
| static size_t | command_decode_dns_label (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| static size_t | command_decode_pair (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| static size_t | command_decode_proto (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| static size_t | command_dictionary_attribute_parse (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse a dictionary attribute, writing "ok" to the data buffer is everything was ok. | |
| static size_t | command_dictionary_dump (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, size_t data_used, UNUSED char *in, UNUSED size_t inlen) |
| Print the currently loaded dictionary. | |
| static size_t | command_dictionary_read (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Read a dictionary from a file, and then free it. | |
| static size_t | command_encode_dns_label (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| static size_t | command_encode_pair (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| static size_t | command_encode_proto (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| static size_t | command_encode_raw (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Encode a RADIUS attribute writing the result to the data buffer as space separated hexits. | |
| static size_t | command_eof (UNUSED command_result_t *result, UNUSED command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, UNUSED char *in, UNUSED size_t inlen) |
| Command eof. | |
| static size_t | command_exit (command_result_t *result, UNUSED command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Exit gracefully with the specified code. | |
| static int | command_func (UNUSED FILE *fp, UNUSED FILE *fp_err, UNUSED void *ctx, UNUSED fr_cmd_info_t const *info) |
| static size_t | command_fuzzer_out (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Enable fuzzer output. | |
| static size_t | command_include (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Execute another test file. | |
| static size_t | command_load_dictionary (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| static size_t | command_match (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| Compare the data buffer to an expected value. | |
| static size_t | command_match_regex (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| Compare the data buffer against an expected expression. | |
| static size_t | command_max_buffer_size (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Artificially limit the maximum packet size. | |
| static size_t | command_migrate (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Set or clear migration flags. | |
| static size_t | command_need_feature (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Skip the test file if we're missing a particular feature. | |
| static size_t | command_no (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| Negate the result of a match command or any command which returns "OK". | |
| static size_t | command_pair (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| static size_t | command_pair_common (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, size_t inlen, bool allow_compare) |
| Parse an print an attribute pair or pair list. | |
| static size_t | command_pair_compare (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| static void | command_print (void) |
| static size_t | command_proto (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Dynamically load a protocol library. | |
| static size_t | command_proto_dictionary (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| static size_t | command_proto_dictionary_root (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| static size_t | command_radmin_add (command_result_t *result, command_file_ctx_t *cc, char *data, size_t UNUSED data_used, char *in, UNUSED size_t inlen) |
| static size_t | command_radmin_tab (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| static size_t | command_rand_seed (command_result_t *result, UNUSED command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Seed the random number generator, so fr_rand() returns a fixed sequence. | |
| static size_t | command_read_file (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse a list of pairs. | |
| static size_t | command_returned (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, UNUSED char *in, UNUSED size_t inlen) |
| static size_t | command_tmpl (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse an reprint a tmpl expansion. | |
| static ssize_t | command_tmpl_rule_allow_foreign (UNUSED TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
| static ssize_t | command_tmpl_rule_allow_unknown (UNUSED TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
| static ssize_t | command_tmpl_rule_allow_unresolved (UNUSED TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
| static ssize_t | command_tmpl_rule_attr_parent (UNUSED TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
| static ssize_t | command_tmpl_rule_list_def (UNUSED TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
| static ssize_t | command_tmpl_rule_request_def (TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
| static size_t | command_tmpl_rules (command_result_t *result, command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, size_t inlen) |
| static size_t | command_touch (command_result_t *result, UNUSED command_file_ctx_t *cc, UNUSED char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Touch a file to indicate a test completed. | |
| static size_t | command_value_box_normalise (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| static int | command_walk (UNUSED void *ctx, fr_cmd_walk_info_t *info) |
| static size_t | command_write (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| static size_t | command_xlat_argv (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse an reprint and xlat argv expansion. | |
| static size_t | command_xlat_expr (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse and reprint an xlat expression expansion. | |
| static size_t | command_xlat_normalise (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse an reprint and xlat expansion. | |
| static size_t | command_xlat_purify (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse, purify, and reprint an xlat expression expansion. | |
| static size_t | command_xlat_purify_condition (command_result_t *result, command_file_ctx_t *cc, char *data, UNUSED size_t data_used, char *in, UNUSED size_t inlen) |
| Parse, purify, and reprint an xlat expression expansion. | |
| static void | commands_print (void) |
| static int | decode_attr (char *buffer, char **endptr) |
| static size_t | decode_pair (command_result_t *result, command_file_ctx_t *cc, char *data, char *in, size_t inlen, fr_pair_t **head_p, char **hex_p) |
| Decode hex data into a list of pairs. | |
| static int | decode_vendor (char *buffer, char **endptr) |
| static fr_dict_t * | dictionary_current (command_file_ctx_t *cc) |
| static int | dictionary_load_common (command_result_t *result, command_file_ctx_t *cc, char const *in, char const *default_subdir) |
| Common dictionary load function. | |
| static int | dump_fuzzer_data (int fd_dir, char const *text, uint8_t const *data, size_t data_len) |
| static ssize_t | encode_data (char *p, uint8_t *output, size_t outlen) |
| static ssize_t | encode_data_string (char *buffer, uint8_t *output, size_t outlen) |
| static ssize_t | encode_data_tlv (char *buffer, char **endptr, uint8_t *output, size_t outlen) |
| static ssize_t | encode_evs (char *buffer, uint8_t *output, size_t outlen) |
| static ssize_t | encode_extended (char *buffer, uint8_t *output, size_t outlen) |
| static ssize_t | encode_long_extended (char *buffer, uint8_t *output, size_t outlen) |
| static size_t | encode_pair (command_result_t *result, command_file_ctx_t *cc, char *data, fr_test_point_pair_encode_t *tp, void *encode_ctx, fr_pair_list_t *head, bool truncate, char const *fuzzer_text) |
| Encode a list of pairs, writing the result to the data buffer as hex. | |
| static ssize_t | encode_rfc (char *buffer, uint8_t *output, size_t outlen) |
| static ssize_t | encode_tlv (char *buffer, uint8_t *output, size_t outlen) |
| static ssize_t | encode_vsa (char *buffer, uint8_t *output, size_t outlen) |
| static void | features_print (CONF_SECTION *features) |
| static int | fuzzer_open_fd (command_file_ctx_t *cc, char **out, char const *base, char const *dir) |
| Helper function to open a fuzzer path, and update the name / FD. | |
| static size_t | hex_print (char *out, size_t outlen, uint8_t const *in, size_t inlen) |
| Print hex string to buffer. | |
| static ssize_t | hex_to_bin (uint8_t *out, size_t outlen, char *in, size_t inlen) |
| static int | line_ranges_parse (TALLOC_CTX *ctx, fr_dlist_head_t *out, fr_sbuff_t *in) |
| static ssize_t | load_proto_library (char const *proto_name) |
| static ssize_t | load_test_point_by_command (void **symbol, char *command, char const *dflt_symbol) |
| int | main (int argc, char *argv[]) |
| static void | mismatch_print (command_file_ctx_t *cc, char const *command, char *expected, size_t expected_len, char *got, size_t got_len, bool print_diff) |
| static size_t | parse_typed_value (command_result_t *result, command_file_ctx_t *cc, fr_value_box_t *box, char const **out, char const *in, size_t inlen) |
| static int | poisoned_buffer_allocate (TALLOC_CTX *ctx, uint8_t **buff, size_t size) |
| Allocate a special buffer with poisoned memory regions at the start and end. | |
| static int | process_file (bool *exit_now, TALLOC_CTX *ctx, command_config_t const *config, const char *root_dir, char const *filename, fr_dlist_head_t *lines) |
| size_t | process_line (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
| size_t | process_line (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, UNUSED size_t inlen) |
| static int | process_path (bool *exit_now, TALLOC_CTX *ctx, command_config_t const *config, const char *path) |
| static void | shell_word_print (FILE *fp, char const *str) |
| Print a string as a single shell word. | |
| static void | unload_proto_library (void) |
| static void | usage (char const *name) |
| static xlat_action_t | xlat_test (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, UNUSED xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in) |
Variables | |
| static bool | allow_purify = false |
| static fr_cmd_t * | command_head = NULL |
| static fr_table_num_sorted_t | command_rcode_table [] |
| static size_t | command_rcode_table_len = NUM_ELEMENTS(command_rcode_table) |
| static fr_table_ptr_sorted_t | commands [] |
| static size_t | commands_len = NUM_ELEMENTS(commands) |
| static dl_t * | dl = NULL |
| static dl_loader_t * | dl_loader = NULL |
| static fr_event_list_t * | el = NULL |
| static char const * | fail_file = "" |
| static char const * | fail_message = NULL |
| static char const | hextab [] = "0123456789abcdef" |
| static char | proto_name_prev [128] = {} |
| static char const * | receipt_dir = NULL |
| static char const * | receipt_file = NULL |
| static const fr_token_t | token2op [SBUFF_CHAR_CLASS] |
| static char const * | write_filename = NULL |
| static FILE * | write_fp = NULL |
| static xlat_arg_parser_t const | xlat_test_args [] |
| static xlat_arg_parser_t const | xlat_test_no_args [] |
Provides a test harness for various internal libraries and functions.
Definition in file unit_test_attribute.c.
| struct command_config_t |
Configuration parameters passed to command functions.
Definition at line 191 of file unit_test_attribute.c.
Collaboration diagram for command_config_t:| Data Fields | ||
|---|---|---|
| char const * | confdir | |
| fr_dict_t * | dict | Dictionary to "reset" to. |
| char const * | dict_dir | |
| fr_dict_gctx_t const * | dict_gctx | Dictionary gctx to "reset" to. |
| CONF_SECTION * | features | Enabled features. |
| char const * | fuzzer_base_dir | Base directory of where to write fuzzer files, from '-F'. |
| struct command_entry_t |
Definition at line 245 of file unit_test_attribute.c.
Collaboration diagram for command_entry_t:| Data Fields | ||
|---|---|---|
| char const * | description | |
| command_func_t | func | |
| char const * | usage | |
| struct command_file_ctx_t |
Definition at line 200 of file unit_test_attribute.c.
Collaboration diagram for command_file_ctx_t:| Data Fields | ||
|---|---|---|
| uint8_t * | buffer | Temporary resizable buffer we use for holding non-string data. |
| uint8_t * | buffer_end | Where the non-poisoned region of the buffer ends. |
| uint8_t * | buffer_start | Where the non-poisoned region of the buffer starts. |
| command_config_t const * | config | |
| char const * | filename | Current file we're operating on. |
| int | fuzzer_fd | File descriptor pointing to a a directory to write fuzzer output. |
| char * | fuzzer_proto_dir | Subdirectory of where to write fuzzer files, from 'fuzzer-out dir'. |
| ssize_t | last_ret | Last return value. |
| uint32_t | lineno | Current line number. |
| char * | path | Current path we're operating in. |
| uint32_t | test_count | How many tests we've executed in this file. |
| fr_dict_gctx_t const * | test_gctx | Dictionary context for test dictionaries. |
| fr_dict_t * | test_internal_dict | Internal dictionary of test_gctx. |
| TALLOC_CTX * | tmp_ctx | Talloc context for test points. |
| tmpl_rules_t | tmpl_rules | To pass to parsing functions. |
| struct command_line_range_t |
Definition at line 227 of file unit_test_attribute.c.
Collaboration diagram for command_line_range_t:| Data Fields | ||
|---|---|---|
| uint32_t | end | End of line range. |
| fr_dlist_t | entry | Entry in the dlist. |
| uint32_t | start | Start of line range. |
| struct command_result_t |
Definition at line 175 of file unit_test_attribute.c.
| Data Fields | ||
|---|---|---|
| union command_result_t.__unnamed24__ | __unnamed__ | |
| bool | error_to_data | |
| char const * | file | |
| int | line | |
| command_rcode_t | rcode | |
| TALLOC_CTX * | tmp_ctx | Temporary context to hold buffers in this. |
| union command_result_t.__unnamed24__ |
Definition at line 178 of file unit_test_attribute.c.
| Data Fields | ||
|---|---|---|
| size_t | offset | Where we failed parsing the command. |
| int | ret | What code we should exit with. |
| #define ATTR_COMMON |
Definition at line 1227 of file unit_test_attribute.c.
| #define BUFF_POISON_END 0 |
Definition at line 305 of file unit_test_attribute.c.
| #define BUFF_POISON_START 0 |
Definition at line 304 of file unit_test_attribute.c.
| #define CLEAR_TEST_POINT | ( | _cc | ) |
Definition at line 1164 of file unit_test_attribute.c.
| #define COMMAND_OUTPUT_MAX 8192 |
Definition at line 74 of file unit_test_attribute.c.
| #define DEFAULT_BUFFER_SIZE 1024 |
Default buffer size for a command_file_ctx_t.
Definition at line 152 of file unit_test_attribute.c.
| #define EXIT_WITH_FAILURE |
Definition at line 68 of file unit_test_attribute.c.
| #define EXIT_WITH_FAILURE |
Definition at line 68 of file unit_test_attribute.c.
| #define POISONED_BUFFER_END | ( | _p | ) | ((_p) + BUFF_POISON_START + (talloc_array_length(_p) - (BUFF_POISON_START + BUFF_POISON_END))) |
Definition at line 348 of file unit_test_attribute.c.
| #define POISONED_BUFFER_START | ( | _p | ) | ((_p) + BUFF_POISON_START) |
Definition at line 347 of file unit_test_attribute.c.
| #define RETURN_COMMAND_ERROR | ( | ) |
Definition at line 118 of file unit_test_attribute.c.
| #define RETURN_EXIT | ( | _ret | ) |
Definition at line 134 of file unit_test_attribute.c.
| #define RETURN_MISMATCH | ( | _len | ) |
Definition at line 126 of file unit_test_attribute.c.
| #define RETURN_NOOP | ( | _len | ) |
Definition at line 93 of file unit_test_attribute.c.
| #define RETURN_OK | ( | _len | ) |
Definition at line 76 of file unit_test_attribute.c.
| #define RETURN_OK_WITH_ERROR | ( | ) |
Definition at line 84 of file unit_test_attribute.c.
| #define RETURN_PARSE_ERROR | ( | _offset | ) |
Definition at line 109 of file unit_test_attribute.c.
| #define RETURN_SKIP_FILE | ( | ) |
Definition at line 101 of file unit_test_attribute.c.
| #define SBUFF_RETURN_OK_WITH_ERROR | ( | _function, | |
| ... | |||
| ) |
Definition at line 143 of file unit_test_attribute.c.
| typedef size_t(* command_func_t) (command_result_t *result, command_file_ctx_t *cc, char *data, size_t data_used, char *in, size_t inlen) |
Command to execute.
| [out] | result | Of executing the command. |
| [in] | cc | Information about the file being processed. |
| [in,out] | data | Output of this command, or the previous command. |
| [in] | data_used | Length of data in the data buffer. |
| [in] | in | Command text to process. |
| [in] | inlen | Length of the remainder of the command to process. |
Definition at line 242 of file unit_test_attribute.c.
| typedef ssize_t(* command_tmpl_rule_func) (TALLOC_CTX *ctx, tmpl_rules_t *rules, fr_sbuff_t *value) |
Callback for a tmpl rule parser.
Definition at line 3088 of file unit_test_attribute.c.
Definition at line 28 of file unit_test_attribute.c.
| enum command_rcode_t : uint8_t |
Definition at line 154 of file unit_test_attribute.c.
|
static |
Definition at line 3989 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Determine if unresolved attributes are allowed.
Definition at line 1212 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Print attribute information.
Definition at line 1246 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Print attribute information.
Definition at line 1286 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Print attribute information.
Definition at line 1300 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Print attribute information.
Definition at line 1314 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Print attribute information.
Definition at line 1328 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Perform calculations.
Definition at line 1353 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Perform calculations on multi-valued ops.
Definition at line 1438 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Perform casting.
Definition at line 1503 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Change the working directory.
Definition at line 1553 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Definition at line 1569 of file unit_test_attribute.c.
|
static |
Placeholder function for comments.
Definition at line 1173 of file unit_test_attribute.c.
|
static |
Parse and reprint a condition.
Definition at line 1690 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
Definition at line 4006 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 4061 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Decode hex data into pairs, and then encode the pairs again.
The test point for the decoder can be given as "de-encode-pair.<symbol>". The encoder always uses the default test point of the protocol, as there is only one place to name a test point.
Definition at line 2368 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
|
static |
|
static |
Parse a dictionary attribute, writing "ok" to the data buffer is everything was ok.
Definition at line 2007 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Print the currently loaded dictionary.
Definition at line 2056 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Read a dictionary from a file, and then free it.
Definition at line 2018 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
|
static |
|
static |
Encode a RADIUS attribute writing the result to the data buffer as space separated hexits.
Definition at line 2405 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Command eof.
Mark the end of a test file if we're reading from stdin.
Doesn't actually do anything, is just a placeholder for the command processing loop.
Definition at line 2553 of file unit_test_attribute.c.
Here is the caller graph for this function:
|
static |
Exit gracefully with the specified code.
Definition at line 2650 of file unit_test_attribute.c.
|
static |
|
static |
Enable fuzzer output.
Any commands that produce potentially useful corpus seed data will write that out data to files in the specified directory, using the md5 of the text input at as the file name.
The output directory given here is appended to the path given by '-F path'.
If there's no '-F path' command-line option set, then the path of the current file is used as the base directory.
Definition at line 2629 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Execute another test file.
Definition at line 1182 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
Compare the data buffer to an expected value.
Definition at line 2702 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Compare the data buffer against an expected expression.
Definition at line 2726 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Artificially limit the maximum packet size.
Definition at line 2756 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Set or clear migration flags.
Definition at line 2784 of file unit_test_attribute.c.
|
static |
Skip the test file if we're missing a particular feature.
Definition at line 2827 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Negate the result of a match command or any command which returns "OK".
Definition at line 2850 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
Parse an print an attribute pair or pair list.
Definition at line 2882 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Definition at line 1151 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Dynamically load a protocol library.
Definition at line 2943 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
|
static |
|
static |
|
static |
Seed the random number generator, so fr_rand() returns a fixed sequence.
Definition at line 3010 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Parse a list of pairs.
Definition at line 2427 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
Parse an reprint a tmpl expansion.
Definition at line 3035 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Definition at line 3090 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 3100 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 3110 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 3120 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 3134 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 3148 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Touch a file to indicate a test completed.
Definition at line 3076 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
|
static |
|
static |
|
static |
Parse an reprint and xlat argv expansion.
Definition at line 3540 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Parse and reprint an xlat expression expansion.
Definition at line 3381 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Parse an reprint and xlat expansion.
Definition at line 3335 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Parse, purify, and reprint an xlat expression expansion.
Definition at line 3416 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Parse, purify, and reprint an xlat expression expansion.
Definition at line 3478 of file unit_test_attribute.c.
Here is the call graph for this function:
|
static |
Definition at line 4291 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
Decode hex data into a list of pairs.
Shared by "decode-pair" and "de-encode-pair". The decoded pairs are the children of *head_p, and are allocated in cc->tmp_ctx. The caller has to clear that context once it is finished with them.
| [out] | result | of the command, when this function fails. |
| [in] | cc | command file context. |
| [in,out] | data | data buffer, which holds the input hex, and is then used as scratch space. |
| [in] | in | text of the command, which starts with the test point. |
| [in] | inlen | length of "in". |
| [out] | head_p | pair which holds the decoded pairs. |
| [out] | hex_p | where the hex data started in "in". The caller needs it in order to look for a second test point. May be NULL. |
Definition at line 1766 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
|
static |
|
static |
Common dictionary load function.
Callers call fr_dict_global_ctx_set to set the context the dictionaries will be loaded into.
Definition at line 997 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Definition at line 423 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 603 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 535 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 769 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 794 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 819 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Encode a list of pairs, writing the result to the data buffer as hex.
Shared by "encode-pair" and "de-encode-pair". The pair list and the test point context are freed here, which means that the caller cannot use either one afterwards.
| [out] | result | of the command. It is always filled in, so the caller returns whatever this function returns. |
| [in] | cc | command file context. |
| [out] | data | data buffer, where the hex output is written. |
| [in] | tp | encoder test point. |
| [in] | encode_ctx | context for the encoder test point. |
| [in] | head | pairs to encode. |
| [in] | truncate | run the truncate torture test. |
| [in] | fuzzer_text | name the corpus seed file after this text, or NULL to write no seed file. |
Definition at line 2185 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 870 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 714 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Definition at line 745 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 4279 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Helper function to open a fuzzer path, and update the name / FD.
Definition at line 2562 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
inlinestatic |
Print hex string to buffer.
Definition at line 398 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 4303 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 921 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 948 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
Definition at line 4557 of file unit_test_attribute.c.
|
static |
|
static |
Definition at line 1044 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:Allocate a special buffer with poisoned memory regions at the start and end.
Definition at line 311 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Definition at line 4084 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:| size_t process_line | ( | command_result_t * | result, |
| command_file_ctx_t * | cc, | ||
| char * | data, | ||
| size_t | data_used, | ||
| char * | in, | ||
| size_t | inlen | ||
| ) |
Here is the caller graph for this function:| size_t process_line | ( | command_result_t * | result, |
| command_file_ctx_t * | cc, | ||
| char * | data, | ||
| size_t | data_used, | ||
| char * | in, | ||
| UNUSED size_t | inlen | ||
| ) |
|
static |
Definition at line 4387 of file unit_test_attribute.c.
Here is the call graph for this function:
Here is the caller graph for this function:
|
static |
Print a string as a single shell word.
The failure message is usually a command for a shell, and a file name containing spaces, quotes, or glob characters must reach the shell as one word. Because a single quote cannot appear between single quotes, each single quote in str becomes '\'', which closes the quoted section, adds an escaped quote, and opens a new quoted section.
Definition at line 4538 of file unit_test_attribute.c.
Here is the caller graph for this function:
|
static |
|
static |
Definition at line 4260 of file unit_test_attribute.c.
|
static |
|
static |
Definition at line 273 of file unit_test_attribute.c.
|
static |
Definition at line 1129 of file unit_test_attribute.c.
|
static |
Definition at line 165 of file unit_test_attribute.c.
|
static |
Definition at line 173 of file unit_test_attribute.c.
|
static |
Definition at line 3590 of file unit_test_attribute.c.
|
static |
Definition at line 3898 of file unit_test_attribute.c.
|
static |
Definition at line 268 of file unit_test_attribute.c.
|
static |
Definition at line 269 of file unit_test_attribute.c.
|
static |
Definition at line 271 of file unit_test_attribute.c.
|
static |
Definition at line 280 of file unit_test_attribute.c.
|
static |
Definition at line 281 of file unit_test_attribute.c.
|
static |
Definition at line 487 of file unit_test_attribute.c.
|
static |
Definition at line 267 of file unit_test_attribute.c.
|
static |
Definition at line 279 of file unit_test_attribute.c.
|
static |
Definition at line 278 of file unit_test_attribute.c.
|
static |
|
static |
Definition at line 275 of file unit_test_attribute.c.
|
static |
Definition at line 276 of file unit_test_attribute.c.
|
static |
Definition at line 251 of file unit_test_attribute.c.
|
static |
Definition at line 256 of file unit_test_attribute.c.
1.9.8