NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
module.c File Reference

Definition of the Conn Module. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "module_data.h"
+ Include dependency graph for module.c:

Go to the source code of this file.

Functions

static bool conn_init (struct NeoMutt *n)
 Initialise a Module - Implements Module::init()
 
static bool conn_config_define_variables (struct NeoMutt *n, struct ConfigSet *cs)
 Define the Config Variables - Implements Module::config_define_variables()
 
static bool conn_cleanup (struct NeoMutt *n, void *data)
 Clean up a Module - Implements Module::cleanup()
 

Variables

struct ConfigDef ConnVars []
 Config definitions for the connection library.
 
struct ConfigDef ConnVarsGetaddr []
 GetAddrInfo Config definitions for the connection library.
 
struct ConfigDef ConnVarsGnutls []
 GnuTLS Config definitions for the connection library.
 
struct ConfigDef ConnVarsOpenssl []
 OpenSSL Config definitions for the connection library.
 
struct ConfigDef ConnVarsPartial []
 SSL partial chains Config definitions for the connection library.
 
struct ConfigDef ConnVarsSsl []
 General SSL Config definitions for the conn library.
 
const struct Module ModuleConn
 Module for the Conn library.
 

Detailed Description

Definition of the Conn Module.

Authors
  • Richard Russon

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file module.c.

Function Documentation

◆ conn_init()

static bool conn_init ( struct NeoMutt * n)
static

Initialise a Module - Implements Module::init()

Definition at line 53 of file module.c.

54{
55 struct ConnModuleData *mod_data = MUTT_MEM_CALLOC(1, struct ConnModuleData);
57
58#ifdef USE_SSL_OPENSSL
59 mod_data->host_ex_data_index = -1;
60 mod_data->skip_mode_ex_data_index = -1;
61#endif
62
63 mod_data->notify = notify_new();
64 notify_set_parent(mod_data->notify, n->notify);
65
66 return true;
67}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_CONN
ModuleConn, Network connections
Definition module_api.h:60
struct Notify * notify_new(void)
Create a new notifications handler.
Definition notify.c:62
void notify_set_parent(struct Notify *notify, struct Notify *parent)
Set the parent notification handler.
Definition notify.c:95
void neomutt_set_module_data(struct NeoMutt *n, enum ModuleId id, void *data)
Set the private data for a Module.
Definition neomutt.c:677
Conn private Module data.
Definition module_data.h:38
struct Notify * notify
Notifications.
Definition module_data.h:39
int skip_mode_ex_data_index
OpenSSL skip mode extra data index.
Definition module_data.h:49
int host_ex_data_index
OpenSSL host extra data index.
Definition module_data.h:48
struct Notify * notify
Notifications handler.
Definition neomutt.h:45
+ Here is the call graph for this function:

◆ conn_config_define_variables()

static bool conn_config_define_variables ( struct NeoMutt * n,
struct ConfigSet * cs )
static

Define the Config Variables - Implements Module::config_define_variables()

Definition at line 72 of file module.c.

73{
74 bool rc = true;
75
77
78#if defined(USE_SSL)
80#endif
81
82#if defined(USE_SSL_GNUTLS)
84#endif
85
86#if defined(USE_SSL_OPENSSL)
88#endif
89
90#if defined(HAVE_SSL_PARTIAL_CHAIN)
92#endif
93
94#if defined(HAVE_GETADDRINFO)
96#endif
97
98 return rc;
99}
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition set.c:290
struct ConfigDef ConnVarsSsl[]
General SSL Config definitions for the conn library.
Definition config.c:66
struct ConfigDef ConnVars[]
Config definitions for the connection library.
Definition config.c:39
struct ConfigDef ConnVarsOpenssl[]
OpenSSL Config definitions for the connection library.
Definition config.c:125
struct ConfigDef ConnVarsPartial[]
SSL partial chains Config definitions for the connection library.
Definition config.c:145
struct ConfigDef ConnVarsGetaddr[]
GetAddrInfo Config definitions for the connection library.
Definition config.c:159
struct ConfigDef ConnVarsGnutls[]
GnuTLS Config definitions for the connection library.
Definition config.c:108
+ Here is the call graph for this function:

◆ conn_cleanup()

static bool conn_cleanup ( struct NeoMutt * n,
void * data )
static

Clean up a Module - Implements Module::cleanup()

Definition at line 104 of file module.c.

105{
106 struct ConnModuleData *mod_data = data;
107
108 notify_free(&mod_data->notify);
109
110#ifdef USE_SASL_CYRUS
112#endif
113#ifdef USE_SASL_GNU
114 mutt_gsasl_cleanup(&mod_data->mutt_gsasl_ctx);
115#endif
116
117#ifdef USE_SASL_CYRUS
118 FREE(&mod_data->mutt_sasl_callbacks);
119 FREE(&mod_data->secret_ptr);
120#endif
121 FREE(&mod_data);
122 return true;
123}
void mutt_gsasl_cleanup(Gsasl **ctx)
Shutdown GNU SASL library.
Definition gsasl.c:151
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
void notify_free(struct Notify **ptr)
Free a notification handler.
Definition notify.c:75
void mutt_sasl_cleanup(void)
Invoke when processing is complete.
Definition sasl.c:789
+ Here is the call graph for this function:

Variable Documentation

◆ ConnVars

struct ConfigDef ConnVars[]
extern

Config definitions for the connection library.

Definition at line 39 of file config.c.

39 {
40 // clang-format off
41 { "account_command", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
42 "Shell command to retrieve account credentials"
43 },
44 { "preconnect", DT_STRING, 0, 0, NULL,
45 "(socket) External command to run prior to opening a socket"
46 },
47 { "socket_timeout", DT_NUMBER, 30, 0, NULL,
48 "Timeout for socket connect/read/write operations (-1 to wait indefinitely)"
49 },
50 { "tunnel", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
51 "Shell command to establish a tunnel"
52 },
53 { "tunnel_is_secure", DT_BOOL, true, 0, NULL,
54 "Assume a tunneled connection is secure"
55 },
56
57 { "connect_timeout", DT_SYNONYM, IP "socket_timeout", IP "2023-02-15" },
58 { NULL },
59 // clang-format on
60};
#define IP
Definition set.h:55
#define D_STRING_COMMAND
A command.
Definition types.h:99
@ DT_NUMBER
a number
Definition types.h:38
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44

◆ ConnVarsGetaddr

struct ConfigDef ConnVarsGetaddr[]
extern

GetAddrInfo Config definitions for the connection library.

Definition at line 159 of file config.c.

159 {
160 // clang-format off
161 { "use_ipv6", DT_BOOL, true, 0, NULL,
162 "Lookup IPv6 addresses when making connections"
163 },
164 { NULL },
165 // clang-format on
166};

◆ ConnVarsGnutls

struct ConfigDef ConnVarsGnutls[]
extern

GnuTLS Config definitions for the connection library.

Definition at line 108 of file config.c.

108 {
109 // clang-format off
110 { "ssl_ca_certificates_file", DT_PATH|D_PATH_FILE, 0, 0, NULL,
111 "File containing trusted CA certificates"
112 },
113 { "ssl_min_dh_prime_bits", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
114 "Minimum keysize for Diffie-Hellman key exchange"
115 },
116 { NULL },
117 // clang-format on
118};
#define D_PATH_FILE
Path is a file.
Definition types.h:104
@ DT_PATH
a path to a file/directory
Definition types.h:39
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:101

◆ ConnVarsOpenssl

struct ConfigDef ConnVarsOpenssl[]
extern

OpenSSL Config definitions for the connection library.

Definition at line 125 of file config.c.

125 {
126 // clang-format off
127 { "entropy_file", DT_PATH|D_PATH_FILE, 0, 0, NULL,
128 "(ssl) File/device containing random data to initialise SSL"
129 },
130 { "ssl_use_system_certs", DT_BOOL, true, 0, NULL,
131 "(ssl) Use CA certificates in the system-wide store"
132 },
133 { "ssl_usesystemcerts", DT_SYNONYM, IP "ssl_use_system_certs", IP "2021-02-11" },
134
135 { "ssl_use_sslv2", D_INTERNAL_DEPRECATED|DT_BOOL, 0, IP "2025-12-07" },
136 { NULL },
137 // clang-format on
138};
#define D_INTERNAL_DEPRECATED
Config item shouldn't be used any more.
Definition types.h:88

◆ ConnVarsPartial

struct ConfigDef ConnVarsPartial[]
extern

SSL partial chains Config definitions for the connection library.

Definition at line 145 of file config.c.

145 {
146 // clang-format off
147 { "ssl_verify_partial_chains", DT_BOOL, false, 0, NULL,
148 "(ssl) Allow verification using partial certificate chains"
149 },
150 { NULL },
151 // clang-format on
152};

◆ ConnVarsSsl

struct ConfigDef ConnVarsSsl[]
extern

General SSL Config definitions for the conn library.

Definition at line 66 of file config.c.

66 {
67 // clang-format off
68 { "certificate_file", DT_PATH|D_PATH_FILE, IP "~/.mutt_certificates", 0, NULL,
69 "File containing trusted certificates"
70 },
71 { "ssl_ciphers", DT_STRING, 0, 0, NULL,
72 "Ciphers to use when using SSL"
73 },
74 { "ssl_client_cert", DT_PATH|D_PATH_FILE, 0, 0, NULL,
75 "File containing client certificates"
76 },
77 { "ssl_force_tls", DT_BOOL, true, 0, NULL,
78 "(ssl) Require TLS encryption for all connections"
79 },
80 { "ssl_starttls", DT_QUAD, MUTT_YES, 0, NULL,
81 "(ssl) Use STARTTLS on servers advertising the capability"
82 },
83 { "ssl_use_tlsv1_2", DT_BOOL, true, 0, NULL,
84 "(ssl) Use TLSv1.2 for authentication"
85 },
86 { "ssl_use_tlsv1_3", DT_BOOL, true, 0, NULL,
87 "(ssl) Use TLSv1.3 for authentication"
88 },
89 { "ssl_verify_dates", DT_BOOL, true, 0, NULL,
90 "(ssl) Verify the dates on the server certificate"
91 },
92 { "ssl_verify_host", DT_BOOL, true, 0, NULL,
93 "(ssl) Verify the server's hostname against the certificate"
94 },
95
96 { "ssl_use_sslv3", D_INTERNAL_DEPRECATED|DT_BOOL, 0, IP "2025-12-07" },
97 { "ssl_use_tlsv1", D_INTERNAL_DEPRECATED|DT_BOOL, 0, IP "2025-12-07" },
98 { "ssl_use_tlsv1_1", D_INTERNAL_DEPRECATED|DT_BOOL, 0, IP "2025-12-07" },
99 { NULL },
100 // clang-format on
101};
@ MUTT_YES
User answered 'Yes', or assume 'Yes'.
Definition quad.h:39
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition types.h:40

◆ ModuleConn

const struct Module ModuleConn
Initial value:
= {
"conn",
NULL,
NULL,
NULL,
NULL,
}
static bool conn_cleanup(struct NeoMutt *n, void *data)
Clean up a Module - Implements Module::cleanup()
Definition module.c:104
static bool conn_config_define_variables(struct NeoMutt *n, struct ConfigSet *cs)
Define the Config Variables - Implements Module::config_define_variables()
Definition module.c:72
static bool conn_init(struct NeoMutt *n)
Initialise a Module - Implements Module::init()
Definition module.c:53

Module for the Conn library.

Definition at line 128 of file module.c.

128 {
130 "conn",
131 conn_init,
132 NULL, // config_define_types
134 NULL, // commands_register
135 NULL, // gui_init
136 NULL, // gui_cleanup
138};