summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2016-03-15 23:45:48 +0100
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>2016-03-15 23:45:48 +0100
commit634371ae314493f374e080b227bb152ee677160b (patch)
treef5d24f328d8a60982f4db9e2fd8f6d26600f906d
parent29de96c63ab87b797390370c3235499a71027c0f (diff)
parentd1f63772288f3282c5c4b318d3d88b9cfd27b974 (diff)
downloadexim4-exim-4_84_2+fixes.tar.gz
Merge branch 'exim-4_84+CVE-2016-1531' into exim-4_84_2+fixesexim-4_84_2+fixes
-rw-r--r--doc/doc-docbook/spec.xfpt13
-rw-r--r--doc/doc-txt/NewStuff2
-rw-r--r--src/src/exim.c12
-rw-r--r--src/src/expand.c1
-rw-r--r--src/src/globals.c1
-rw-r--r--src/src/globals.h1
-rw-r--r--src/src/readconf.c6
-rw-r--r--test/confs/06151
-rw-r--r--test/stderr/061520
9 files changed, 37 insertions, 20 deletions
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index c782294d9..86fed8ce0 100644
--- a/doc/doc-docbook/spec.xfpt
+++ b/doc/doc-docbook/spec.xfpt
@@ -11426,6 +11426,12 @@ the result, the name is not accepted, and &$host_lookup_deferred$& is set to
.vindex "&$host_lookup_failed$&"
See &$host_lookup_deferred$&.
+.vitem &$initial_cwd$&
+.vindex "&$initial_cwd$&
+This variable contains the full path name of the initial working
+directory of the current Exim process. This may differ from the current
+working directory, as Exim changes this to "/" during early startup, and
+to &$spool_directory$& later.
.vitem &$inode$&
.vindex "&$inode$&"
@@ -14602,9 +14608,10 @@ FOO and having FOO_HOME in your &%keep_environment%& option may have
unexpected results. You may work around this using a regular expression
that does not match the macro name: ^[F]OO_HOME$.
-Current versions of Exim issue a warning during startupif you do not mention
-&%keep_environment%& or &%add_environment%& in your runtime configuration
-file.
+Current versions of Exim issue a warning during startup if you do not mention
+&%keep_environment%& in your runtime configuration file and if there is
+anything in your environment. Future versions may not issue that warning
+anymore.
.wen
diff --git a/doc/doc-txt/NewStuff b/doc/doc-txt/NewStuff
index 1b7ad35dd..9737b3506 100644
--- a/doc/doc-txt/NewStuff
+++ b/doc/doc-txt/NewStuff
@@ -6,6 +6,8 @@ Before a formal release, there may be quite a lot of detail so that people can
test from the snapshots or the CVS before the documentation is updated. Once
the documentation is updated, this file is reduced to a short list.
+ 9. New $initial_cwd expansion variable.
+
Version 4.84
------------
diff --git a/src/src/exim.c b/src/src/exim.c
index 3dc5214f1..ea00dc5d2 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -3692,6 +3692,13 @@ if (Uchdir("/") < 0)
exit(EXIT_FAILURE);
}
+/* Store the initial cwd before we change directories */
+if ((initial_cwd = getcwd(NULL, 0)) == NULL)
+ {
+ perror("exim: can't get the current working directory");
+ exit(EXIT_FAILURE);
+ }
+
readconf_main();
if (cleanup_environment() == FALSE)
@@ -3968,9 +3975,10 @@ if (((debug_selector & D_any) != 0 || (log_extra_selector & LX_arguments) != 0)
{
int i;
uschar *p = big_buffer;
- char * dummy;
Ustrcpy(p, "cwd= (failed)");
- dummy = /* quieten compiler */ getcwd(CS p+4, big_buffer_size - 4);
+
+ Ustrncpy(p + 4, initial_cwd, big_buffer_size-5);
+
while (*p) p++;
(void)string_format(p, big_buffer_size - (p - big_buffer), " %d args:", argc);
while (*p) p++;
diff --git a/src/src/expand.c b/src/src/expand.c
index 70d7c7d2f..5045635dc 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -501,6 +501,7 @@ static var_entry var_table[] = {
{ "host_data", vtype_stringptr, &host_data },
{ "host_lookup_deferred",vtype_int, &host_lookup_deferred },
{ "host_lookup_failed", vtype_int, &host_lookup_failed },
+ { "initial_cwd", vtype_stringptr, &initial_cwd },
{ "inode", vtype_ino, &deliver_inode },
{ "interface_address", vtype_stringptr, &interface_address },
{ "interface_port", vtype_int, &interface_port },
diff --git a/src/src/globals.c b/src/src/globals.c
index 08e6e8d2d..03581c5ac 100644
--- a/src/src/globals.c
+++ b/src/src/globals.c
@@ -755,6 +755,7 @@ BOOL ignore_fromline_local = FALSE;
uschar *ignore_fromline_hosts = NULL;
BOOL inetd_wait_mode = FALSE;
int inetd_wait_timeout = -1;
+uschar *initial_cwd = NULL;
uschar *interface_address = NULL;
int interface_port = -1;
BOOL is_inetd = FALSE;
diff --git a/src/src/globals.h b/src/src/globals.h
index b3ad4b231..fc1cdbc68 100644
--- a/src/src/globals.h
+++ b/src/src/globals.h
@@ -483,6 +483,7 @@ extern BOOL ignore_fromline_local; /* Local SMTP ignore fromline */
extern uschar *ignore_fromline_hosts; /* Hosts permitted to send "From " */
extern BOOL inetd_wait_mode; /* Whether running in inetd wait mode */
extern int inetd_wait_timeout; /* Timeout for inetd wait mode */
+extern uschar *initial_cwd; /* The directory we where in at startup */
extern BOOL is_inetd; /* True for inetd calls */
extern uschar *iterate_item; /* Item from iterate list */
diff --git a/src/src/readconf.c b/src/src/readconf.c
index 6e330348f..fddb1095e 100644
--- a/src/src/readconf.c
+++ b/src/src/readconf.c
@@ -3415,10 +3415,10 @@ if (gnutls_require_kx || gnutls_require_mac || gnutls_require_proto)
" are obsolete\n");
#endif /*SUPPORT_TLS*/
-if ((!add_environment || *add_environment == '\0') && !keep_environment)
+if (!keep_environment && environ && *environ)
log_write(0, LOG_MAIN,
- "WARNING: purging the environment.\n"
- " Suggested action: use keep_environment and add_environment.\n");
+ "Warning: purging the environment.\n"
+ " Suggested action: use keep_environment.");
}
diff --git a/test/confs/0615 b/test/confs/0615
index bbfc4978a..86ecee108 100644
--- a/test/confs/0615
+++ b/test/confs/0615
@@ -1,6 +1,7 @@
# exim test configuration 0615
exim_path = EXIM_PATH
tls_advertise_hosts =
+spool_directory = DIR/spool
perl_startup = $| = 1; \
print "Environment visible in Perl:\n"; \
print map { "$_=$ENV{$_}\n" } sort keys %ENV;
diff --git a/test/stderr/0615 b/test/stderr/0615
index 85ee6f760..d8d0f8547 100644
--- a/test/stderr/0615
+++ b/test/stderr/0615
@@ -1,15 +1,11 @@
LOG: MAIN
- WARNING: purging the environment.
- Suggested action: use keep_environment and add_environment.
-
+ Warning: purging the environment.
+ Suggested action: use keep_environment.
LOG: MAIN
- WARNING: purging the environment.
- Suggested action: use keep_environment and add_environment.
-
+ Warning: purging the environment.
+ Suggested action: use keep_environment.
LOG: MAIN
- WARNING: purging the environment.
- Suggested action: use keep_environment and add_environment.
-
-1999-03-02 09:44:33 WARNING: purging the environment.
- Suggested action: use keep_environment and add_environment.
-
+ Warning: purging the environment.
+ Suggested action: use keep_environment.
+1999-03-02 09:44:33 Warning: purging the environment.
+ Suggested action: use keep_environment.