Gitweb:
https://git.exim.org/exim.git/commitdiff/305e4faec28e5e0eb990009f720aef91c1ecba92
Commit: 305e4faec28e5e0eb990009f720aef91c1ecba92
Parent: 4bcc0ff50b9dd7fceded6164b554861dab8ea751
Author: Heiko Schlittermann (HS12-RIPE) <hs@???>
AuthorDate: Sun Mar 8 16:00:28 2020 +0000
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Sun Mar 8 16:00:28 2020 +0000
Fix parsing of cmdline -os & -pr options. Bug 2538
Found & fixed by Heiko; coding massaged by jgh
Broken-by: 777cc7485c
---
src/src/exim.c | 32 ++++++++++++++------------------
src/src/receive.c | 5 +++++
2 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/src/src/exim.c b/src/src/exim.c
index dfd6df7..63ac620 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -3138,8 +3138,7 @@ for (i = 1; i < argc; i++)
case 'm':
case 'o':
- if (!*argrest) {}
- else badarg = TRUE;
+ if (*argrest) badarg = TRUE;
break;
/* -oP <name>: set pid file path for daemon
@@ -3157,27 +3156,24 @@ for (i = 1; i < argc; i++)
case 'r':
case 's':
- if (!*argrest)
- {
- int *tp = (*argrest == 'r')?
- &arg_receive_timeout : &arg_smtp_receive_timeout;
- if (argrest[1] == 0)
- {
- if (i+1 < argc) *tp= readconf_readtime(argv[++i], 0, FALSE);
- }
- else *tp = readconf_readtime(argrest + 1, 0, FALSE);
- if (*tp < 0)
- exim_fail("exim: bad time value %s: abandoned\n", argv[i]);
- }
- else badarg = TRUE;
+ {
+ int * tp = argrest[-1] == 'r'
+ ? &arg_receive_timeout : &arg_smtp_receive_timeout;
+ if (*argrest)
+ *tp = readconf_readtime(argrest, 0, FALSE);
+ else if (i+1 < argc)
+ *tp = readconf_readtime(argv[++i], 0, FALSE);
+
+ if (*tp < 0)
+ exim_fail("exim: bad time value %s: abandoned\n", argv[i]);
+ }
break;
/* -oX <list>: Override local_interfaces and/or default daemon ports */
case 'X':
- if (!*argrest)
- override_local_interfaces = argv[++i];
- else badarg = TRUE;
+ if (*argrest) badarg = TRUE;
+ else override_local_interfaces = argv[++i];
break;
/* Unknown -o argument */
diff --git a/src/src/receive.c b/src/src/receive.c
index 6d20a5c..8f3bfef 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -645,6 +645,11 @@ if (!f.dot_ends)
{
int last_ch = '\n';
+/*XXX we do a gettimeofday before checking for every received char,
+which is hardly clever. The function-indirection doesn't help, but
+an additional function to check for nonempty read buffer would help.
+See stdin_getc() / smtp_getc() / tls_getc() / bdat_getc(). */
+
for ( ;
log_close_chk(), (ch = (receive_getc)(GETC_BUFFER_UNLIMITED)) != EOF;
last_ch = ch)