X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/62b7cd086e8f69c7bb1334edd2e586ed6240b134..de5ba17561e686e5a05c9cc88288c82b563987de:/src/src/readconf.c diff --git a/src/src/readconf.c b/src/src/readconf.c index f90b66c3d..ead74c1d0 100644 --- a/src/src/readconf.c +++ b/src/src/readconf.c @@ -11,11 +11,14 @@ implementation of the conditional .ifdef etc. */ #include "exim.h" +extern char **environ; + static void fn_smtp_receive_timeout(const uschar * name, const uschar * str); static void save_config_line(const uschar* line); static void save_config_position(const uschar *file, int line); static void print_config(BOOL admin); + #define CSTATE_STACK_SIZE 10 @@ -178,6 +181,7 @@ static optionlist optionlist_config[] = { { "acl_smtp_starttls", opt_stringptr, &acl_smtp_starttls }, #endif { "acl_smtp_vrfy", opt_stringptr, &acl_smtp_vrfy }, + { "add_environment", opt_stringptr, &add_environment }, { "admin_groups", opt_gidlist, &admin_groups }, { "allow_domain_literals", opt_bool, &allow_domain_literals }, { "allow_mx_to_ip", opt_bool, &allow_mx_to_ip }, @@ -296,6 +300,7 @@ static optionlist optionlist_config[] = { { "ignore_bounce_errors_after", opt_time, &ignore_bounce_errors_after }, { "ignore_fromline_hosts", opt_stringptr, &ignore_fromline_hosts }, { "ignore_fromline_local", opt_bool, &ignore_fromline_local }, + { "keep_environment", opt_stringptr, &keep_environment }, { "keep_malformed", opt_time, &keep_malformed }, #ifdef LOOKUP_LDAP { "ldap_ca_cert_dir", opt_stringptr, &eldap_ca_cert_dir }, @@ -2549,6 +2554,7 @@ second argument is NULL. There are some special values: +name print a named list item local_scan print the local_scan options config print the configuration as it is parsed + environment print the used execution environment If the second argument is not NULL, it must be one of "router", "transport", "authenticator" or "macro" in which case the first argument identifies the @@ -2697,6 +2703,25 @@ if (type == NULL) names_only = TRUE; } + else if (Ustrcmp(name, "environment") == 0) + { + if (environ) + { + uschar **p; + size_t n; + for (p = USS environ; *p; p++) ; + n = p - USS environ; + qsort(environ, p - USS environ, sizeof(*p), string_compare_by_pointer); + + for (p = USS environ; *p; p++) + { + if (no_labels) *(Ustrchr(*p, '=')) = '\0'; + puts(*p); + } + } + return; + } + else { print_ol(find_option(name, optionlist_config, optionlist_config_size), @@ -3022,6 +3047,15 @@ const uschar *list = config_main_filelist; while((filename = string_nextinlist(&list, &sep, big_buffer, big_buffer_size)) != NULL) { + + /* To avoid confusion: Exim changes to / at the very beginning and + * and to $spool_directory later. */ + if (filename[0] != '/') + { + fprintf(stderr, "-C %s: only absolute names are allowed\n", filename); + exit(EXIT_FAILURE); + } + /* Cut out all the fancy processing unless specifically wanted */ #if defined(CONFIGURE_FILE_USE_NODE) || defined(CONFIGURE_FILE_USE_EUID) @@ -3467,6 +3501,11 @@ if (gnutls_require_kx || gnutls_require_mac || gnutls_require_proto) " gnutls_require_kx, gnutls_require_mac and gnutls_require_protocols" " are obsolete\n"); #endif /*SUPPORT_TLS*/ + +if ((!add_environment || *add_environment == '\0') && !keep_environment) + log_write(0, LOG_MAIN, + "WARNING: purging the environment.\n" + " Suggested action: use keep_environment and add_environment.\n"); } @@ -4298,7 +4337,7 @@ for (i = config_lines; i; i = i->next) ; if (next - p > 1) - memmove(p+1, next, strlen(next)+1); + memmove(p+1, next, Ustrlen(next)+1); if (*next == '"' || *next == '\'' || *next == '$') break;