diff options
author | Jeremy Harris <jgh146exb@wizmail.org> | 2020-01-21 16:47:56 +0000 |
---|---|---|
committer | Jeremy Harris <jgh146exb@wizmail.org> | 2020-01-21 16:47:56 +0000 |
commit | 13a4b4c1810a1a9f3c956f1e92807a0d86c6f5bf (patch) | |
tree | 3ec5b32ef2cc0e4b72cd3fc4ce26b62082509cea /src/src/transports | |
parent | a73f05479a4bed3bf77d21a75da9515c4ae83a62 (diff) | |
download | exim4-13a4b4c1810a1a9f3c956f1e92807a0d86c6f5bf.tar.gz |
Use dedicated union member for option offsets
Diffstat (limited to 'src/src/transports')
-rw-r--r-- | src/src/transports/appendfile.c | 172 | ||||
-rw-r--r-- | src/src/transports/autoreply.c | 55 | ||||
-rw-r--r-- | src/src/transports/lmtp.c | 12 | ||||
-rw-r--r-- | src/src/transports/pipe.c | 86 | ||||
-rw-r--r-- | src/src/transports/queuefile.c | 2 | ||||
-rw-r--r-- | src/src/transports/smtp.c | 233 |
6 files changed, 198 insertions, 362 deletions
diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index de193db44..f4baf0c77 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -19,133 +19,77 @@ order (note that "_" comes before the lower case letters). Some of them are stored in the publicly visible instance block - these are flagged with the opt_public flag. */ +#define LOFF(field) OPT_OFF(appendfile_transport_options_block, field) optionlist appendfile_transport_options[] = { #ifdef SUPPORT_MAILDIR - { "*expand_maildir_use_size_file", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, expand_maildir_use_size_file) }, + { "*expand_maildir_use_size_file", opt_stringptr, LOFF(expand_maildir_use_size_file) }, #endif - { "*set_use_fcntl_lock",opt_bool | opt_hidden, - (void *)offsetof(appendfile_transport_options_block, set_use_fcntl) }, - { "*set_use_flock_lock",opt_bool | opt_hidden, - (void *)offsetof(appendfile_transport_options_block, set_use_flock) }, - { "*set_use_lockfile", opt_bool | opt_hidden, - (void *)offsetof(appendfile_transport_options_block, set_use_lockfile) }, + { "*set_use_fcntl_lock",opt_bool | opt_hidden, LOFF(set_use_fcntl) }, + { "*set_use_flock_lock",opt_bool | opt_hidden, LOFF(set_use_flock) }, + { "*set_use_lockfile", opt_bool | opt_hidden, LOFF(set_use_lockfile) }, #ifdef SUPPORT_MBX - { "*set_use_mbx_lock", opt_bool | opt_hidden, - (void *)offsetof(appendfile_transport_options_block, set_use_mbx_lock) }, + { "*set_use_mbx_lock", opt_bool | opt_hidden, LOFF(set_use_mbx_lock) }, #endif - { "allow_fifo", opt_bool, - (void *)offsetof(appendfile_transport_options_block, allow_fifo) }, - { "allow_symlink", opt_bool, - (void *)offsetof(appendfile_transport_options_block, allow_symlink) }, - { "batch_id", opt_stringptr | opt_public, - (void *)offsetof(transport_instance, batch_id) }, - { "batch_max", opt_int | opt_public, - (void *)offsetof(transport_instance, batch_max) }, - { "check_group", opt_bool, - (void *)offsetof(appendfile_transport_options_block, check_group) }, - { "check_owner", opt_bool, - (void *)offsetof(appendfile_transport_options_block, check_owner) }, - { "check_string", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, check_string) }, - { "create_directory", opt_bool, - (void *)offsetof(appendfile_transport_options_block, create_directory) }, - { "create_file", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, create_file_string) }, - { "directory", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, dirname) }, - { "directory_file", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, dirfilename) }, - { "directory_mode", opt_octint, - (void *)offsetof(appendfile_transport_options_block, dirmode) }, - { "escape_string", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, escape_string) }, - { "file", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, filename) }, - { "file_format", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, file_format) }, - { "file_must_exist", opt_bool, - (void *)offsetof(appendfile_transport_options_block, file_must_exist) }, - { "lock_fcntl_timeout", opt_time, - (void *)offsetof(appendfile_transport_options_block, lock_fcntl_timeout) }, - { "lock_flock_timeout", opt_time, - (void *)offsetof(appendfile_transport_options_block, lock_flock_timeout) }, - { "lock_interval", opt_time, - (void *)offsetof(appendfile_transport_options_block, lock_interval) }, - { "lock_retries", opt_int, - (void *)offsetof(appendfile_transport_options_block, lock_retries) }, - { "lockfile_mode", opt_octint, - (void *)offsetof(appendfile_transport_options_block, lockfile_mode) }, - { "lockfile_timeout", opt_time, - (void *)offsetof(appendfile_transport_options_block, lockfile_timeout) }, - { "mailbox_filecount", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, mailbox_filecount_string) }, - { "mailbox_size", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, mailbox_size_string) }, + { "allow_fifo", opt_bool, LOFF(allow_fifo) }, + { "allow_symlink", opt_bool, LOFF(allow_symlink) }, + { "batch_id", opt_stringptr | opt_public, OPT_OFF(transport_instance, batch_id) }, + { "batch_max", opt_int | opt_public, OPT_OFF(transport_instance, batch_max) }, + { "check_group", opt_bool, LOFF(check_group) }, + { "check_owner", opt_bool, LOFF(check_owner) }, + { "check_string", opt_stringptr, LOFF(check_string) }, + { "create_directory", opt_bool, LOFF(create_directory) }, + { "create_file", opt_stringptr, LOFF(create_file_string) }, + { "directory", opt_stringptr, LOFF(dirname) }, + { "directory_file", opt_stringptr, LOFF(dirfilename) }, + { "directory_mode", opt_octint, LOFF(dirmode) }, + { "escape_string", opt_stringptr, LOFF(escape_string) }, + { "file", opt_stringptr, LOFF(filename) }, + { "file_format", opt_stringptr, LOFF(file_format) }, + { "file_must_exist", opt_bool, LOFF(file_must_exist) }, + { "lock_fcntl_timeout", opt_time, LOFF(lock_fcntl_timeout) }, + { "lock_flock_timeout", opt_time, LOFF(lock_flock_timeout) }, + { "lock_interval", opt_time, LOFF(lock_interval) }, + { "lock_retries", opt_int, LOFF(lock_retries) }, + { "lockfile_mode", opt_octint, LOFF(lockfile_mode) }, + { "lockfile_timeout", opt_time, LOFF(lockfile_timeout) }, + { "mailbox_filecount", opt_stringptr, LOFF(mailbox_filecount_string) }, + { "mailbox_size", opt_stringptr, LOFF(mailbox_size_string) }, #ifdef SUPPORT_MAILDIR - { "maildir_format", opt_bool, - (void *)offsetof(appendfile_transport_options_block, maildir_format ) } , - { "maildir_quota_directory_regex", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, maildir_dir_regex) }, - { "maildir_retries", opt_int, - (void *)offsetof(appendfile_transport_options_block, maildir_retries) }, - { "maildir_tag", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, maildir_tag) }, - { "maildir_use_size_file", opt_expand_bool, - (void *)offsetof(appendfile_transport_options_block, maildir_use_size_file ) } , - { "maildirfolder_create_regex", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, maildirfolder_create_regex ) }, + { "maildir_format", opt_bool, LOFF(maildir_format ) } , + { "maildir_quota_directory_regex", opt_stringptr, LOFF(maildir_dir_regex) }, + { "maildir_retries", opt_int, LOFF(maildir_retries) }, + { "maildir_tag", opt_stringptr, LOFF(maildir_tag) }, + { "maildir_use_size_file", opt_expand_bool, LOFF(maildir_use_size_file ) } , + { "maildirfolder_create_regex", opt_stringptr, LOFF(maildirfolder_create_regex ) }, #endif /* SUPPORT_MAILDIR */ #ifdef SUPPORT_MAILSTORE - { "mailstore_format", opt_bool, - (void *)offsetof(appendfile_transport_options_block, mailstore_format ) }, - { "mailstore_prefix", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, mailstore_prefix ) }, - { "mailstore_suffix", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, mailstore_suffix ) }, + { "mailstore_format", opt_bool, LOFF(mailstore_format ) }, + { "mailstore_prefix", opt_stringptr, LOFF(mailstore_prefix ) }, + { "mailstore_suffix", opt_stringptr, LOFF(mailstore_suffix ) }, #endif /* SUPPORT_MAILSTORE */ #ifdef SUPPORT_MBX - { "mbx_format", opt_bool, - (void *)offsetof(appendfile_transport_options_block, mbx_format ) } , + { "mbx_format", opt_bool, LOFF(mbx_format ) } , #endif /* SUPPORT_MBX */ - { "message_prefix", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, message_prefix) }, - { "message_suffix", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, message_suffix) }, - { "mode", opt_octint, - (void *)offsetof(appendfile_transport_options_block, mode) }, - { "mode_fail_narrower",opt_bool, - (void *)offsetof(appendfile_transport_options_block, mode_fail_narrower) }, - { "notify_comsat", opt_bool, - (void *)offsetof(appendfile_transport_options_block, notify_comsat) }, - { "quota", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, quota) }, - { "quota_directory", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, quota_directory) }, - { "quota_filecount", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, quota_filecount) }, - { "quota_is_inclusive", opt_bool, - (void *)offsetof(appendfile_transport_options_block, quota_is_inclusive) }, - { "quota_size_regex", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, quota_size_regex) }, - { "quota_warn_message", opt_stringptr | opt_public, - (void *)offsetof(transport_instance, warn_message) }, - { "quota_warn_threshold", opt_stringptr, - (void *)offsetof(appendfile_transport_options_block, quota_warn_threshold) }, - { "use_bsmtp", opt_bool, - (void *)offsetof(appendfile_transport_options_block, use_bsmtp) }, - { "use_crlf", opt_bool, - (void *)offsetof(appendfile_transport_options_block, use_crlf) }, - { "use_fcntl_lock", opt_bool_set, - (void *)offsetof(appendfile_transport_options_block, use_fcntl) }, - { "use_flock_lock", opt_bool_set, - (void *)offsetof(appendfile_transport_options_block, use_flock) }, - { "use_lockfile", opt_bool_set, - (void *)offsetof(appendfile_transport_options_block, use_lockfile) }, + { "message_prefix", opt_stringptr, LOFF(message_prefix) }, + { "message_suffix", opt_stringptr, LOFF(message_suffix) }, + { "mode", opt_octint, LOFF(mode) }, + { "mode_fail_narrower",opt_bool, LOFF(mode_fail_narrower) }, + { "notify_comsat", opt_bool, LOFF(notify_comsat) }, + { "quota", opt_stringptr, LOFF(quota) }, + { "quota_directory", opt_stringptr, LOFF(quota_directory) }, + { "quota_filecount", opt_stringptr, LOFF(quota_filecount) }, + { "quota_is_inclusive", opt_bool, LOFF(quota_is_inclusive) }, + { "quota_size_regex", opt_stringptr, LOFF(quota_size_regex) }, + { "quota_warn_message", opt_stringptr | opt_public, OPT_OFF(transport_instance, warn_message) }, + { "quota_warn_threshold", opt_stringptr, LOFF(quota_warn_threshold) }, + { "use_bsmtp", opt_bool, LOFF(use_bsmtp) }, + { "use_crlf", opt_bool, LOFF(use_crlf) }, + { "use_fcntl_lock", opt_bool_set, LOFF(use_fcntl) }, + { "use_flock_lock", opt_bool_set, LOFF(use_flock) }, + { "use_lockfile", opt_bool_set, LOFF(use_lockfile) }, #ifdef SUPPORT_MBX - { "use_mbx_lock", opt_bool_set, - (void *)offsetof(appendfile_transport_options_block, use_mbx_lock) }, + { "use_mbx_lock", opt_bool_set, LOFF(use_mbx_lock) }, #endif /* SUPPORT_MBX */ }; diff --git a/src/src/transports/autoreply.c b/src/src/transports/autoreply.c index 666591b60..4b5ef8e17 100644 --- a/src/src/transports/autoreply.c +++ b/src/src/transports/autoreply.c @@ -16,44 +16,27 @@ order (note that "_" comes before the lower case letters). Those starting with "*" are not settable by the user but are used by the option-reading software for alternative value types. Some options are publicly visible and so are stored in the driver instance block. These are flagged with opt_public. */ +#define LOFF(field) OPT_OFF(autoreply_transport_options_block, field) optionlist autoreply_transport_options[] = { - { "bcc", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, bcc) }, - { "cc", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, cc) }, - { "file", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, file) }, - { "file_expand", opt_bool, - (void *)offsetof(autoreply_transport_options_block, file_expand) }, - { "file_optional", opt_bool, - (void *)offsetof(autoreply_transport_options_block, file_optional) }, - { "from", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, from) }, - { "headers", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, headers) }, - { "log", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, logfile) }, - { "mode", opt_octint, - (void *)offsetof(autoreply_transport_options_block, mode) }, - { "never_mail", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, never_mail) }, - { "once", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, oncelog) }, - { "once_file_size", opt_int, - (void *)offsetof(autoreply_transport_options_block, once_file_size) }, - { "once_repeat", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, once_repeat) }, - { "reply_to", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, reply_to) }, - { "return_message", opt_bool, - (void *)offsetof(autoreply_transport_options_block, return_message) }, - { "subject", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, subject) }, - { "text", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, text) }, - { "to", opt_stringptr, - (void *)offsetof(autoreply_transport_options_block, to) }, + { "bcc", opt_stringptr, LOFF(bcc) }, + { "cc", opt_stringptr, LOFF(cc) }, + { "file", opt_stringptr, LOFF(file) }, + { "file_expand", opt_bool, LOFF(file_expand) }, + { "file_optional", opt_bool, LOFF(file_optional) }, + { "from", opt_stringptr, LOFF(from) }, + { "headers", opt_stringptr, LOFF(headers) }, + { "log", opt_stringptr, LOFF(logfile) }, + { "mode", opt_octint, LOFF(mode) }, + { "never_mail", opt_stringptr, LOFF(never_mail) }, + { "once", opt_stringptr, LOFF(oncelog) }, + { "once_file_size", opt_int, LOFF(once_file_size) }, + { "once_repeat", opt_stringptr, LOFF(once_repeat) }, + { "reply_to", opt_stringptr, LOFF(reply_to) }, + { "return_message", opt_bool, LOFF(return_message) }, + { "subject", opt_stringptr, LOFF(subject) }, + { "text", opt_stringptr, LOFF(text) }, + { "to", opt_stringptr, LOFF(to) }, }; /* Size of the options list. An extern variable has to be used so that its diff --git a/src/src/transports/lmtp.c b/src/src/transports/lmtp.c index 306ec450b..32c57166c 100644 --- a/src/src/transports/lmtp.c +++ b/src/src/transports/lmtp.c @@ -21,17 +21,17 @@ instance block so as to be publicly visible; these are flagged with opt_public. optionlist lmtp_transport_options[] = { { "batch_id", opt_stringptr | opt_public, - (void *)offsetof(transport_instance, batch_id) }, + OPT_OFF(transport_instance, batch_id) }, { "batch_max", opt_int | opt_public, - (void *)offsetof(transport_instance, batch_max) }, + OPT_OFF(transport_instance, batch_max) }, { "command", opt_stringptr, - (void *)offsetof(lmtp_transport_options_block, cmd) }, + OPT_OFF(lmtp_transport_options_block, cmd) }, { "ignore_quota", opt_bool, - (void *)offsetof(lmtp_transport_options_block, ignore_quota) }, + OPT_OFF(lmtp_transport_options_block, ignore_quota) }, { "socket", opt_stringptr, - (void *)offsetof(lmtp_transport_options_block, skt) }, + OPT_OFF(lmtp_transport_options_block, skt) }, { "timeout", opt_time, - (void *)offsetof(lmtp_transport_options_block, timeout) } + OPT_OFF(lmtp_transport_options_block, timeout) } }; /* Size of the options list. An extern variable has to be used so that its diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c index 4ca35aa41..ca22f2659 100644 --- a/src/src/transports/pipe.c +++ b/src/src/transports/pipe.c @@ -22,72 +22,50 @@ with "*" are not settable by the user but are used by the option-reading software for alternative value types. Some options are stored in the transport instance block so as to be publicly visible; these are flagged with opt_public. */ +#define LOFF(field) OPT_OFF(pipe_transport_options_block, field) optionlist pipe_transport_options[] = { - { "allow_commands", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, allow_commands) }, + { "allow_commands", opt_stringptr, LOFF(allow_commands) }, { "batch_id", opt_stringptr | opt_public, - (void *)offsetof(transport_instance, batch_id) }, + OPT_OFF(transport_instance, batch_id) }, { "batch_max", opt_int | opt_public, - (void *)offsetof(transport_instance, batch_max) }, - { "check_string", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, check_string) }, - { "command", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, cmd) }, - { "environment", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, environment) }, - { "escape_string", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, escape_string) }, - { "force_command", opt_bool, - (void *)offsetof(pipe_transport_options_block, force_command) }, - { "freeze_exec_fail", opt_bool, - (void *)offsetof(pipe_transport_options_block, freeze_exec_fail) }, - { "freeze_signal", opt_bool, - (void *)offsetof(pipe_transport_options_block, freeze_signal) }, - { "ignore_status", opt_bool, - (void *)offsetof(pipe_transport_options_block, ignore_status) }, + OPT_OFF(transport_instance, batch_max) }, + { "check_string", opt_stringptr, LOFF(check_string) }, + { "command", opt_stringptr, LOFF(cmd) }, + { "environment", opt_stringptr, LOFF(environment) }, + { "escape_string", opt_stringptr, LOFF(escape_string) }, + { "force_command", opt_bool, LOFF(force_command) }, + { "freeze_exec_fail", opt_bool, LOFF(freeze_exec_fail) }, + { "freeze_signal", opt_bool, LOFF(freeze_signal) }, + { "ignore_status", opt_bool, LOFF(ignore_status) }, { "log_defer_output", opt_bool | opt_public, - (void *)offsetof(transport_instance, log_defer_output) }, + OPT_OFF(transport_instance, log_defer_output) }, { "log_fail_output", opt_bool | opt_public, - (void *)offsetof(transport_instance, log_fail_output) }, + OPT_OFF(transport_instance, log_fail_output) }, { "log_output", opt_bool | opt_public, - (void *)offsetof(transport_instance, log_output) }, - { "max_output", opt_mkint, - (void *)offsetof(pipe_transport_options_block, max_output) }, - { "message_prefix", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, message_prefix) }, - { "message_suffix", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, message_suffix) }, - { "path", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, path) }, - { "permit_coredump", opt_bool, - (void *)offsetof(pipe_transport_options_block, permit_coredump) }, + OPT_OFF(transport_instance, log_output) }, + { "max_output", opt_mkint, LOFF(max_output) }, + { "message_prefix", opt_stringptr, LOFF(message_prefix) }, + { "message_suffix", opt_stringptr, LOFF(message_suffix) }, + { "path", opt_stringptr, LOFF(path) }, + { "permit_coredump", opt_bool, LOFF(permit_coredump) }, { "pipe_as_creator", opt_bool | opt_public, - (void *)offsetof(transport_instance, deliver_as_creator) }, - { "restrict_to_path", opt_bool, - (void *)offsetof(pipe_transport_options_block, restrict_to_path) }, + OPT_OFF(transport_instance, deliver_as_creator) }, + { "restrict_to_path", opt_bool, LOFF(restrict_to_path) }, { "return_fail_output",opt_bool | opt_public, - (void *)offsetof(transport_instance, return_fail_output) }, + OPT_OFF(transport_instance, return_fail_output) }, { "return_output", opt_bool | opt_public, - (void *)offsetof(transport_instance, return_output) }, - { "temp_errors", opt_stringptr, - (void *)offsetof(pipe_transport_options_block, temp_errors) }, - { "timeout", opt_time, - (void *)offsetof(pipe_transport_options_block, timeout) }, - { "timeout_defer", opt_bool, - (void *)offsetof(pipe_transport_options_block, timeout_defer) }, - { "umask", opt_octint, - (void *)offsetof(pipe_transport_options_block, umask) }, - { "use_bsmtp", opt_bool, - (void *)offsetof(pipe_transport_options_block, use_bsmtp) }, + OPT_OFF(transport_instance, return_output) }, + { "temp_errors", opt_stringptr, LOFF(temp_errors) }, + { "timeout", opt_time, LOFF(timeout) }, + { "timeout_defer", opt_bool, LOFF(timeout_defer) }, + { "umask", opt_octint, LOFF(umask) }, + { "use_bsmtp", opt_bool, LOFF(use_bsmtp) }, #ifdef HAVE_SETCLASSRESOURCES - { "use_classresources", opt_bool, - (void *)offsetof(pipe_transport_options_block, use_classresources) }, + { "use_classresources", opt_bool, LOFF(use_classresources) }, #endif - { "use_crlf", opt_bool, - (void *)offsetof(pipe_transport_options_block, use_crlf) }, - { "use_shell", opt_bool, - (void *)offsetof(pipe_transport_options_block, use_shell) }, + { "use_crlf", opt_bool, LOFF(use_crlf) }, + { "use_shell", opt_bool, LOFF(use_shell) }, }; /* Size of the options list. An extern variable has to be used so that its diff --git a/src/src/transports/queuefile.c b/src/src/transports/queuefile.c index 4339d1fdd..76b994d8f 100644 --- a/src/src/transports/queuefile.c +++ b/src/src/transports/queuefile.c @@ -18,7 +18,7 @@ opt_public flag. */ optionlist queuefile_transport_options[] = { { "directory", opt_stringptr, - (void *)offsetof(queuefile_transport_options_block, dirname) }, + OPT_OFF(queuefile_transport_options_block, dirname) }, }; diff --git a/src/src/transports/smtp.c b/src/src/transports/smtp.c index d7147b2f9..58fe055b7 100644 --- a/src/src/transports/smtp.c +++ b/src/src/transports/smtp.c @@ -18,195 +18,126 @@ over TCP/IP. The options must be in alphabetic order (note that "_" comes before the lower case letters). Some live in the transport_instance block so as to be publicly visible; these are flagged with opt_public. */ +#define LOFF(field) OPT_OFF(smtp_transport_options_block, field) + optionlist smtp_transport_options[] = { { "*expand_multi_domain", opt_stringptr | opt_hidden | opt_public, - (void *)offsetof(transport_instance, expand_multi_domain) }, + OPT_OFF(transport_instance, expand_multi_domain) }, { "*expand_retry_include_ip_address", opt_stringptr | opt_hidden, - (void *)(offsetof(smtp_transport_options_block, expand_retry_include_ip_address)) }, + LOFF(expand_retry_include_ip_address) }, { "address_retry_include_sender", opt_bool, - (void *)offsetof(smtp_transport_options_block, address_retry_include_sender) }, - { "allow_localhost", opt_bool, - (void *)offsetof(smtp_transport_options_block, allow_localhost) }, + LOFF(address_retry_include_sender) }, + { "allow_localhost", opt_bool, LOFF(allow_localhost) }, #ifdef EXPERIMENTAL_ARC - { "arc_sign", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, arc_sign) }, -#endif - { "authenticated_sender", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, authenticated_sender) }, - { "authenticated_sender_force", opt_bool, - (void *)offsetof(smtp_transport_options_block, authenticated_sender_force) }, - { "command_timeout", opt_time, - (void *)offsetof(smtp_transport_options_block, command_timeout) }, - { "connect_timeout", opt_time, - (void *)offsetof(smtp_transport_options_block, connect_timeout) }, + { "arc_sign", opt_stringptr, LOFF(arc_sign) }, +#endif + { "authenticated_sender", opt_stringptr, LOFF(authenticated_sender) }, + { "authenticated_sender_force", opt_bool, LOFF(authenticated_sender_force) }, + { "command_timeout", opt_time, LOFF(command_timeout) }, + { "connect_timeout", opt_time, LOFF(connect_timeout) }, { "connection_max_messages", opt_int | opt_public, - (void *)offsetof(transport_instance, connection_max_messages) }, + OPT_OFF(transport_instance, connection_max_messages) }, # ifdef SUPPORT_DANE - { "dane_require_tls_ciphers", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dane_require_tls_ciphers) }, + { "dane_require_tls_ciphers", opt_stringptr, LOFF(dane_require_tls_ciphers) }, # endif - { "data_timeout", opt_time, - (void *)offsetof(smtp_transport_options_block, data_timeout) }, - { "delay_after_cutoff", opt_bool, - (void *)offsetof(smtp_transport_options_block, delay_after_cutoff) }, + { "data_timeout", opt_time, LOFF(data_timeout) }, + { "delay_after_cutoff", opt_bool, LOFF(delay_after_cutoff) }, #ifndef DISABLE_DKIM - { "dkim_canon", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_canon) }, - { "dkim_domain", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_domain) }, - { "dkim_hash", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_hash) }, - { "dkim_identity", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_identity) }, - { "dkim_private_key", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_private_key) }, - { "dkim_selector", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_selector) }, - { "dkim_sign_headers", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_sign_headers) }, - { "dkim_strict", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_strict) }, - { "dkim_timestamps", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dkim.dkim_timestamps) }, -#endif - { "dns_qualify_single", opt_bool, - (void *)offsetof(smtp_transport_options_block, dns_qualify_single) }, - { "dns_search_parents", opt_bool, - (void *)offsetof(smtp_transport_options_block, dns_search_parents) }, - { "dnssec_request_domains", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dnssec.request) }, - { "dnssec_require_domains", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dnssec.require) }, - { "dscp", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, dscp) }, - { "fallback_hosts", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, fallback_hosts) }, - { "final_timeout", opt_time, - (void *)offsetof(smtp_transport_options_block, final_timeout) }, - { "gethostbyname", opt_bool, - (void *)offsetof(smtp_transport_options_block, gethostbyname) }, - { "helo_data", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, helo_data) }, - { "hosts", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts) }, - { "hosts_avoid_esmtp", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_avoid_esmtp) }, - { "hosts_avoid_pipelining", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_avoid_pipelining) }, + { "dkim_canon", opt_stringptr, LOFF(dkim.dkim_canon) }, + { "dkim_domain", opt_stringptr, LOFF(dkim.dkim_domain) }, + { "dkim_hash", opt_stringptr, LOFF(dkim.dkim_hash) }, + { "dkim_identity", opt_stringptr, LOFF(dkim.dkim_identity) }, + { "dkim_private_key", opt_stringptr, LOFF(dkim.dkim_private_key) }, + { "dkim_selector", opt_stringptr, LOFF(dkim.dkim_selector) }, + { "dkim_sign_headers", opt_stringptr, LOFF(dkim.dkim_sign_headers) }, + { "dkim_strict", opt_stringptr, LOFF(dkim.dkim_strict) }, + { "dkim_timestamps", opt_stringptr, LOFF(dkim.dkim_timestamps) }, +#endif + { "dns_qualify_single", opt_bool, LOFF(dns_qualify_single) }, + { "dns_search_parents", opt_bool, LOFF(dns_search_parents) }, + { "dnssec_request_domains", opt_stringptr, LOFF(dnssec.request) }, + { "dnssec_require_domains", opt_stringptr, LOFF(dnssec.require) }, + { "dscp", opt_stringptr, LOFF(dscp) }, + { "fallback_hosts", opt_stringptr, LOFF(fallback_hosts) }, + { "final_timeout", opt_time, LOFF(final_timeout) }, + { "gethostbyname", opt_bool, LOFF(gethostbyname) }, + { "helo_data", opt_stringptr, LOFF(helo_data) }, + { "hosts", opt_stringptr, LOFF(hosts) }, + { "hosts_avoid_esmtp", opt_stringptr, LOFF(hosts_avoid_esmtp) }, + { "hosts_avoid_pipelining", opt_stringptr, LOFF(hosts_avoid_pipelining) }, #ifndef DISABLE_TLS - { "hosts_avoid_tls", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_avoid_tls) }, + { "hosts_avoid_tls", opt_stringptr, LOFF(hosts_avoid_tls) }, #endif - { "hosts_max_try", opt_int, - (void *)offsetof(smtp_transport_options_block, hosts_max_try) }, - { "hosts_max_try_hardlimit", opt_int, - (void *)offsetof(smtp_transport_options_block, hosts_max_try_hardlimit) }, + { "hosts_max_try", opt_int, LOFF(hosts_max_try) }, + { "hosts_max_try_hardlimit", opt_int, LOFF(hosts_max_try_hardlimit) }, #ifndef DISABLE_TLS - { "hosts_nopass_tls", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_nopass_tls) }, - { "hosts_noproxy_tls", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_noproxy_tls) }, + { "hosts_nopass_tls", opt_stringptr, LOFF(hosts_nopass_tls) }, + { "hosts_noproxy_tls", opt_stringptr, LOFF(hosts_noproxy_tls) }, #endif - { "hosts_override", opt_bool, - (void *)offsetof(smtp_transport_options_block, hosts_override) }, + { "hosts_override", opt_bool, LOFF(hosts_override) }, #ifndef DISABLE_PIPE_CONNECT - { "hosts_pipe_connect", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_pipe_connect) }, + { "hosts_pipe_connect", opt_stringptr, LOFF(hosts_pipe_connect) }, #endif - { "hosts_randomize", opt_bool, - (void *)offsetof(smtp_transport_options_block, hosts_randomize) }, + { "hosts_randomize", opt_bool, LOFF(hosts_randomize) }, #if !defined(DISABLE_TLS) && !defined(DISABLE_OCSP) - { "hosts_request_ocsp", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_request_ocsp) }, + { "hosts_request_ocsp", opt_stringptr, LOFF(hosts_request_ocsp) }, #endif - { "hosts_require_auth", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_require_auth) }, + { "hosts_require_auth", opt_stringptr, LOFF(hosts_require_auth) }, #ifndef DISABLE_TLS # ifdef SUPPORT_DANE - { "hosts_require_dane", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_require_dane) }, + { "hosts_require_dane", opt_stringptr, LOFF(hosts_require_dane) }, # endif # ifndef DISABLE_OCSP - { "hosts_require_ocsp", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_require_ocsp) }, + { "hosts_require_ocsp", opt_stringptr, LOFF(hosts_require_ocsp) }, # endif - { "hosts_require_tls", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_require_tls) }, + { "hosts_require_tls", opt_stringptr, LOFF(hosts_require_tls) }, #endif - { "hosts_try_auth", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_try_auth) }, - { "hosts_try_chunking", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_try_chunking) }, + { "hosts_try_auth", opt_stringptr, LOFF(hosts_try_auth) }, + { "hosts_try_chunking", opt_stringptr, LOFF(hosts_try_chunking) }, #ifdef SUPPORT_DANE - { "hosts_try_dane", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_try_dane) }, + { "hosts_try_dane", opt_stringptr, LOFF(hosts_try_dane) }, #endif - { "hosts_try_fastopen", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_try_fastopen) }, + { "hosts_try_fastopen", opt_stringptr, LOFF(hosts_try_fastopen) }, #ifndef DISABLE_PRDR - { "hosts_try_prdr", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_try_prdr) }, + { "hosts_try_prdr", opt_stringptr, LOFF(hosts_try_prdr) }, #endif #ifndef DISABLE_TLS - { "hosts_verify_avoid_tls", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, hosts_verify_avoid_tls) }, -#endif - { "interface", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, interface) }, - { "keepalive", opt_bool, - (void *)offsetof(smtp_transport_options_block, keepalive) }, - { "lmtp_ignore_quota", opt_bool, - (void *)offsetof(smtp_transport_options_block, lmtp_ignore_quota) }, + { "hosts_verify_avoid_tls", opt_stringptr, LOFF(hosts_verify_avoid_tls) }, +#endif + { "interface", opt_stringptr, LOFF(interface) }, + { "keepalive", opt_bool, LOFF(keepalive) }, + { "lmtp_ignore_quota", opt_bool, LOFF(lmtp_ignore_quota) }, { "max_rcpt", opt_int | opt_public, - (void *)offsetof(transport_instance, max_addresses) }, + OPT_OFF(transport_instance, max_addresses) }, { "multi_domain", opt_expand_bool | opt_public, - (void *)offsetof(transport_instance, multi_domain) }, - { "port", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, port) }, - { "protocol", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, protocol) }, - { "retry_include_ip_address", opt_expand_bool, - (void *)offsetof(smtp_transport_options_block, retry_include_ip_address) }, - { "serialize_hosts", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, serialize_hosts) }, - { "size_addition", opt_int, - (void *)offsetof(smtp_transport_options_block, size_addition) }, + OPT_OFF(transport_instance, multi_domain) }, + { "port", opt_stringptr, LOFF(port) }, + { "protocol", opt_stringptr, LOFF(protocol) }, + { "retry_include_ip_address", opt_expand_bool, LOFF(retry_include_ip_address) }, + { "serialize_hosts", opt_stringptr, LOFF(serialize_hosts) }, + { "size_addition", opt_int, LOFF(size_addition) }, #ifdef SUPPORT_SOCKS - { "socks_proxy", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, socks_proxy) }, + { "socks_proxy", opt_stringptr, LOFF(socks_proxy) }, #endif #ifndef DISABLE_TLS - { "tls_certificate", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_certificate) }, - { "tls_crl", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_crl) }, - { "tls_dh_min_bits", opt_int, - (void *)offsetof(smtp_transport_options_block, tls_dh_min_bits) }, - { "tls_privatekey", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_privatekey) }, - { "tls_require_ciphers", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_require_ciphers) }, + { "tls_certificate", opt_stringptr, LOFF(tls_certificate) }, + { "tls_crl", opt_stringptr, LOFF(tls_crl) }, + { "tls_dh_min_bits", opt_int, LOFF(tls_dh_min_bits) }, + { "tls_privatekey", opt_stringptr, LOFF(tls_privatekey) }, + { "tls_require_ciphers", opt_stringptr, LOFF(tls_require_ciphers) }, # ifdef EXPERIMENTAL_TLS_RESUME - { "tls_resumption_hosts", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_resumption_hosts) }, + { "tls_resumption_hosts", opt_stringptr, LOFF(tls_resumption_hosts) }, # endif - { "tls_sni", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_sni) }, - { "tls_tempfail_tryclear", opt_bool, - (void *)offsetof(smtp_transport_options_block, tls_tempfail_tryclear) }, - { "tls_try_verify_hosts", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_try_verify_hosts) }, - { "tls_verify_cert_hostnames", opt_stringptr, - (void *)offsetof(smtp_transport_options_block,tls_verify_cert_hostnames)}, - { "tls_verify_certificates", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_verify_certificates) }, - { "tls_verify_hosts", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, tls_verify_hosts) }, + { "tls_sni", opt_stringptr, LOFF(tls_sni) }, + { "tls_tempfail_tryclear", opt_bool, LOFF(tls_tempfail_tryclear) }, + { "tls_try_verify_hosts", opt_stringptr, LOFF(tls_try_verify_hosts) }, + { "tls_verify_cert_hostnames", opt_stringptr, LOFF(tls_verify_cert_hostnames)}, + { "tls_verify_certificates", opt_stringptr, LOFF(tls_verify_certificates) }, + { "tls_verify_hosts", opt_stringptr, LOFF(tls_verify_hosts) }, #endif #ifdef SUPPORT_I18N - { "utf8_downconvert", opt_stringptr, - (void *)offsetof(smtp_transport_options_block, utf8_downconvert) }, + { "utf8_downconvert", opt_stringptr, LOFF(utf8_downconvert) }, #endif }; |