From a35ced5ed7aa569727e80c54cd49c4b0c19e7105 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Sat, 8 Mar 2014 19:12:14 -0700 Subject: [PATCH] Fix umask default on crash report generated email --- src/tools.cc | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tools.cc b/src/tools.cc index f235b9f89d..fecdb400b0 100644 --- a/src/tools.cc +++ b/src/tools.cc @@ -128,7 +128,14 @@ mail_warranty(void) FILE *fp = NULL; static char command[256]; - const mode_t prev_umask=umask(S_IRWXU); + /* + * NP: umask() takes the mask of bits we DONT want set. + * + * We want the current user to have read/write access + * and since this file will be passed to mailsystem, + * the group and other must have read access. + */ + const mode_t prev_umask=umask(S_IXUSR|S_IXGRP|S_IWGRP|S_IWOTH|S_IXOTH); #if HAVE_MKSTEMP char filename[] = "/tmp/squid-XXXXXX"; -- 2.47.2