SA Bugzilla – Bug 3283
broken handling of umask
Last modified: 2004-04-19 12:33:15 UTC
There are a number of places umask is used incorectly, or not set back properly. Here's two places I found: Index: lib/Mail/SpamAssassin/Locker/Unix.pm =================================================================== --- lib/Mail/SpamAssassin/Locker/Unix.pm (revision 10111) +++ lib/Mail/SpamAssassin/Locker/Unix.pm (working copy) @@ -60,7 +60,7 @@ my $lock_tmp = Mail::SpamAssassin::Util::untaint_file_path ("$path.lock.$hname.$$"); - my $umask = 077; + my $umask = umask 077; if (!open(LTMP, ">$lock_tmp")) { umask $umask; die "lock: $$ cannot create tmp lockfile $lock_tmp for $lock_file: $!\n"; and: Index: lib/Mail/SpamAssassin/Util.pm =================================================================== --- lib/Mail/SpamAssassin/Util.pm (revision 10111) +++ lib/Mail/SpamAssassin/Util.pm (working copy) @@ -677,7 +677,6 @@ } my $reportfile; - my $umask = 0; do { # we do not rely on the obscurity of this name for security... # we use a average-quality PRG since this is all we need @@ -700,7 +699,6 @@ # ...rather, we require O_EXCL|O_CREAT to guarantee us proper # ownership of our file; read the open(2) man page. } while (! sysopen (TMPFILE, $reportfile, O_RDWR|O_CREAT|O_EXCL, 0600)); - umask $umask; return ($reportfile, \*TMPFILE); } Version 2.63 also has several places that set umask to 0, but never set it back (which results in leaving permissions wide open on an app that uses spamassassin).
hrm. what's up with that? :(
should be all fixed now. r10112.
According to: http://svn.apache.org/viewcvs.cgi/incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm?r1=9610&r2=10112&p1=incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm&p2=incubator/spamassassin/trunk/lib/Mail/SpamAssassin/Util.pm&root=Apache-SVN you are not resetting the umask back, and will leave the program in a different umask.
Subject: Re: broken handling of umask On Mon, Apr 19, 2004 at 08:13:22PM -0700, bugzilla-daemon@bugzilla.spamassassin.org wrote: > you are not resetting the umask back, and will leave the program in a different > umask. Well, if you look at the bottom of the function, before the return, you'll see: umask $umask; which resets the umask to the original version. So what am I missing?
Sorry, svn up gave me a strange conflict, it looked like the bottom wasn't there.