From: Heiko Schlittermann (HS12-RIPE) Date: Sun, 8 Mar 2020 16:00:28 +0000 (+0000) Subject: Fix parsing of cmdline -os & -pr options. Bug 2538 X-Git-Tag: exim-4_94_RC0~73 X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=305e4faec2;p=exim.git Fix parsing of cmdline -os & -pr options. Bug 2538 Found & fixed by Heiko; coding massaged by jgh Broken-by: 777cc7485c --- diff --git a/src/src/exim.c b/src/src/exim.c index dfd6df76c..63ac620e7 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 : 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 : 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 6d20a5cda..8f3bfefac 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)