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
|
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 +++++++++++++++++----
vars.c | 9 +++++++--
6 files changed, 46 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 7271258..ea9ae2d 100644
--- a/def.h
+++ b/def.h
@@ -71,6 +71,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 61f022b..cbea007 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 fa40f46..a4aa9a0 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 r Ar from-addr
.Op Fl s Ar subject
.Ar to-addr ...
@@ -63,14 +63,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
@@ -1221,7 +1221,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 mail.local 8 ,
@@ -1262,9 +1262,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 2307d85..9a68d0d 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 **);
/*
@@ -60,6 +60,17 @@ main(int argc, char **argv)
NULL) == -1)
err(1, "pledge");
+ /*
+ * 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,
@@ -90,8 +101,10 @@ main(int argc, char **argv)
/*
* Next argument is person to pretend to be.
*/
+#ifndef DEBIAN
if (strlen(optarg) >= LOGIN_NAME_MAX)
errx(1, "username `%s' too long", optarg);
+#endif
unsetenv("MAIL");
myname = optarg;
uflag = 1;
@@ -281,13 +294,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] "
"[-r from-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/vars.c b/vars.c
index 2830d90..47ea353 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);
}
|