summaryrefslogtreecommitdiff
path: root/usr.bin/mail/send.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2007-03-20 21:01:09 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2007-03-20 21:01:09 +0000
commit771af2de94f62953b1534e0e23fa50222a910775 (patch)
tree7254f80eec5dd7998577312a0303d2dc43b819bb /usr.bin/mail/send.c
parentedb06578c73fe05fb3c9ab52a47e1d0a34eca656 (diff)
Set umask to 077 when saving messages in the outbox (not enabled
by default). From veenhuizen at users dot sourceforge dot net
Diffstat (limited to 'usr.bin/mail/send.c')
-rw-r--r--usr.bin/mail/send.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/mail/send.c b/usr.bin/mail/send.c
index 6bb9180015a..eaaa66ee82a 100644
--- a/usr.bin/mail/send.c
+++ b/usr.bin/mail/send.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: send.c,v 1.17 2003/06/03 02:56:11 millert Exp $ */
+/* $OpenBSD: send.c,v 1.18 2007/03/20 21:01:08 millert Exp $ */
/* $NetBSD: send.c,v 1.6 1996/06/08 19:48:39 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static const char sccsid[] = "@(#)send.c 8.1 (Berkeley) 6/6/93";
#else
-static const char rcsid[] = "$OpenBSD: send.c,v 1.17 2003/06/03 02:56:11 millert Exp $";
+static const char rcsid[] = "$OpenBSD: send.c,v 1.18 2007/03/20 21:01:08 millert Exp $";
#endif
#endif /* not lint */
@@ -558,8 +558,12 @@ savemail(char *name, FILE *fi)
FILE *fo;
char buf[BUFSIZ];
time_t now;
+ mode_t m;
- if ((fo = Fopen(name, "a")) == NULL) {
+ m = umask(077);
+ fo = Fopen(name, "a");
+ (void)umask(m);
+ if (fo == NULL) {
warn("%s", name);
return(-1);
}