#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/exfile.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/tmpl_dcursor.h>
#include <freeradius-devel/server/rcode.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/unlang/call_env.h>
#include <freeradius-devel/unlang/tmpl.h>
#include <freeradius-devel/unlang/module.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/iovec.h>
#include <freeradius-devel/util/perm.h>
#include <freeradius-devel/util/print.h>
#include <freeradius-devel/util/value.h>
#include <freeradius-devel/util/types.h>
#include <freeradius-devel/unlang/xlat_func.h>
#include <sys/uio.h>
Go to the source code of this file.
|
static int | _mod_conn_free (linelog_conn_t *conn) |
|
static int | call_env_filename_parse (TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule) |
|
static int | linelog_escape_func (fr_value_box_t *vb, UNUSED void *uctx) |
| Escape unprintable characters. More...
|
|
static void | linelog_hexdump (request_t *request, struct iovec *vector_p, size_t vector_len, char const *msg) |
|
static int | linelog_write (rlm_linelog_t const *inst, linelog_call_env_t const *call_env, request_t *request, struct iovec *vector_p, size_t vector_len, bool with_delim) |
|
static xlat_action_t | linelog_xlat (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *args) |
|
static int | mod_bootstrap (module_inst_ctx_t const *mctx) |
|
static void * | mod_conn_create (TALLOC_CTX *ctx, void *instance, fr_time_delta_t timeout) |
|
static int | mod_detach (module_detach_ctx_t const *mctx) |
|
static unlang_action_t | mod_do_linelog (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
| Write a linelog message. More...
|
|
static unlang_action_t | mod_do_linelog_resume (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
|
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
|
◆ linelog_call_env_t
struct linelog_call_env_t |
◆ linelog_conn_t
Definition at line 138 of file rlm_linelog.c.
Data Fields |
int |
sockfd |
File descriptor associated with socket. |
◆ linelog_net_t
◆ rlm_linelog_rctx_t
struct rlm_linelog_rctx_t |
Definition at line 612 of file rlm_linelog.c.
Data Fields |
fr_value_box_list_t |
expanded |
The result of expanding the fmt tmpl. |
bool |
with_delim |
Whether to add a delimiter. |
◆ rlm_linelog_t
◆ rlm_linelog_t.file
struct rlm_linelog_t.file |
Definition at line 118 of file rlm_linelog.c.
Data Fields |
exfile_t * |
ef |
Exclusive file access handle. |
bool |
escape |
Do filename escaping, yes / no. |
bool |
fsync |
fsync after each write. |
gid_t |
group |
Resolved gid. |
char const * |
group_str |
Group to set on new files. |
uint32_t |
permissions |
Permissions to use when creating new files. |
◆ rlm_linelog_t.syslog
struct rlm_linelog_t.syslog |
Definition at line 112 of file rlm_linelog.c.
Data Fields |
char const * |
facility |
Syslog facility string. |
int |
priority |
Bitwise | of severity and facility. |
char const * |
severity |
Syslog severity string. |
◆ rlm_linelog_t.unix_sock
struct rlm_linelog_t.unix_sock |
Definition at line 127 of file rlm_linelog.c.
Data Fields |
char const * |
path |
Where the UNIX socket lives. |
fr_time_delta_t |
timeout |
How long to wait for read/write operations. |
◆ VECTOR_INCREMENT
◆ linefr_log_dst_t
Enumerator |
---|
LINELOG_DST_INVALID | |
LINELOG_DST_FILE | Log to a file.
|
LINELOG_DST_REQUEST | Log to the request->log.
|
LINELOG_DST_SYSLOG | Log to syslog.
|
LINELOG_DST_UNIX | Log via Unix socket.
|
LINELOG_DST_UDP | Log via UDP.
|
LINELOG_DST_TCP | Log via TCP.
|
LINELOG_DST_STDOUT | Log to stdout.
|
LINELOG_DST_STDERR | Log to stderr.
|
Definition at line 69 of file rlm_linelog.c.
◆ _mod_conn_free()
◆ call_env_filename_parse()
◆ linelog_escape_func()
Escape unprintable characters.
- Newline is escaped as
\\n
.
- Return is escaped as
\\r
.
- All other unprintables are escaped as
\<oct><oct><oct>
.
- Parameters
-
vb | Value box to escape. |
uctx | unused. |
Definition at line 341 of file rlm_linelog.c.
◆ linelog_hexdump()
static void linelog_hexdump |
( |
request_t * |
request, |
|
|
struct iovec * |
vector_p, |
|
|
size_t |
vector_len, |
|
|
char const * |
msg |
|
) |
| |
|
static |
◆ linelog_write()
◆ linelog_xlat()
◆ mod_bootstrap()
◆ mod_conn_create()
static void* mod_conn_create |
( |
TALLOC_CTX * |
ctx, |
|
|
void * |
instance, |
|
|
fr_time_delta_t |
timeout |
|
) |
| |
|
static |
◆ mod_detach()
◆ mod_do_linelog()
Write a linelog message.
Write a log message to syslog or a flat file.
- Parameters
-
[in] | p_result | the result of the module call:
|
[in] | mctx | module calling context. |
[in] | request | The current request. |
Definition at line 684 of file rlm_linelog.c.
◆ mod_do_linelog_resume()
◆ mod_instantiate()
◆ file_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 143 of file rlm_linelog.c.
◆ linefr_log_dst_table
Initial value:= {
}
#define L(_str)
Helper for initialising arrays of string literals.
@ LINELOG_DST_FILE
Log to a file.
@ LINELOG_DST_STDERR
Log to stderr.
@ LINELOG_DST_UNIX
Log via Unix socket.
@ LINELOG_DST_STDOUT
Log to stdout.
@ LINELOG_DST_TCP
Log via TCP.
@ LINELOG_DST_REQUEST
Log to the request->log.
@ LINELOG_DST_UDP
Log via UDP.
@ LINELOG_DST_SYSLOG
Log to syslog.
Definition at line 81 of file rlm_linelog.c.
◆ linefr_log_dst_table_len
◆ linelog_method_env
Initial value:= {
})) },
}
}
#define CALL_ENV_TERMINATOR
#define FR_CALL_ENV_METHOD_OUT(_inst)
Helper macro for populating the size/type fields of a call_env_method_t from the output structure typ...
#define FR_CALL_ENV_SUBSECTION(_name, _name2, _flags, _subcs)
Specify a call_env_parser_t which defines a nested subsection.
@ CALL_ENV_FLAG_CONCAT
If the tmpl produced multiple boxes they should be concatenated.
@ CALL_ENV_FLAG_PARSE_ONLY
The result of parsing will not be evaluated at runtime.
#define FR_CALL_ENV_OFFSET(_name, _cast_type, _flags, _struct, _field)
Specify a call_env_parser_t which writes out runtime results to the specified field.
#define FR_CALL_ENV_PARSE_ONLY_OFFSET(_name, _cast_type, _flags, _struct, _parse_field)
Specify a call_env_parser_t which writes out the result of the parsing phase to the field specified.
@ FR_TYPE_STRING
String of printable characters.
static int call_env_filename_parse(TALLOC_CTX *ctx, void *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule)
static int linelog_escape_func(fr_value_box_t *vb, UNUSED void *uctx)
Escape unprintable characters.
Definition at line 212 of file rlm_linelog.c.
◆ linelog_xlat_method_env
◆ module_config
Initial value:= {
}
#define FR_CONF_DEPRECATED(_name, _struct, _field)
conf_parser_t entry which raises an error if a matching CONF_PAIR is found
#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_FLAGS(_name, _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_SUBSECTION(_name, _flags, _struct, _field, _subcs)
conf_parser_t which populates a sub-struct using a CONF_SECTION
@ 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...
static const conf_parser_t file_config[]
static const conf_parser_t syslog_config[]
static const conf_parser_t udp_config[]
static const conf_parser_t unix_config[]
static const conf_parser_t tcp_config[]
Definition at line 176 of file rlm_linelog.c.
◆ rlm_linelog
Initial value:= {
.common = {
.name = "linelog",
},
.method_group = {
}
}
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
static const conf_parser_t config[]
static int mod_detach(module_detach_ctx_t const *mctx)
static unlang_action_t mod_do_linelog(rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request)
Write a linelog message.
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static const call_env_method_t linelog_method_env
static const conf_parser_t module_config[]
static int mod_instantiate(module_inst_ctx_t const *mctx)
static int instantiate(module_inst_ctx_t const *mctx)
#define SECTION_NAME(_name1, _name2)
Define a section name consisting of a verb and a noun.
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Named methods exported by a module.
Definition at line 1060 of file rlm_linelog.c.
◆ syslog_config
◆ tcp_config
Initial value:= {
}
#define FR_CONF_OFFSET_TYPE_FLAGS(_name, _type, _flags, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
static fr_time_delta_t timeout
@ FR_TYPE_COMBO_IP_ADDR
IPv4 or IPv6 address depending on length.
Definition at line 169 of file rlm_linelog.c.
◆ udp_config
◆ unix_config
Initial value:= {
}
@ CONF_FLAG_FILE_INPUT
File matching value must exist, and must be readable.
Definition at line 157 of file rlm_linelog.c.