The FreeRADIUS server
$Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
|
smtp server authentication. More...
#include <freeradius-devel/curl/base.h>
#include <freeradius-devel/server/base.h>
#include <freeradius-devel/server/cf_priv.h>
#include <freeradius-devel/server/global_lib.h>
#include <freeradius-devel/server/module_rlm.h>
#include <freeradius-devel/server/tmpl_dcursor.h>
#include <freeradius-devel/util/slab.h>
#include <freeradius-devel/util/token.h>
#include <freeradius-devel/unlang/call_env.h>
Go to the source code of this file.
Data Structures | |
struct | fr_mail_ctx_t |
struct | rlm_smtp_auth_env_t |
Call environment for SMTP authentication. More... | |
struct | rlm_smtp_env_t |
Call environment for sending emails. More... | |
struct | rlm_smtp_t |
struct | rlm_smtp_thread_t |
Macros | |
#define | SMTP_COMMON_CLEANUP |
Functions | |
static int | attachments_source (fr_mail_ctx_t *uctx, curl_mime *mime, rlm_smtp_t const *inst, rlm_smtp_env_t const *call_env) |
static int | body_init (fr_mail_ctx_t *uctx, curl_mime *mime) |
static size_t | body_source (char *ptr, size_t size, size_t nmemb, void *mail_ctx) |
static int | da_to_slist (fr_mail_ctx_t *uctx, struct curl_slist **out, const fr_dict_attr_t *dict_attr) |
static int | generate_from_header (fr_mail_ctx_t *uctx, struct curl_slist **out, rlm_smtp_t const *inst, rlm_smtp_env_t const *call_env) |
Generate the From: header. More... | |
static int | header_source (fr_mail_ctx_t *uctx, rlm_smtp_t const *inst, rlm_smtp_env_t const *call_env) |
static unlang_action_t | mod_authenticate (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static int | mod_instantiate (module_inst_ctx_t const *mctx) |
static unlang_action_t | mod_mail (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
static int | mod_thread_detach (module_thread_inst_ctx_t const *mctx) |
static int | mod_thread_instantiate (module_thread_inst_ctx_t const *mctx) |
static int | recipients_source (fr_mail_ctx_t *uctx, rlm_smtp_env_t const *call_env) |
static int | smtp_conn_common_init (fr_curl_io_request_t *randle, rlm_smtp_t const *inst) |
static int | smtp_header_section_parse (TALLOC_CTX *ctx, call_env_parsed_head_t *out, tmpl_rules_t const *t_rules, CONF_ITEM *ci, UNUSED call_env_ctx_t const *cec, UNUSED call_env_parser_t const *rule) |
Parse the header section into tmpls for producing email headers. More... | |
static unlang_action_t | smtp_io_module_resume (rlm_rcode_t *p_result, module_ctx_t const *mctx, request_t *request) |
Callback to process response of SMTP server. More... | |
static void | smtp_io_module_signal (module_ctx_t const *mctx, request_t *request, UNUSED fr_signal_t action) |
static int | smtp_mail_ctx_free (fr_mail_ctx_t *mail_ctx) |
static int | smtp_onetime_conn_alloc (fr_curl_io_request_t *randle, UNUSED void *uctx) |
static int | smtp_onetime_conn_init (fr_curl_io_request_t *randle, void *uctx) |
static int | smtp_onetime_request_cleanup (fr_curl_io_request_t *randle, UNUSED void *uctx) |
static int | smtp_persist_conn_alloc (fr_curl_io_request_t *randle, UNUSED void *uctx) |
static int | smtp_persist_conn_init (fr_curl_io_request_t *randle, void *uctx) |
static int | smtp_persist_request_cleanup (fr_curl_io_request_t *randle, UNUSED void *uctx) |
static int | str_to_attachments (fr_mail_ctx_t *uctx, curl_mime *mime, char const *str, size_t len, fr_sbuff_t *path_buffer, fr_sbuff_marker_t *m) |
static int | value_box_list_to_header (fr_mail_ctx_t *uctx, struct curl_slist **out, fr_value_box_list_t const *lists, const char *prefix) |
Converts an array of value box lists to a curl_slist with a prefix. More... | |
static int | value_box_list_to_slist (struct curl_slist **out, fr_value_box_list_t const *lists) |
Transform an array of value box lists to entries in a CURL slist. More... | |
Variables | |
static fr_dict_attr_t const * | attr_smtp_body |
static fr_dict_attr_t const * | attr_smtp_header |
static const call_env_method_t | auth_env |
static fr_dict_t const * | dict_freeradius |
static const call_env_method_t | method_env |
static const conf_parser_t | module_config [] |
module_rlm_t | rlm_smtp |
fr_dict_autoload_t | rlm_smtp_dict [] |
fr_dict_attr_autoload_t | rlm_smtp_dict_attr [] |
global_lib_autoinst_t const *const | rlm_smtp_lib [] |
smtp server authentication.
Definition in file rlm_smtp.c.
struct fr_mail_ctx_t |
Definition at line 136 of file rlm_smtp.c.
Data Fields | ||
---|---|---|
fr_dcursor_t | body_cursor | |
struct curl_slist * | body_header | |
fr_dcursor_t | cursor | |
struct curl_slist * | header | |
curl_mime * | mime | |
fr_curl_io_request_t * | randle | |
struct curl_slist * | recipients | |
request_t * | request | |
fr_time_t | time | |
char | time_str[60] | |
fr_dbuff_t | vp_in |
struct rlm_smtp_auth_env_t |
Call environment for SMTP authentication.
Definition at line 79 of file rlm_smtp.c.
Data Fields | ||
---|---|---|
fr_value_box_t | password | Value to use for password. |
tmpl_t * | password_tmpl | tmpl expanded to populate password |
fr_value_box_t | username | Value to use for user name. |
tmpl_t * | username_tmpl | tmpl expanded to populate username |
struct rlm_smtp_env_t |
Call environment for sending emails.
Definition at line 64 of file rlm_smtp.c.
Data Fields | ||
---|---|---|
fr_value_box_list_t * | attachments | List of files to attach. |
fr_value_box_list_t * | bcc_addrs | The address(es) used for the Bcc: header. |
fr_value_box_list_t * | cc_addrs | The address(es) used for the Cc: header. |
fr_value_box_list_t | headers | Entries to add to email header. |
fr_value_box_t | password | Password for authenticated mails. |
fr_value_box_list_t * | recipient_addrs | The address(es) used as recipients. Overrides elements in to, cc and bcc. |
fr_value_box_list_t * | sender_address | The address(es) used to generate the From: header. |
fr_value_box_list_t * | to_addrs | The address(es) used for the To: header. |
fr_value_box_t | username | User to authenticate as when sending emails. |
tmpl_t * | username_tmpl | The tmpl used to produce the above. |
struct rlm_smtp_t |
Definition at line 86 of file rlm_smtp.c.
Data Fields | ||
---|---|---|
fr_curl_conn_config_t | conn_config | Reusable CURL handle config. |
char const * | envelope_address | The address used to send the message. |
bool | set_date | |
char const * | template_dir | The directory that contains all email attachments. |
fr_time_delta_t | timeout | Timeout for connection and server response. |
fr_curl_tls_t | tls | Used for handled all tls specific curl components. |
char const * | uri | URI of smtp server. |
struct rlm_smtp_thread_t |
Definition at line 126 of file rlm_smtp.c.
Data Fields | ||
---|---|---|
fr_curl_handle_t * | mhandle |
Thread specific multi handle. Serves as the dispatch and coralling structure for smtp requests |
smtp_slab_list_t * | slab_onetime | Slab list for onetime use connections. |
smtp_slab_list_t * | slab_persist | Slab list for persistent connections. |
#define SMTP_COMMON_CLEANUP |
Definition at line 787 of file rlm_smtp.c.
|
static |
Definition at line 515 of file rlm_smtp.c.
|
static |
Definition at line 468 of file rlm_smtp.c.
Definition at line 427 of file rlm_smtp.c.
|
static |
Definition at line 155 of file rlm_smtp.c.
|
static |
Generate the From:
header.
Defaults to using sender_address
values, falls back to envelope_address
Definition at line 301 of file rlm_smtp.c.
|
static |
Definition at line 376 of file rlm_smtp.c.
|
static |
|
static |
Definition at line 777 of file rlm_smtp.c.
|
static |
|
static |
|
static |
|
static |
Definition at line 333 of file rlm_smtp.c.
|
inlinestatic |
Definition at line 849 of file rlm_smtp.c.
|
static |
Parse the header section into tmpls for producing email headers.
Definition at line 944 of file rlm_smtp.c.
|
static |
Callback to process response of SMTP server.
It checks if the response was CURLE_OK If it was, it tries to extract the certificate attributes If the response was not OK, we REJECT the request When responding to requests initiated by mod_authenticate this is simply a check on the username and password. When responding to requests initiated by mod_mail this indicates the mail has been queued.
Definition at line 585 of file rlm_smtp.c.
|
static |
|
static |
|
static |
Definition at line 811 of file rlm_smtp.c.
|
static |
Definition at line 872 of file rlm_smtp.c.
|
static |
|
static |
Definition at line 830 of file rlm_smtp.c.
|
static |
Definition at line 889 of file rlm_smtp.c.
|
static |
|
static |
Definition at line 258 of file rlm_smtp.c.
|
static |
Converts an array of value box lists to a curl_slist with a prefix.
uctx | Mail context. |
out | CURL slist to write to. |
lists | Array of value box lists to copy. |
prefix | to prepend to the output slist |
Definition at line 207 of file rlm_smtp.c.
|
static |
Transform an array of value box lists to entries in a CURL slist.
Definition at line 178 of file rlm_smtp.c.
|
static |
Definition at line 47 of file rlm_smtp.c.
|
static |
Definition at line 46 of file rlm_smtp.c.
|
static |
Definition at line 1020 of file rlm_smtp.c.
|
static |
Definition at line 38 of file rlm_smtp.c.
|
static |
Definition at line 997 of file rlm_smtp.c.
|
static |
Definition at line 102 of file rlm_smtp.c.
module_rlm_t rlm_smtp |
Definition at line 1043 of file rlm_smtp.c.
fr_dict_autoload_t rlm_smtp_dict |
Definition at line 41 of file rlm_smtp.c.
fr_dict_attr_autoload_t rlm_smtp_dict_attr |
Definition at line 50 of file rlm_smtp.c.
global_lib_autoinst_t const *const rlm_smtp_lib |
Definition at line 57 of file rlm_smtp.c.