Skip to content

Commit

Permalink
Cleanup (prevent repeated use of -p/-oMr to avoid mem leak)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeikoSchlittermann authored and Jeremy Harris committed Jun 13, 2017
1 parent 31323b3 commit 65e061b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
3 changes: 2 additions & 1 deletion doc/doc-docbook/spec.xfpt
Original file line number Diff line number Diff line change
Expand Up @@ -4274,7 +4274,7 @@ or &%-bs%& is used. For &%-bh%&, the protocol is forced to one of the standard
SMTP protocol names (see the description of &$received_protocol$& in section
&<<SECTexpvar>>&). For &%-bs%&, the protocol is always &"local-"& followed by
one of those same names. For &%-bS%& (batched SMTP) however, the protocol can
be set by &%-oMr%&.
be set by &%-oMr%&. Repeated use of this option is not supported.

.vitem &%-oMs%&&~<&'host&~name'&>
.oindex "&%-oMs%&"
Expand Down Expand Up @@ -4374,6 +4374,7 @@ host name and its colon can be omitted when only the protocol is to be set.
Note the Exim already has two private options, &%-pd%& and &%-ps%&, that refer
to embedded Perl. It is therefore impossible to set a protocol value of &`d`&
or &`s`& using this option (but that does not seem a real limitation).
Repeated use of this option is not supported.

.vitem &%-q%&
.oindex "&%-q%&"
Expand Down
19 changes: 17 additions & 2 deletions src/src/exim.c
Original file line number Diff line number Diff line change
Expand Up @@ -3106,7 +3106,14 @@ for (i = 1; i < argc; i++)

/* -oMr: Received protocol */

else if (Ustrcmp(argrest, "Mr") == 0) received_protocol = argv[++i];
else if (Ustrcmp(argrest, "Mr") == 0)

if (received_protocol)
{
fprintf(stderr, "received_protocol is set already\n");
exit(EXIT_FAILURE);
}
else received_protocol = argv[++i];

/* -oMs: Set sender host name */

Expand Down Expand Up @@ -3202,7 +3209,15 @@ for (i = 1; i < argc; i++)

if (*argrest != 0)
{
uschar *hn = Ustrchr(argrest, ':');
uschar *hn;

if (received_protocol)
{
fprintf(stderr, "received_protocol is set already\n");
exit(EXIT_FAILURE);
}

hn = Ustrchr(argrest, ':');
if (hn == NULL)
{
received_protocol = argrest;
Expand Down

0 comments on commit 65e061b

Please sign in to comment.