![]() |
The FreeRADIUS server $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
Parse on-disk text based config files into the FreeRADIUS internal format. More...
#include <stddef.h>#include <stdint.h>#include <freeradius-devel/server/cf_util.h>#include <freeradius-devel/util/rb.h>#include <freeradius-devel/util/syserror.h>#include <freeradius-devel/util/table.h>#include <freeradius-devel/util/print.h>
Include dependency graph for cf_file.h:Go to the source code of this file.
Enumerations | |
| enum | cf_file_check_err_t { CF_FILE_OK = 0 , CF_FILE_NO_PERMISSION = -1 , CF_FILE_NO_EXIST = -2 , CF_FILE_NO_UNIX_SOCKET = -3 , CF_FILE_OTHER_ERROR = -4 } |
| Results of file checks. More... | |
Functions | |
| char const * | cf_expand_variables (char const *filename, int lineno, CONF_SECTION *outer_cs, char *output, size_t outsize, char const *input, ssize_t inlen, bool *soft_fail, bool soft_fail_env) |
| cf_file_check_err_t | cf_file_check (CONF_PAIR *cp, bool check_perms) |
| Do some checks on the file as an "input" file. | |
| cf_file_check_err_t | cf_file_check_effective (char const *filename, cf_file_check_err_t(*cb)(char const *filename, void *uctx), void *uctx) |
| Perform an operation with the effect/group set to conf_check_gid and conf_check_uid. | |
| cf_file_check_err_t | cf_file_check_open_read (char const *filename, void *uctx) |
| Callback for cf_file_check to open a file and check permissions. | |
| void | cf_file_check_set_uid_gid (uid_t uid, gid_t gid) |
| Set the euid/egid used when performing file checks. | |
| cf_file_check_err_t | cf_file_check_unix_connect (char const *filename, UNUSED void *uctx) |
| Check if we can connect to a unix socket. | |
| cf_file_check_err_t | cf_file_check_unix_perm (char const *filename, UNUSED void *uctx) |
| Check if file exists, and is a socket. | |
| void | cf_file_free (CONF_SECTION *cs) |
| int | cf_file_read (CONF_SECTION *cs, char const *file, bool root) |
| void | cf_md5_final (uint8_t *digest) |
| void | cf_md5_init (void) |
| int | cf_pair_write (FILE *fp, CONF_PAIR *cp) |
| CONF_ITEM * | cf_reference_item (CONF_SECTION const *parentcs, CONF_SECTION const *outercs, char const *ptr) |
| int | cf_section_pass2 (CONF_SECTION *cs) |
| void | cf_section_set_unlang (CONF_SECTION *cs) |
| int | cf_section_write (FILE *fp, CONF_SECTION *cs, int depth) |
| int | cf_section_write_children (FILE *fp, CONF_SECTION *cs, int depth) |
Emit the children of a section at depth without an enclosing { ... }. | |
Parse on-disk text based config files into the FreeRADIUS internal format.
Definition in file cf_file.h.
| enum cf_file_check_err_t |
| char const * cf_expand_variables | ( | char const * | filename, |
| int | lineno, | ||
| CONF_SECTION * | outer_cs, | ||
| char * | output, | ||
| size_t | outsize, | ||
| char const * | input, | ||
| ssize_t | inlen, | ||
| bool * | soft_fail, | ||
| bool | soft_fail_env | ||
| ) |
| cf_file_check_err_t cf_file_check | ( | CONF_PAIR * | cp, |
| bool | check_perms | ||
| ) |
Do some checks on the file as an "input" file.
i.e. one read by a module.
| cp | currently being processed. |
| check_perms | If true - will return error if file is world readable, or not readable by the unprivileged user/group. |
Definition at line 922 of file cf_file.c.
Here is the call graph for this function:
Here is the caller graph for this function:| cf_file_check_err_t cf_file_check_effective | ( | char const * | filename, |
| cf_file_check_err_t(*)(char const *filename, void *uctx) | cb, | ||
| void * | uctx | ||
| ) |
Perform an operation with the effect/group set to conf_check_gid and conf_check_uid.
| filename | CONF_PAIR for the file being checked |
| cb | callback function to perform the check |
| uctx | user context for the callback |
Definition at line 693 of file cf_file.c.
Here is the call graph for this function:
Here is the caller graph for this function:| cf_file_check_err_t cf_file_check_open_read | ( | char const * | filename, |
| void * | uctx | ||
| ) |
Callback for cf_file_check to open a file and check permissions.
This is used to check if a file exists, and is readable by the unprivileged user/group.
| filename | currently being processed. |
| uctx | user context, which is a pointer to cf_file_t |
Definition at line 872 of file cf_file.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void cf_file_check_set_uid_gid | ( | uid_t | uid, |
| gid_t | gid | ||
| ) |
Set the euid/egid used when performing file checks.
Sets the euid, and egid used when cf_file_check is called to check permissions on conf items of type CONF_FLAG_FILE_READABLE
| uid | to set, (uid_t)-1 to use current euid. |
| gid | to set, (gid_t)-1 to use current egid. |
| cf_file_check_err_t cf_file_check_unix_connect | ( | char const * | filename, |
| UNUSED void * | uctx | ||
| ) |
Check if we can connect to a unix socket.
| [in] | filename | CONF_PAIR for the unix socket path |
| [in] | uctx | user context, not used |
Definition at line 753 of file cf_file.c.
Here is the call graph for this function:
Here is the caller graph for this function:| cf_file_check_err_t cf_file_check_unix_perm | ( | char const * | filename, |
| UNUSED void * | uctx | ||
| ) |
Check if file exists, and is a socket.
| [in] | filename | CONF_PAIR for the unix socket path |
| [in] | uctx | user context, not used |
Definition at line 826 of file cf_file.c.
Here is the call graph for this function:
Here is the caller graph for this function:| void cf_file_free | ( | CONF_SECTION * | cs | ) |
| int cf_file_read | ( | CONF_SECTION * | cs, |
| char const * | file, | ||
| bool | root | ||
| ) |
| void cf_md5_final | ( | uint8_t * | digest | ) |
| void cf_md5_init | ( | void | ) |
| int cf_pair_write | ( | FILE * | fp, |
| CONF_PAIR * | cp | ||
| ) |
| CONF_ITEM * cf_reference_item | ( | CONF_SECTION const * | parentcs, |
| CONF_SECTION const * | outercs, | ||
| char const * | ptr | ||
| ) |
| int cf_section_pass2 | ( | CONF_SECTION * | cs | ) |
| void cf_section_set_unlang | ( | CONF_SECTION * | cs | ) |
| int cf_section_write | ( | FILE * | fp, |
| CONF_SECTION * | cs, | ||
| int | depth | ||
| ) |
| int cf_section_write_children | ( | FILE * | fp, |
| CONF_SECTION * | cs, | ||
| int | depth | ||
| ) |
Emit the children of a section at depth without an enclosing { ... }.
cf_section_write wraps a section in name { ... }; this helper writes only the children at the requested indent, which is what tools like radjson2conf -r need: rendering a synthetic-root section as a file-scope fragment ready to be $INCLUDEd at any depth.
Blank lines in the source come back through as NULL-text CONF_ITEM_COMMENT markers, so the writer doesn't have to synthesise its own separators - just emit what's there. Consecutive blank markers collapse to a single blank line on output so artifacts from upstream tooling (deletes that left their preceding blank behind, splits that introduced extra spacers) don't accumulate as visible whitespace.
Definition at line 3903 of file cf_file.c.
Here is the call graph for this function:
Here is the caller graph for this function:
1.9.8