Execute external programs.
More...
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/server/request.h>
#include <freeradius-devel/server/util.h>
#include <freeradius-devel/server/exec_legacy.h>
#include <freeradius-devel/server/exec_priv.h>
Go to the source code of this file.
|
static NEVER_RETURNS void | exec_child_legacy (request_t *request, char **argv, char **envp, bool exec_wait, int stdin_pipe[static 2], int stdout_pipe[static 2], int stderr_pipe[static 2]) |
|
static void | exec_pair_to_env_legacy (request_t *request, fr_pair_list_t *input_pairs, char **envp, size_t envlen, bool shell_escape) |
|
int | radius_exec_program_legacy (char *out, size_t outlen, request_t *request, char const *cmd, fr_pair_list_t *input_pairs, bool exec_wait, bool shell_escape, fr_time_delta_t timeout) |
| Execute a program. More...
|
|
int | radius_readfrom_program_legacy (int fd, pid_t pid, fr_time_delta_t timeout, char *answer, int left) |
| Read from the child process. More...
|
|
pid_t | radius_start_program_legacy (int *stdin_fd, int *stdout_fd, int *stderr_fd, char const *cmd, request_t *request, bool exec_wait, fr_pair_list_t *input_pairs, bool shell_escape) |
| Start a process. More...
|
|
Execute external programs.
- Id
- 1435f94150996de950a092d0d3fb0c28f7ba2dd0
- Copyright
- 2000-2004,2006 The FreeRADIUS server project
Definition in file exec_legacy.c.
◆ MAX_ARGV
◆ MAX_ENVP
◆ exec_child_legacy()
static NEVER_RETURNS void exec_child_legacy |
( |
request_t * |
request, |
|
|
char ** |
argv, |
|
|
char ** |
envp, |
|
|
bool |
exec_wait, |
|
|
int |
stdin_pipe[static 2], |
|
|
int |
stdout_pipe[static 2], |
|
|
int |
stderr_pipe[static 2] |
|
) |
| |
|
static |
◆ exec_pair_to_env_legacy()
◆ radius_exec_program_legacy()
Execute a program.
- Parameters
-
[out] | out | buffer to append plaintext (non valuepair) output. |
[in] | outlen | length of out buffer. |
[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 474 of file exec_legacy.c.
◆ radius_readfrom_program_legacy()
int radius_readfrom_program_legacy |
( |
int |
fd, |
|
|
pid_t |
pid, |
|
|
fr_time_delta_t |
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 357 of file exec_legacy.c.
◆ radius_start_program_legacy()
pid_t radius_start_program_legacy |
( |
int * |
stdin_fd, |
|
|
int * |
stdout_fd, |
|
|
int * |
stderr_fd, |
|
|
char const * |
cmd, |
|
|
request_t * |
request, |
|
|
bool |
exec_wait, |
|
|
fr_pair_list_t * |
input_pairs, |
|
|
bool |
shell_escape |
|
) |
| |
Start a process.
- Parameters
-
[out] | stdin_fd | pointer to int, receives the stdin file descriptor. Set to NULL and the child will have /dev/null on stdin. |
[out] | stdout_fd | pointer to int, receives the stdout file descriptor. Set to NULL and the child will have /dev/null on stdout. |
[out] | stderr_fd | pointer to int, receives the stderr file descriptor. Set to NULL and the child will have /dev/null on stderr. |
[in] | cmd | Command to execute. This is parsed into argv[] parts, then each individual argv part is xlat'ed. |
[in] | request | Current request |
[in] | exec_wait | set to true to read from or write to child. |
[in] | input_pairs | list of value pairs - these will be put into the environment variables of the child. |
[in] | shell_escape | values before passing them as arguments. |
- Returns
- PID of the child process.
- -1 on failure.
Definition at line 227 of file exec_legacy.c.