Control handler for Unix sockets.
More...
#include <freeradius-devel/server/main_config.h>
#include <freeradius-devel/io/application.h>
#include <freeradius-devel/io/listen.h>
#include <freeradius-devel/io/schedule.h>
#include <freeradius-devel/server/protocol.h>
#include <freeradius-devel/util/perm.h>
#include <freeradius-devel/util/trie.h>
#include <freeradius-devel/util/file.h>
#include <netdb.h>
#include "proto_control.h"
#include <freeradius-devel/bio/fd.h>
#include <fcntl.h>
#include <libgen.h>
Go to the source code of this file.
|
static int | _close_cookies (proto_control_unix_thread_t *thread) |
|
static fr_client_t * | mod_client_find (fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto) |
|
static int | mod_connection_set (fr_listen_t *li, fr_io_address_t *connection) |
|
static int | mod_fd_set (fr_listen_t *li, int fd) |
| Set the file descriptor for this socket. More...
|
|
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
|
static char const * | mod_name (fr_listen_t *li) |
|
static void | mod_network_get (int *ipproto, bool *dynamic_clients, fr_trie_t const **trie, UNUSED void *instance) |
|
static int | mod_open (fr_listen_t *li) |
| Open a UNIX listener for control sockets. More...
|
|
static ssize_t | mod_read (fr_listen_t *li, void **packet_ctx, fr_time_t *recv_time_p, uint8_t *buffer, size_t buffer_len, size_t *leftover) |
|
static ssize_t | mod_read_command (fr_listen_t *li, UNUSED void **packet_ctx, UNUSED fr_time_t *recv_time_p, uint8_t *buffer, UNUSED size_t buffer_len, UNUSED size_t *leftover) |
|
static ssize_t | mod_read_init (fr_listen_t *li, UNUSED void **packet_ctx, UNUSED fr_time_t *recv_time_p, uint8_t *buffer, size_t buffer_len, UNUSED size_t *leftover) |
|
static ssize_t | mod_write (fr_listen_t *li, UNUSED void *packet_ctx, UNUSED fr_time_t request_time, uint8_t *buffer, size_t buffer_len, size_t written) |
|
static SINT | write_misc (void *instance, char const *buffer, INT buffer_size) |
|
static SINT | write_stderr (void *instance, char const *buffer, INT buffer_size) |
|
static SINT | write_stdout (void *instance, char const *buffer, INT buffer_size) |
|
Control handler for Unix sockets.
- Id
- f76145658fe4765af75814a5420b7505f7cb7f8b
- Copyright
- 2018 The FreeRADIUS server project.
-
2018 Alan DeKok (aland.nosp@m.@dep.nosp@m.loyin.nosp@m.grad.nosp@m.ius.c.nosp@m.om)
Definition in file proto_control_unix.c.
◆ proto_control_unix_t
struct proto_control_unix_t |
Definition at line 70 of file proto_control_unix.c.
Data Fields |
CONF_SECTION * |
cs |
our configuration |
char const * |
filename |
filename of control socket |
gid_t |
gid |
GID value. |
char const * |
gid_name |
name of GID to require |
uint32_t |
max_packet_size |
for message ring buffer. |
char const * |
mode_name |
|
gid_t |
peer_gid |
GID value. |
char const * |
peer_gid_name |
name of GID to require |
uid_t |
peer_uid |
UID value. |
char const * |
peer_uid_name |
name of UID to require |
bool |
read_only |
|
uint32_t |
recv_buff |
How big the kernel's receive buffer should be. |
bool |
recv_buff_is_set |
Whether we were provided with a receive buffer value. |
uid_t |
uid |
UID value. |
char const * |
uid_name |
name of UID to require |
◆ proto_control_unix_thread_t
struct proto_control_unix_thread_t |
◆ FR_READ
◆ FR_WRITE
◆ INT
◆ SINT
◆ _close_cookies()
◆ mod_client_find()
◆ mod_connection_set()
◆ mod_fd_set()
◆ mod_instantiate()
◆ mod_name()
◆ mod_network_get()
static void mod_network_get |
( |
int * |
ipproto, |
|
|
bool * |
dynamic_clients, |
|
|
fr_trie_t const ** |
trie, |
|
|
UNUSED void * |
instance |
|
) |
| |
|
static |
◆ mod_open()
◆ mod_read()
◆ mod_read_command()
◆ mod_read_init()
◆ mod_write()
◆ write_misc()
static SINT write_misc |
( |
void * |
instance, |
|
|
char const * |
buffer, |
|
|
INT |
buffer_size |
|
) |
| |
|
static |
◆ write_stderr()
static SINT write_stderr |
( |
void * |
instance, |
|
|
char const * |
buffer, |
|
|
INT |
buffer_size |
|
) |
| |
|
static |
◆ write_stdout()
static SINT write_stdout |
( |
void * |
instance, |
|
|
char const * |
buffer, |
|
|
INT |
buffer_size |
|
) |
| |
|
static |
◆ mode_names
Initial value:= {
}
#define L(_str)
Helper for initialising arrays of string literals.
Definition at line 121 of file proto_control_unix.c.
◆ mode_names_len
◆ peercred_config
Initial value:= {
}
#define CONF_PARSER_TERMINATOR
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition at line 95 of file proto_control_unix.c.
◆ proto_control_unix
Initial value:= {
.common = {
.name = "control_unix",
},
.default_message_size = 4096,
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
static void mod_network_get(int *ipproto, bool *dynamic_clients, fr_trie_t const **trie, UNUSED void *instance)
static ssize_t mod_read(fr_listen_t *li, void **packet_ctx, fr_time_t *recv_time_p, uint8_t *buffer, size_t buffer_len, size_t *leftover)
static int mod_open(fr_listen_t *li)
Open a UNIX listener for control sockets.
static char const * mod_name(fr_listen_t *li)
static ssize_t mod_write(fr_listen_t *li, UNUSED void *packet_ctx, UNUSED fr_time_t request_time, uint8_t *buffer, size_t buffer_len, size_t written)
static int mod_connection_set(fr_listen_t *li, fr_io_address_t *connection)
static int mod_fd_set(fr_listen_t *li, int fd)
Set the file descriptor for this socket.
static fr_client_t * mod_client_find(fr_listen_t *li, UNUSED fr_ipaddr_t const *ipaddr, UNUSED int ipproto)
static int mod_instantiate(module_inst_ctx_t const *mctx)
static const conf_parser_t unix_listen_config[]
Definition at line 691 of file proto_control_unix.c.
◆ unix_listen_config
Initial value:= {
.dflt = "${run_dir}/radiusd.sock}" },
}
#define FR_CONF_POINTER(_name, _type, _flags, _res_p)
conf_parser_t which parses a single CONF_PAIR producing a single global result
#define FR_CONF_OFFSET_IS_SET(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct,...
#define FR_CONF_OFFSET_FLAGS(_name, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
@ CONF_FLAG_REQUIRED
Error out if no matching CONF_PAIR is found, and no dflt value is set.
@ CONF_FLAG_SUBSECTION
Instead of putting the information into a configuration structure, the configuration file routines MA...
@ FR_TYPE_UINT32
32 Bit unsigned integer.
static const conf_parser_t peercred_config[]
Definition at line 102 of file proto_control_unix.c.