|  | 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>#include <freeradius-devel/unlang/xlat_func.h> Include dependency graph for rlm_smtp.c:
 Include dependency graph for rlm_smtp.c: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 | 
| struct | rlm_smtp_xlat_env_t | 
| Call environment for sending simple emails using an xlat.  More... | |
| 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. | |
| 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 (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request) | 
| static int | mod_bootstrap (module_inst_ctx_t const *mctx) | 
| static int | mod_instantiate (module_inst_ctx_t const *mctx) | 
| static unlang_action_t | mod_mail (unlang_result_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, call_env_ctx_t const *cec, call_env_parser_t const *rule) | 
| 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. | |
| static unlang_action_t | smtp_io_module_resume (unlang_result_t *p_result, module_ctx_t const *mctx, request_t *request) | 
| Callback to process response of SMTP server. | |
| 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 xlat_action_t | smtp_send_xlat (UNUSED TALLOC_CTX *ctx, UNUSED fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, fr_value_box_list_t *in) | 
| Xlat to send simple emails. | |
| static xlat_action_t | smtp_send_xlat_resume (TALLOC_CTX *ctx, fr_dcursor_t *out, xlat_ctx_t const *xctx, request_t *request, UNUSED fr_value_box_list_t *in) | 
| static void | smtp_xlat_signal (xlat_ctx_t const *xctx, request_t *request, fr_signal_t action) | 
| 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. | |
| 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. | |
| 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 [] | 
| static const call_env_method_t | smtp_call_env_xlat | 
| static xlat_arg_parser_t const | smtp_xlat_args [] | 
smtp server authentication.
Definition in file rlm_smtp.c.
| struct fr_mail_ctx_t | 
Definition at line 163 of file rlm_smtp.c.
 Collaboration diagram for fr_mail_ctx_t:
 Collaboration diagram for fr_mail_ctx_t:| 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 80 of file rlm_smtp.c.
 Collaboration diagram for rlm_smtp_auth_env_t:
 Collaboration diagram for rlm_smtp_auth_env_t:| 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 65 of file rlm_smtp.c.
 Collaboration diagram for rlm_smtp_env_t:
 Collaboration diagram for rlm_smtp_env_t:| 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 113 of file rlm_smtp.c.
 Collaboration diagram for rlm_smtp_t:
 Collaboration diagram for rlm_smtp_t:| 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 153 of file rlm_smtp.c.
 Collaboration diagram for rlm_smtp_thread_t:
 Collaboration diagram for rlm_smtp_thread_t:| 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. | 
| struct rlm_smtp_xlat_env_t | 
Call environment for sending simple emails using an xlat.
Definition at line 89 of file rlm_smtp.c.
 Collaboration diagram for rlm_smtp_xlat_env_t:
 Collaboration diagram for rlm_smtp_xlat_env_t:| Data Fields | ||
|---|---|---|
| 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 * | sender_address | The address(es) used to generate the From: header. | 
| fr_value_box_t | username | User to authenticate as when sending emails. | 
| tmpl_t * | username_tmpl | The tmpl used to produce the above. | 
| #define SMTP_COMMON_CLEANUP | 
Definition at line 981 of file rlm_smtp.c.
| 
 | static | 
Definition at line 542 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 495 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:Definition at line 454 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 182 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Generate the From: header. 
Defaults to using sender_address values, falls back to envelope_address 
Definition at line 328 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 403 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
| 
 | static | 
| 
 | static | 
Definition at line 971 of file rlm_smtp.c.
| 
 | static | 
| 
 | static | 
| 
 | static | 
| 
 | static | 
Definition at line 360 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | inlinestatic | 
Definition at line 1043 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
| 
 | static | 
Parse the header section into tmpls for producing email headers.
Definition at line 1138 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function:| 
 | 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 610 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
| 
 | static | 
| 
 | static | 
Definition at line 1005 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 1066 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
| 
 | static | 
Definition at line 1024 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 1083 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
| 
 | static | 
Definition at line 831 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 853 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 285 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | 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 234 of file rlm_smtp.c.
 Here is the call graph for this function:
 Here is the call graph for this function: Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Transform an array of value box lists to entries in a CURL slist.
Definition at line 205 of file rlm_smtp.c.
 Here is the caller graph for this function:
 Here is the caller graph for this function:| 
 | static | 
Definition at line 48 of file rlm_smtp.c.
| 
 | static | 
Definition at line 47 of file rlm_smtp.c.
| 
 | static | 
Definition at line 1214 of file rlm_smtp.c.
| 
 | static | 
Definition at line 39 of file rlm_smtp.c.
| 
 | static | 
Definition at line 1191 of file rlm_smtp.c.
| 
 | static | 
Definition at line 129 of file rlm_smtp.c.
| module_rlm_t rlm_smtp | 
Definition at line 1241 of file rlm_smtp.c.
| fr_dict_autoload_t rlm_smtp_dict | 
Definition at line 42 of file rlm_smtp.c.
| fr_dict_attr_autoload_t rlm_smtp_dict_attr | 
Definition at line 51 of file rlm_smtp.c.
| global_lib_autoinst_t const *const rlm_smtp_lib | 
Definition at line 58 of file rlm_smtp.c.
| 
 | static | 
Definition at line 100 of file rlm_smtp.c.
| 
 | static | 
Definition at line 824 of file rlm_smtp.c.
 1.9.8
 1.9.8