Package: bsd-mailx / 8.1.2-0.20141216cvs-2

03-Base-fixes-2.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
From: Edward Betts <edward@debian.org>
Date: Sun, 28 Jan 2001 14:40:00 -0700
Subject: 03 Base fixes 2.

Fixes from  Debian patch 1:8.1.1-10.3
---
 cmd1.c   |  2 ++
 def.h    |  9 +++++++++
 extern.h |  2 +-
 mail.1   | 20 ++++++++++----------
 main.c   | 21 +++++++++++++++++----
 send.c   |  2 ++
 vars.c   |  9 +++++++--
 7 files changed, 48 insertions(+), 17 deletions(-)

diff --git a/cmd1.c b/cmd1.c
index bcc29f6..84186c5 100644
--- a/cmd1.c
+++ b/cmd1.c
@@ -340,6 +340,8 @@ type1(int *msgvec, char *cmd, int doign, int page)
 	char *cp;
 	FILE *obuf;
 
+	cp = NULL;
+
 	obuf = stdout;
 	restoreterm = 0;
 
diff --git a/def.h b/def.h
index 3772892..af2ecce 100644
--- a/def.h
+++ b/def.h
@@ -72,6 +72,10 @@
 
 #define	equal(a, b)	(strcmp(a,b)==0)/* A nice function to string compare */
 
+#ifndef NOFILE
+#define NOFILE 256
+#endif
+
 struct message {
 	short	m_flag;			/* flags, see below */
 	int	m_offset;		/* offset in block of message */
@@ -264,4 +268,9 @@ struct ignoretab {
 	(void)ftruncate(fileno(stream), (off_t)ftell(stream));		\
 } while(0)
 
+
+
+#ifndef UID_MAX
+#define UID_MAX -1
+#endif
 #endif /* MAIL_DEF_H */
diff --git a/extern.h b/extern.h
index 5255f65..714f48c 100644
--- a/extern.h
+++ b/extern.h
@@ -234,7 +234,7 @@ int	 spool_unlock(void);
 void	 spreserve(void);
 void	 sreset(void);
 pid_t	 start_command(char *cmd, sigset_t *nset, int infd, int outfd, ...);
-pid_t	 start_commandv(char *, sigset_t *, int, int, __va_list);
+pid_t	 start_commandv(char *, sigset_t *, int, int, va_list);
 int	 statusput(struct message *, FILE *, char *);
 void	 stop(int);
 int	 stouch(void *);
diff --git a/mail.1 b/mail.1
index 850408a..ebb7f90 100644
--- a/mail.1
+++ b/mail.1
@@ -41,8 +41,8 @@
 .Nm mail
 .Bk -words
 .Op Fl dEIinv
-.Op Fl b Ar list
-.Op Fl c Ar list
+.Op Fl b Ar bcc-addr
+.Op Fl c Ar cc-addr
 .Op Fl s Ar subject
 .Ar to-addr ...
 .Ek
@@ -62,14 +62,14 @@ with lines replaced by messages.
 .Pp
 The options are as follows:
 .Bl -tag -width Ds
-.It Fl b Ar list
+.It Fl b Ar bcc-addr
 Send blind carbon copies to
-.Ar list .
-.It Fl c Ar list
+.Ar bcc-addr .
+.It Fl c Ar cc-addr
 Send carbon copies to
-.Ar list
+list
 of users.
-.Ar list
+.Ar cc-addr
 should be a comma separated list of names.
 .It Fl d
 Causes
@@ -1209,7 +1209,7 @@ system initialization file
 .Ex -std mail
 .Sh SEE ALSO
 .Xr fmt 1 ,
-.Xr lockspool 1 ,
+.Xr newaliases 1 ,
 .Xr vacation 1 ,
 .Xr aliases 5 ,
 .Xr mailaddr 7 ,
@@ -1251,9 +1251,9 @@ This man page is derived from the
 originally written by Kurt Shoens.
 .Sh BUGS
 Usually,
-.Nm mail
+.Nm Mail
 and
 .Nm mailx
 are just links to
-.Nm Mail ,
+.Nm mail ,
 which can be confusing.
diff --git a/main.c b/main.c
index 04d0dca..cdfa7c5 100644
--- a/main.c
+++ b/main.c
@@ -35,7 +35,7 @@
 #include <sys/ioctl.h>
 #include "extern.h"
 
-__dead	void	usage(void);
+static void	usage(void);
 	int	main(int, char **);
 
 /*
@@ -55,6 +55,17 @@ main(int argc, char **argv)
 	char *rc;
 	extern const char version[];
 
+        /*
+	 * drop any sgid/suid privileges
+         */
+        if (setgid (getgid()) < 0) {
+          err(1, "setgid");
+	}
+
+	if (setuid (getuid()) < 0) {
+          err(1, "setuid");
+	}
+
 	/*
 	 * Set up a reasonable environment.
 	 * Figure out whether we are being run interactively,
@@ -84,8 +95,10 @@ main(int argc, char **argv)
 			/*
 			 * Next argument is person to pretend to be.
 			 */
+#ifndef DEBIAN
 			if (strlen(optarg) >= MAXLOGNAME)
 				errx(1, "username `%s' too long", optarg);
+#endif
 			unsetenv("MAIL");
 			myname = optarg;
 			uflag = 1;
@@ -267,13 +280,13 @@ setscreensize(void)
 		screenwidth = 80;
 }
 
-__dead void
+static void
 usage(void)
 {
 
-	fprintf(stderr, "usage: %s [-dEIinv] [-b list] [-c list] "
+	fprintf(stderr, "usage: %s [-dEIinv] [-b bcc-addr] [-c cc-addr] "
 	    "[-s subject] to-addr ...\n", __progname);
-	fprintf(stderr, "       %s [-dEIiNnv] -f [file]\n", __progname);
+	fprintf(stderr, "       %s [-dEIiNnv] -f [name]\n", __progname);
 	fprintf(stderr, "       %s [-dEIiNnv] [-u user]\n", __progname);
 	exit(1);
 }
diff --git a/send.c b/send.c
index 77056f4..e8084fd 100644
--- a/send.c
+++ b/send.c
@@ -506,8 +506,10 @@ puthead(struct header *hp, FILE *fo, int w)
 		fprintf(fo, "Subject: %s\n", hp->h_subject), gotcha++;
 	if (hp->h_cc != NULL && w & GCC)
 		fmt("Cc:", hp->h_cc, fo, w&GCOMMA), gotcha++;
+/* Should not put bcc into mails (Closes: Bug#75232)
 	if (hp->h_bcc != NULL && w & GBCC)
 		fmt("Bcc:", hp->h_bcc, fo, w&GCOMMA), gotcha++;
+*/
 	if (gotcha && w & GNL)
 		(void)putc('\n', fo);
 	return(0);
diff --git a/vars.c b/vars.c
index 7f2fe5d..5ded8cf 100644
--- a/vars.c
+++ b/vars.c
@@ -100,19 +100,24 @@ char *
 value(char *name)
 {
 	struct var *vp;
+#ifndef DEBIAN
 	char *env;
+#endif
 
 	if ((vp = lookup(name)) != NULL)
 		return(vp->v_value);
+#ifndef DEBIAN /* do not trust environment */
+
 	else if ((env = getenv(name)))
 		return(env);
+#endif
 	/* not set, see if we can provide a default */
 	else if (strcmp(name, "SHELL") == 0)
-		return(_PATH_CSHELL);
+		return(_PATH_SHELL);
 	else if (strcmp(name, "LISTER") == 0)
 		return(_PATH_LS);
 	else if (strcmp(name, "PAGER") == 0)
-		return(_PATH_MORE);
+		return(_PATH_PAGER);
 	else
 		return(NULL);
 }