Package: bsd-mailx / 8.1.2-0.20180807cvs-1

29-Document-two-dashes-separator.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Robert Luberda <robert@debian.org>
Date: Sun, 19 Apr 2015 09:29:44 +0200
Subject: 29 Document two dashes separator

Document that `--' marks end of options and should
be used  in scripts taking addresses from untrusted
sources (closes: #773317)
---
 mail.1 | 9 +++++++++
 main.c | 2 +-
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/mail.1 b/mail.1
index 738b215..5683e56 100644
--- a/mail.1
+++ b/mail.1
@@ -46,6 +46,7 @@
 .Op Fl c Ar cc-addr
 .Op Fl r Ar from-addr
 .Op Fl s Ar subject
+.Op Fl -
 .Ar to-addr ...
 .Ek
 .Nm mail
@@ -139,6 +140,14 @@ except that locking is done.
 Verbose mode.
 The details of
 delivery are displayed on the user's terminal.
+.It Fl -
+End of options. Any further argument is treated as a direct receipient address.
+.Pp
+.Em Note:
+For security reasons the
+.Fl -
+separator is strongly recommended for scripts that need to send mails
+to addresses obtained from untrusted sources (such as web forms).
 .El
 .Ss Startup actions
 At startup time,
diff --git a/main.c b/main.c
index 1379687..18ffe29 100644
--- a/main.c
+++ b/main.c
@@ -350,7 +350,7 @@ usage(void)
 {
 
 	fprintf(stderr, "usage: %s [-dEIinv] [-a header] [-b bcc-addr] [-c cc-addr] "
-	    "[-r from-addr] [-s subject] to-addr ...\n", __progname);
+	    "[-r from-addr] [-s subject] [--] to-addr ...\n", __progname);
 	fprintf(stderr, "       %s [-dEIiNnv] -f [name]\n", __progname);
 	fprintf(stderr, "       %s [-dEIiNnv] [-u user]\n", __progname);
 	exit(1);