Gitweb:
https://git.exim.org/exim.git/commitdiff/0e0e1716286028c369f93a28412839c657e6b47c
Commit: 0e0e1716286028c369f93a28412839c657e6b47c
Parent: 0fe0ef0afacee70e95242c9e63cab9701c40a2ba
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Jun 4 13:54:55 2020 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Thu Jun 4 14:31:36 2020 +0100
Fix -bi. Bug 2590
Actual fix from pierre.labastie@??? ; additional coding and testcase bu jgh
Broken-by: bdcc6f2bd5
---
doc/doc-txt/ChangeLog | 4 ++++
src/src/exim.c | 10 +++++-----
src/src/smtp_in.c | 5 ++++-
test/confs/0590 | 12 ++++++++++++
test/scripts/0000-Basic/0590 | 6 ++++++
test/stdout/0590 | 1 +
6 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/doc/doc-txt/ChangeLog b/doc/doc-txt/ChangeLog
index d9959d5..2c33358 100644
--- a/doc/doc-txt/ChangeLog
+++ b/doc/doc-txt/ChangeLog
@@ -21,6 +21,10 @@ JH/03 Bug 2586: Fix listcount expansion operator. Using tainted arguments is
"log_reject_target", "malware" and "spam"; the arguments are expanded
so could be handling tainted values.
+JH/04 Bug 2590: Fix -bi (newaliases). A previous code rearrangement had
+ broken the (no-op) support for this sendmail command. Restore it
+ to doing nothing, silently, and returning good status.
+
Exim version 4.94
-----------------
diff --git a/src/src/exim.c b/src/src/exim.c
index 2f4149f..0b7b87e 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -2149,7 +2149,7 @@ on the second character (the one after '-'), to save some effort. */
concept of *the* alias file, but since Sun's YP make script calls
sendmail this way, some support must be provided. */
case 'i':
- if (!*++argrest) bi_option = TRUE;
+ if (!*argrest) bi_option = TRUE;
else badarg = TRUE;
break;
@@ -4117,7 +4117,7 @@ script. */
if (bi_option)
{
(void)fclose(config_file);
- if (bi_command)
+ if (bi_command && *bi_command)
{
int i = 0;
uschar *argv[3];
@@ -4128,11 +4128,11 @@ if (bi_option)
setgroups(group_count, group_list);
exim_setugid(real_uid, real_gid, FALSE, US"running bi_command");
- DEBUG(D_exec) debug_printf("exec %.256s %.256s\n", argv[0],
- argv[1] ? argv[1] : US"");
+ DEBUG(D_exec) debug_printf("exec '%.256s' %s%.256s%s\n", argv[0],
+ argv[1] ? "'" : "", argv[1] ? argv[1] : US"", argv[1] ? "'" : "");
execv(CS argv[0], (char *const *)argv);
- exim_fail("exim: exec failed: %s\n", strerror(errno));
+ exim_fail("exim: exec '%s' failed: %s\n", argv[0], strerror(errno));
}
else
{
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index b9cf540..09586c3 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -1824,9 +1824,12 @@ s_connhad_log(gstring * g)
const uschar * sep = smtp_connection_had[SMTP_HBUFF_SIZE-1] != SCH_NONE
? US" C=..." : US" C=";
-for (int i = smtp_ch_index; i < SMTP_HBUFF_SIZE; i++, sep = US",")
+for (int i = smtp_ch_index; i < SMTP_HBUFF_SIZE; i++)
if (smtp_connection_had[i] != SCH_NONE)
+ {
g = string_append(g, 2, sep, smtp_names[smtp_connection_had[i]]);
+ sep = US",";
+ }
for (int i = 0; i < smtp_ch_index; i++, sep = US",")
g = string_append(g, 2, sep, smtp_names[smtp_connection_had[i]]);
return g;
diff --git a/test/confs/0590 b/test/confs/0590
new file mode 100644
index 0000000..224d059
--- /dev/null
+++ b/test/confs/0590
@@ -0,0 +1,12 @@
+# Exim test configuration 0590
+
+OPT =
+
+.include DIR/aux-var/std_conf_prefix
+
+
+# ----- Main settings -----
+
+OPT
+
+# End
diff --git a/test/scripts/0000-Basic/0590 b/test/scripts/0000-Basic/0590
new file mode 100644
index 0000000..63fedab
--- /dev/null
+++ b/test/scripts/0000-Basic/0590
@@ -0,0 +1,6 @@
+# -bi / newaliases
+#
+exim -bi
+****
+exim -DOPT=bi_command=/bin/echo -bi -oA 'hello from -bi'
+****
diff --git a/test/stdout/0590 b/test/stdout/0590
new file mode 100644
index 0000000..6bd819d
--- /dev/null
+++ b/test/stdout/0590
@@ -0,0 +1 @@
+hello from -bi