OpenVPN
|
#include "options.h"
Go to the source code of this file.
Functions | |
const char * | parse_auth_failed_temp (struct options *o, const char *reason) |
bool | valid_integer (const char *str, bool positive) |
Checks if the string is a valid integer by checking if it can be converted to an integer. | |
int | positive_atoi (const char *str, int msglevel) |
Converts a str to a positive number if the string represents a postive integer number. | |
int | atoi_warn (const char *str, int msglevel) |
Converts a str to an integer if the string can be represented as an integer number. | |
bool | atoi_constrained (const char *str, int *value, const char *name, int min, int max, int msglevel) |
Converts a str to an integer if the string can be represented as an integer number and is between min and max . | |
bool | apply_pull_filter (const struct options *o, char *line) |
Filter an option line by all pull filters. | |
bool | check_push_update_option_flags (char *line, int *i, unsigned int *flags) |
Checks the formatting and validity of options inside push-update messages. | |
bool apply_pull_filter | ( | const struct options * | o, |
char * | line | ||
) |
Filter an option line by all pull filters.
If a match is found, the line is modified depending on the filter type, and returns true. If the filter type is reject, SIGUSR1 is triggered and the return value is false. In that case the caller must end the push processing.
Definition at line 252 of file options_util.c.
References D_LOW, D_PUSH, pull_filter_list::head, M_WARN, msg, pull_filter::next, pull_filter::pattern, PUF_TYPE_ACCEPT, PUF_TYPE_IGNORE, PUF_TYPE_REJECT, options::pull_filter_list, pull_filter::size, and pull_filter::type.
Referenced by apply_push_options().
bool atoi_constrained | ( | const char * | str, |
int * | value, | ||
const char * | name, | ||
int | min, | ||
int | max, | ||
int | msglevel | ||
) |
Converts a str to an integer if the string can be represented as an integer number and is between min
and max
.
The integer is stored in value
. On error, print a warning with msglevel
using name
. value
is not changed on error.
true
if the integer has been parsed and stored in value, false
otherwise Definition at line 150 of file options_util.c.
References ASSERT, i, and msg.
Referenced by add_option(), and test_atoi_variants().
int atoi_warn | ( | const char * | str, |
int | msglevel | ||
) |
Converts a str to an integer if the string can be represented as an integer number.
Otherwise print a warning with msglevel
and return 0
Definition at line 135 of file options_util.c.
Referenced by add_option(), and test_atoi_variants().
bool check_push_update_option_flags | ( | char * | line, |
int * | i, | ||
unsigned int * | flags | ||
) |
Checks the formatting and validity of options inside push-update messages.
This function is used to validate and process options in push-update messages. It performs the following checks:
-
flag, which indicates that the option should be removed.?
flag, which marks the option as optional and suppresses errors if the client cannot update it.and
'?'flags after validating them and updating the appropriate flags in the
flagsvariable. -
-?option,
-option,
?optionare valid formats,
?-optionis not a valid format.
If the flags and the option are not consecutive, the option is invalid:
- ?option,
-? option,
- option` are invalid formats.line | A pointer to an option string. This string is the option being validated. |
i | A pointer to an integer that represents the current index in the line string. |
flags | A pointer where flags will be stored:
|
-
and ?
flags are not formatted correctly.line
parameter is empty or NULL
.?
flag is absent and the option is not updatable. Definition at line 190 of file options_util.c.
References D_PUSH, i, M_WARN, msg, PUSH_OPT_OPTIONAL, PUSH_OPT_TO_REMOVE, and updatable_options.
Referenced by apply_push_options().
const char * parse_auth_failed_temp | ( | struct options * | o, |
const char * | reason | ||
) |
Definition at line 35 of file options_util.c.
References options::advance_next_remote, D_PUSH, D_PUSH_ERRORS, gc, gc_free(), gc_new(), msg, options::no_advance, options::server_backoff_time, and string_alloc().
Referenced by receive_auth_failed(), test_auth_fail_temp_flags(), test_auth_fail_temp_flags_msg(), and test_auth_fail_temp_no_flags().
int positive_atoi | ( | const char * | str, |
int | msglevel | ||
) |
Converts a str to a positive number if the string represents a postive integer number.
Otherwise print a warning with msglevel and return 0
Definition at line 120 of file options_util.c.
Referenced by add_option(), and test_atoi_variants().
bool valid_integer | ( | const char * | str, |
bool | positive | ||
) |
Checks if the string is a valid integer by checking if it can be converted to an integer.
Definition at line 104 of file options_util.c.
References i.
Referenced by add_option(), and test_atoi_variants().