Fetch objects from FTP endpoints.
More...
#include <freeradius-devel/curl/base.h>
#include <freeradius-devel/curl/xlat.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cf_parse.h>
#include <freeradius-devel/server/global_lib.h>
#include <freeradius-devel/server/tmpl.h>
#include <freeradius-devel/server/log.h>
#include <freeradius-devel/util/atexit.h>
#include <freeradius-devel/util/debug.h>
#include <freeradius-devel/util/uri.h>
#include <freeradius-devel/unlang/call_env.h>
#include <freeradius-devel/unlang/xlat_func.h>
Go to the source code of this file.
|
static int | _ftp_request_cleanup (fr_curl_io_request_t *randle, UNUSED void *uctx) |
| Cleans up after a FTP request.
|
|
static int | _mod_conn_free (fr_curl_io_request_t *randle) |
|
static int | ftp_conn_alloc (fr_curl_io_request_t *randle, void *uctx) |
|
static xlat_action_t | ftp_get_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) |
| Simple xlat to read data from an FTP URI.
|
|
static xlat_action_t | ftp_get_xlat_resume (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, UNUSED request_t *request, UNUSED fr_value_box_list_t *in) |
|
static void | ftp_io_xlat_signal (xlat_ctx_t const *xctx, request_t *request, UNUSED fr_signal_t action) |
|
static size_t | ftp_response_body (void *in, size_t size, size_t nmemb, void *userdata) |
|
static int | ftp_uri_part_escape (fr_value_box_t *vb, UNUSED void *uctx) |
| URL escape a single box forming part of a URL.
|
|
static int | ftp_uri_part_escape (fr_value_box_t *vb, void *uctx) |
|
static int | mod_bootstrap (module_inst_ctx_t const *mctx) |
|
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
|
static int | mod_thread_detach (module_thread_inst_ctx_t const *mctx) |
| Cleanup all outstanding requests associated with this thread.
|
|
static int | mod_thread_instantiate (module_thread_inst_ctx_t const *mctx) |
| Create a thread specific multihandle.
|
|
Fetch objects from FTP endpoints.
- Id
- c2cc907ccdd203f13be0bc9e9122dc0345974839
- Copyright
- 2025 NetworkRADIUS SARL (legal.nosp@m.@net.nosp@m.workr.nosp@m.adiu.nosp@m.s.com)
Definition in file rlm_ftp.c.
◆ rlm_ftp_curl_context_t
struct rlm_ftp_curl_context_t |
◆ rlm_ftp_response_t
struct rlm_ftp_response_t |
Definition at line 74 of file rlm_ftp.c.
Data Fields |
size_t |
alloc |
Space allocated for buffer. |
char * |
buffer |
Raw incoming FTP data. |
rlm_ftp_t const * |
instance |
This instance of rlm_ftp. |
request_t * |
request |
Current request. |
write_state_t |
state |
Decoder state. |
size_t |
used |
Space used in buffer. |
◆ rlm_ftp_t
Definition at line 42 of file rlm_ftp.c.
Data Fields |
bool |
binary |
Do we expect binary data - and so output octets. |
fr_curl_conn_config_t |
conn_config |
Configuration of slab allocated connection handles. |
size_t |
max_resp_size |
Maximum size of incoming data. |
◆ rlm_ftp_thread_t
Definition at line 51 of file rlm_ftp.c.
Data Fields |
rlm_ftp_t const * |
inst |
Instance of rlm_ftp. |
fr_curl_handle_t * |
mhandle |
Thread specific multi handle. Serves as the dispatch and coralling structure for FTP requests.
|
ftp_slab_list_t * |
slab |
Slab list for connection handles. |
◆ rlm_ftp_xlat_rctx_t
struct rlm_ftp_xlat_rctx_t |
◆ FTP_BODY_ALLOC_CHUNK
#define FTP_BODY_ALLOC_CHUNK 1024 |
◆ write_state_t
Enumerator |
---|
WRITE_STATE_INIT | |
WRITE_STATE_POPULATED | |
WRITE_STATE_DISCARD | |
Definition at line 65 of file rlm_ftp.c.
◆ _ftp_request_cleanup()
Cleans up after a FTP request.
Resets all options associated with a CURL handle, and frees any headers associated with it.
Calls ftp_read_ctx_free and ftp_response_free to free any memory used by context data.
- Parameters
-
[in] | randle | to cleanup. |
[in] | uctx | unused. |
Definition at line 337 of file rlm_ftp.c.
◆ _mod_conn_free()
◆ ftp_conn_alloc()
◆ ftp_get_xlat_resume()
◆ ftp_io_xlat_signal()
◆ ftp_response_body()
◆ ftp_uri_part_escape() [1/2]
URL escape a single box forming part of a URL.
- Parameters
-
[in] | vb | to escape |
[in] | uctx | UNUSED context containing CURL handle |
- Returns
- 0 on success
- -1 on failure
Definition at line 125 of file rlm_ftp.c.
◆ ftp_uri_part_escape() [2/2]
◆ mod_bootstrap()
◆ mod_instantiate()
◆ mod_thread_detach()
Cleanup all outstanding requests associated with this thread.
Destroys all curl easy handles, and then the multihandle associated with this thread.
- Parameters
-
- Returns
- 0
Definition at line 442 of file rlm_ftp.c.
◆ mod_thread_instantiate()
Create a thread specific multihandle.
Easy handles representing requests are added to the curl multihandle with the multihandle used for mux/demux.
- Parameters
-
[in] | mctx | Thread instantiation data. |
- Returns
- 0 on success.
- -1 on failure.
Definition at line 412 of file rlm_ftp.c.
◆ ftp_get_xlat_args
Initial value:= {
}
#define CURL_URI_SAFE_FOR
safe for value suitable for all users of the curl library
@ FR_TYPE_STRING
String of printable characters.
#define XLAT_ARG_PARSER_TERMINATOR
Definition at line 243 of file rlm_ftp.c.
◆ ftp_uri_parts
Initial value:= {
}
#define L(_str)
Helper for initialising arrays of string literals.
static int ftp_uri_part_escape(fr_value_box_t *vb, void *uctx)
#define FR_SBUFF_TERMS(...)
Initialise a terminal structure with a list of sorted strings.
#define XLAT_URI_PART_TERMINATOR
Definition at line 94 of file rlm_ftp.c.
◆ module_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
#define FR_CONF_OFFSET_SUBSECTION(_name, _flags, _struct, _field, _subcs)
conf_parser_t which populates a sub-struct using a CONF_SECTION
#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
conf_parser_t fr_curl_conn_config[]
@ FR_TYPE_SIZE
Unsigned integer capable of representing any memory address on the local system.
Definition at line 102 of file rlm_ftp.c.
◆ rlm_ftp
Initial value:= {
.common = {
.name = "ftp",
},
.method_group = {
}
}
}
#define MODULE_MAGIC_INIT
Stop people using different module/library/server versions together.
static int mod_bootstrap(module_inst_ctx_t const *mctx)
static int mod_thread_instantiate(module_thread_inst_ctx_t const *mctx)
Create a thread specific multihandle.
static const conf_parser_t module_config[]
static int mod_thread_detach(module_thread_inst_ctx_t const *mctx)
Cleanup all outstanding requests associated with this thread.
static int mod_instantiate(module_inst_ctx_t const *mctx)
#define MODULE_BINDING_TERMINATOR
Terminate a module binding list.
Named methods exported by a module.
Definition at line 484 of file rlm_ftp.c.
◆ rlm_ftp_lib
Initial value:= {
}
#define GLOBAL_LIB_TERMINATOR
global_lib_autoinst_t fr_curl_autoinst
Definition at line 112 of file rlm_ftp.c.