#include <freeradius-devel/radiusd.h>
#include <freeradius-devel/rad_assert.h>
#include <sys/file.h>
#include <fcntl.h>
#include <ctype.h>
Go to the source code of this file.
|
void | exec_trigger (REQUEST *request, CONF_SECTION *cs, char const *name, bool quench) |
| Execute a trigger - call an executable to process an event. More...
|
|
void | exec_trigger_set_conf (CONF_SECTION *cs) |
| Set the global trigger section exec_trigger will search in. More...
|
|
int | radius_exec_program (TALLOC_CTX *ctx, char *out, size_t outlen, VALUE_PAIR **output_pairs, REQUEST *request, char const *cmd, VALUE_PAIR *input_pairs, bool exec_wait, bool shell_escape, int timeout) |
| Execute a program. More...
|
|
int | radius_readfrom_program (int fd, pid_t pid, int timeout, char *answer, int left) |
| Read from the child process. More...
|
|
pid_t | radius_start_program (char const *cmd, REQUEST *request, bool exec_wait, int *input_fd, int *output_fd, VALUE_PAIR *input_pairs, bool shell_escape) |
| Start a process. More...
|
|
static void | time_free (void *data) |
|
static void | tv_sub (struct timeval *end, struct timeval *start, struct timeval *elapsed) |
|
#define WEXITSTATUS |
( |
|
stat_val | ) |
((unsigned)(stat_val) >> 8) |
#define WIFEXITED |
( |
|
stat_val | ) |
(((stat_val) & 255) == 0) |
Execute a trigger - call an executable to process an event.
- Parameters
-
request | The current request. |
cs | to search for triggers in. If not NULL, only the portion after the last '.' in name is used for the trigger. If cs is NULL, the entire name is used to find the trigger in the global trigger section. |
name | the path relative to the global trigger section ending in the trigger name e.g. module.ldap.pool.start. |
quench | whether to rate limit triggers. |
Definition at line 686 of file exec.c.
Set the global trigger section exec_trigger will search in.
- Note
- Triggers are used by the connection pool, which is used in the server library which may not have the mainconfig available. Additionally, utilities may want to set their own root config sections.
- Parameters
-
cs | to use as global trigger section |
Definition at line 670 of file exec.c.
int radius_exec_program |
( |
TALLOC_CTX * |
ctx, |
|
|
char * |
out, |
|
|
size_t |
outlen, |
|
|
VALUE_PAIR ** |
output_pairs, |
|
|
REQUEST * |
request, |
|
|
char const * |
cmd, |
|
|
VALUE_PAIR * |
input_pairs, |
|
|
bool |
exec_wait, |
|
|
bool |
shell_escape, |
|
|
int |
timeout |
|
) |
| |
Execute a program.
- Parameters
-
[in,out] | ctx | to allocate new VALUE_PAIR (s) in. |
[out] | out | buffer to append plaintext (non valuepair) output. |
[in] | outlen | length of out buffer. |
[out] | output_pairs | list of value pairs - Data on child's stdout will be parsed and added into this list of value pairs. |
[in] | request | Current request (may be NULL). |
[in] | cmd | Command to execute. This is parsed into argv[] parts, then each individual argv part is xlat'ed. |
[in] | input_pairs | list of value pairs - these will be available in the environment of the child. |
[in] | exec_wait | set to 1 if you want to read from or write to child. |
[in] | shell_escape | values before passing them as arguments. |
[in] | timeout | amount of time to wait, in seconds. |
- Returns
- 0 if exec_wait==0.
- exit code if exec_wait!=0.
- -1 on failure.
Definition at line 531 of file exec.c.
int radius_readfrom_program |
( |
int |
fd, |
|
|
pid_t |
pid, |
|
|
int |
timeout, |
|
|
char * |
answer, |
|
|
int |
left |
|
) |
| |
Read from the child process.
- Parameters
-
fd | file descriptor to read from. |
pid | pid of child, will be reaped if it dies. |
timeout | amount of time to wait, in seconds. |
answer | buffer to write into. |
left | length of buffer. |
- Returns
- -1 on failure.
- Length of output.
Definition at line 386 of file exec.c.
pid_t radius_start_program |
( |
char const * |
cmd, |
|
|
REQUEST * |
request, |
|
|
bool |
exec_wait, |
|
|
int * |
input_fd, |
|
|
int * |
output_fd, |
|
|
VALUE_PAIR * |
input_pairs, |
|
|
bool |
shell_escape |
|
) |
| |
Start a process.
- Parameters
-
| cmd | Command to execute. This is parsed into argv[] parts, then each individual argv part is xlat'ed. |
| request | Current reuqest |
| exec_wait | set to true to read from or write to child. |
[in,out] | input_fd | pointer to int, receives the stdin file descriptor. Set to NULL and the child will have /dev/null on stdin. |
[in,out] | output_fd | pinter to int, receives the stdout file descriptor. Set to NULL and child will have /dev/null on stdout. |
| input_pairs | list of value pairs - these will be put into the environment variables of the child. |
| shell_escape | values before passing them as arguments. |
- Returns
- PID of the child process.
- -1 on failure.
Definition at line 87 of file exec.c.
static void time_free |
( |
void * |
data | ) |
|
|
static |
static void tv_sub |
( |
struct timeval * |
end, |
|
|
struct timeval * |
start, |
|
|
struct timeval * |
elapsed |
|
) |
| |
|
static |