From 65e061b76867a9ea7aeeb535341b790b90ae6c21 Mon Sep 17 00:00:00 2001
From: "Heiko Schlittermann (HS12-RIPE)" <hs@schlittermann.de>
Date: Wed, 31 May 2017 23:08:56 +0200
Subject: [PATCH] Cleanup (prevent repeated use of -p/-oMr to avoid mem leak)
---
doc/doc-docbook/spec.xfpt | 3 ++-
src/src/exim.c | 19 +++++++++++++++++--
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt
index 06373ccd..7816bc26 100644
a
|
b
|
or &%-bs%& is used. For &%-bh%&, the protocol is forced to one of the standard
|
4274 | 4274 | SMTP protocol names (see the description of &$received_protocol$& in section |
4275 | 4275 | &<<SECTexpvar>>&). For &%-bs%&, the protocol is always &"local-"& followed by |
4276 | 4276 | one of those same names. For &%-bS%& (batched SMTP) however, the protocol can |
4277 | | be set by &%-oMr%&. |
| 4277 | be set by &%-oMr%&. Repeated use of this option is not supported. |
4278 | 4278 | |
4279 | 4279 | .vitem &%-oMs%&&~<&'host&~name'&> |
4280 | 4280 | .oindex "&%-oMs%&" |
… |
… |
host name and its colon can be omitted when only the protocol is to be set.
|
4374 | 4374 | Note the Exim already has two private options, &%-pd%& and &%-ps%&, that refer |
4375 | 4375 | to embedded Perl. It is therefore impossible to set a protocol value of &`d`& |
4376 | 4376 | or &`s`& using this option (but that does not seem a real limitation). |
| 4377 | Repeated use of this option is not supported. |
4377 | 4378 | |
4378 | 4379 | .vitem &%-q%& |
4379 | 4380 | .oindex "&%-q%&" |
diff --git a/src/src/exim.c b/src/src/exim.c
index 67583e58..88e11977 100644
a
|
b
|
for (i = 1; i < argc; i++)
|
3106 | 3106 | |
3107 | 3107 | /* -oMr: Received protocol */ |
3108 | 3108 | |
3109 | | else if (Ustrcmp(argrest, "Mr") == 0) received_protocol = argv[++i]; |
| 3109 | else if (Ustrcmp(argrest, "Mr") == 0) |
| 3110 | |
| 3111 | if (received_protocol) |
| 3112 | { |
| 3113 | fprintf(stderr, "received_protocol is set already\n"); |
| 3114 | exit(EXIT_FAILURE); |
| 3115 | } |
| 3116 | else received_protocol = argv[++i]; |
3110 | 3117 | |
3111 | 3118 | /* -oMs: Set sender host name */ |
3112 | 3119 | |
… |
… |
for (i = 1; i < argc; i++)
|
3202 | 3209 | |
3203 | 3210 | if (*argrest != 0) |
3204 | 3211 | { |
3205 | | uschar *hn = Ustrchr(argrest, ':'); |
| 3212 | uschar *hn; |
| 3213 | |
| 3214 | if (received_protocol) |
| 3215 | { |
| 3216 | fprintf(stderr, "received_protocol is set already\n"); |
| 3217 | exit(EXIT_FAILURE); |
| 3218 | } |
| 3219 | |
| 3220 | hn = Ustrchr(argrest, ':'); |
3206 | 3221 | if (hn == NULL) |
3207 | 3222 | { |
3208 | 3223 | received_protocol = argrest; |