1 /*@ S-nail - a mail user agent derived from Berkeley Mail. 2 *@ Some constants etc. for which adjustments may be desired. 3 *@ This is included (as mx/config.h) after all the (system) headers. 4 *@ TODO It is a wild name convention mess, to say the least. 5 * 6 * Copyright (c) 2012 - 2020 Steffen (Daode) Nurpmeso <steffen@sdaoden.eu>. 7 * SPDX-License-Identifier: ISC 8 * 9 * Permission to use, copy, modify, and/or distribute this software for any 10 * purpose with or without fee is hereby granted, provided that the above 11 * copyright notice and this permission notice appear in all copies. 12 * 13 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 14 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 15 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 16 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 17 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 18 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 19 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 20 */ 21 #ifndef mx_CONFIG_H 22 # define mx_CONFIG_H 23 24 #define ACCOUNT_NULL "null" /* Name of "null" account */ 25 #define n_ALIAS_MAXEXP 25 /* Maximum expansion of aliases */ 26 27 #define mx_CONTENT_DESC_FORWARDED_MESSAGE "Forwarded message" 28 #define mx_CONTENT_DESC_QUOTE_ATTACHMENT "Original message content" 29 #define mx_CONTENT_DESC_SMIME_MESSAGE "S/MIME encrypted message" 30 #define mx_CONTENT_DESC_SMIME_SIG "S/MIME digital signature" 31 32 /* Protocol version for *on-compose-splice** -- update manual on change! */ 33 #define mx_DIG_MSG_PLUMBING_VERSION "0 0 2" 34 #define mx_DOTLOCK_TRIES 5 /* Number of open(2) calls for dotlock */ 35 36 #define n_ERROR "ERROR" /* Is-error? Also as n_error[] */ 37 #define n_ESCAPE "~" /* Default escape for sending (POSIX standard) */ 38 39 #define mx_FILE_LOCK_TRIES 10 /* Maximum tries before file_lock() fails */ 40 #define mx_FILE_LOCK_MILLIS 200 /* If UZ_MAX, fall back to that */ 41 #define n_FORWARD_INJECT_HEAD "-------- Original Message --------\n" /* DOC! */ 42 #define n_FORWARD_INJECT_TAIL NIL /* DOC! */ 43 #define mx_FS_FILETYPE_CAT_PROG "cat" /* cat(1) */ 44 #define mx_FS_TMP_OPEN_TRIES 10 /* Maximum number of fs_tmp_open() tries */ 45 46 #define n_IMAP_DELIM "/." /* Directory separator ([0] == replacer, too) */ 47 48 #define n_LINE_EDITOR_CPL_WORD_BREAKS "\"'@=;|:" 49 /* Fallback in case the systems reports an empty hostname (?) */ 50 #define n_LOCALHOST_DEFAULT_NAME "localhost.localdomain" 51 52 #define n_MAILDIR_SEPARATOR ':' /* Flag separator character */ 53 #define n_MAXARGC 512 /* Maximum list of raw strings TODO dyn vector! */ 54 55 #define n_PATH_DEVNULL "/dev/null" /* Note: manual uses /dev/null as such */ 56 57 #define n_QUOTE_INJECT_HEAD "%f wrote:\n\n" /* DOC! */ 58 #define n_QUOTE_INJECT_TAIL NIL /* DOC! */ 59 60 #define REFERENCES_MAX 20 /* Maximum entries in References: */ 61 62 /* *bind-inter-byte-timeout* default -- update manual on change! */ 63 #define mx_BIND_INTER_BYTE_TIMEOUT "200" 64 65 #define mx_VEXPR_REGEX_MAX 16 /* Maximum address. `vexpr' regex(7) matches */ 66 67 /* * */ 68 69 /* Default log level */ 70 #define n_LOG_LEVEL su_DBGOR(su_LOG_WARN, su_LOG_CRIT) 71 72 /* * */ 73 74 /* Fallback MIME charsets, if *charset-7bit* and *charset-8bit* are not set. 75 * Note: must be lowercase! 76 * (Keep in SYNC: ./nail.1:"Character sets", mx-config.h:CHARSET_*!) */ 77 #define CHARSET_7BIT "us-ascii" 78 #ifdef mx_HAVE_ICONV 79 # define CHARSET_8BIT "utf-8" 80 # define CHARSET_8BIT_OKEY charset_8bit 81 #else 82 # ifdef mx_HAVE_ALWAYS_UNICODE_LOCALE 83 # define CHARSET_8BIT "utf-8" 84 # else 85 # define CHARSET_8BIT "iso-8859-1" 86 # endif 87 # define CHARSET_8BIT_OKEY ttycharset 88 #endif 89 90 #ifndef HOST_NAME_MAX 91 # ifdef _POSIX_HOST_NAME_MAX 92 # define HOST_NAME_MAX _POSIX_HOST_NAME_MAX 93 # else 94 # define HOST_NAME_MAX 255 95 # endif 96 #endif 97 98 /* Supported [mx_HAVE_]IDNA implementations TODO should not be here!?! */ 99 #define n_IDNA_IMPL_LIBIDN2 0 100 #define n_IDNA_IMPL_LIBIDN 1 101 #define n_IDNA_IMPL_IDNKIT 2 /* 1 + 2 */ 102 103 /* Max readable line width TODO simply use BUFSIZ? */ 104 #if BUFSIZ + 0 > 2560 105 # define LINESIZE BUFSIZ 106 #else 107 # define LINESIZE 2560 108 #endif 109 #define BUFFER_SIZE (BUFSIZ >= (1u << 13) ? BUFSIZ : (1u << 14)) 110 111 /* Default *mime-encoding* as enum mime_enc; one of _B64, _QP, _8B */ 112 #define MIME_DEFAULT_ENCODING MIMEE_QP 113 114 /* Maximum allowed line length in a mail before QP folding is necessary), and 115 * the real limit we go for */ 116 #define MIME_LINELEN_MAX 998 /* Plus CRLF */ 117 #define MIME_LINELEN_LIMIT (MIME_LINELEN_MAX - 48) 118 119 /* Ditto, SHOULD */ 120 #define MIME_LINELEN 78 /* Plus CRLF */ 121 122 /* And in headers which contain an encoded word according to RFC 2047 there is 123 * yet another limit; also RFC 2045: 6.7, (5). */ 124 #define MIME_LINELEN_RFC2047 76 125 126 /* TODO PATH_MAX: fixed-size buffer is always wrong (think NFS) */ 127 #ifndef PATH_MAX 128 # ifdef MAXPATHLEN 129 # define PATH_MAX MAXPATHLEN 130 # else 131 # define PATH_MAX 1024 /* _XOPEN_PATH_MAX POSIX 2008/Cor 1-2013 */ 132 # endif 133 #endif 134 135 /* Some environment variables for pipe hooks etc. */ 136 #define n_PIPEENV_FILENAME "MAILX_FILENAME" 137 #define n_PIPEENV_FILENAME_GENERATED "MAILX_FILENAME_GENERATED" 138 #define n_PIPEENV_FILENAME_TEMPORARY "MAILX_FILENAME_TEMPORARY" 139 #define n_PIPEENV_CONTENT "MAILX_CONTENT" 140 #define n_PIPEENV_CONTENT_EVIDENCE "MAILX_CONTENT_EVIDENCE" 141 #define n_PIPEENV_EXTERNAL_BODY_URL "MAILX_EXTERNAL_BODY_URL" 142 143 /* Maximum number of quote characters (not bytes!) that will be used on 144 * follow lines when compressing leading quote characters */ 145 #define n_QUOTE_MAX 42u 146 147 /* How much spaces a <tab> counts when *quote-fold*ing? (power-of-two!) */ 148 #define n_QUOTE_TAB_SPACES 8 149 150 /* Smells fishy after, or asks for shell expansion, dependent on context */ 151 #define n_SHEXP_MAGIC_PATH_CHARS "|&;<>{}()[]*?$`'\"\\" 152 153 /* Port to native MS-Windows and to ancient UNIX */ 154 #if !defined S_ISDIR && defined S_IFDIR && defined S_IFMT 155 # define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) 156 #endif 157 158 /* Maximum size of a message that is passed through to the spam system */ 159 #define SPAM_MAXSIZE 420000 160 161 /* Supported [mx_HAVE_]TLS implementations TODO should not be here!?! 162 * In addition mx_HAVE_XTLS is defined if it is OpenSSL/derivate, and set to 163 * "a version number", then (or 0 if not tested) */ 164 #define mx_TLS_IMPL_OPENSSL 1 165 #define mx_TLS_IMPL_RESSL 2 166 167 /* ... */ 168 169 #ifndef NAME_MAX 170 # ifdef _POSIX_NAME_MAX 171 # define NAME_MAX _POSIX_NAME_MAX 172 # else 173 # define NAME_MAX 14 174 # endif 175 #endif 176 #if NAME_MAX + 0 < 8 177 # error NAME_MAX is too small 178 #endif 179 180 #ifndef STDIN_FILENO 181 # define STDIN_FILENO 0 182 #endif 183 #ifndef STDOUT_FILENO 184 # define STDOUT_FILENO 1 185 #endif 186 #ifndef STDERR_FILENO 187 # define STDERR_FILENO 2 188 #endif 189 190 #ifdef O_NOCTTY 191 # define mx_O_NOCTTY O_NOCTTY 192 #else 193 # define mx_O_NOCTTY 0 194 #endif 195 /* 196 #ifdef O_NOFOLLOW 197 # define mx_O_NOFOLLOW O_NOFOLLOW 198 #else 199 # define mx_O_NOFOLLOW 0 200 #endif 201 */ 202 #define mx_O_NOXY_BITS (mx_O_NOCTTY /*| mx_O_NOFOLLOW*/) 203 204 #ifdef NSIG_MAX 205 # undef NSIG 206 # define NSIG NSIG_MAX 207 #elif !defined NSIG 208 # define NSIG ((sizeof(sigset_t) * 8) - 1) 209 #endif 210 211 #endif /* mx_CONFIG_H */ 212 /* s-it-mode */ 213