You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2004/08/26 18:19:26 UTC

[Bug 3731] New: umask isn't correctly reset in some situations

http://bugzilla.spamassassin.org/show_bug.cgi?id=3731

           Summary: umask isn't correctly reset in some situations
           Product: Spamassassin
           Version: SVN Trunk (Latest Devel Version)
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Libraries
        AssignedTo: dev@spamassassin.apache.org
        ReportedBy: felicity@kluge.net


This was originally commented on in ticket 3653, but since it wasn't the same issue it gets a new 
ticket...

------- Additional Comment  #8 From Kenneth Porter  2004-08-26 04:58 -------
FYI, I'm seeing umask get clobbered in rc1 under mimedefang-2.45-BETA-3. So far
I've narrowed it down inside of MD's spam_assassin_main() function. I'm
continuing to investigate....

------- Additional Comment  #9 From Kenneth Porter  2004-08-26 05:25 -------
The value of umask is changing from 027 to 077 in Mail::SpamAssassin::check().

Looking through the code it looks like Flock::safe_lock doesn't restore umask.

BayesStore::DBM.pm also has several places that set umask to 0 and then exit on
failure without restoring it, using a "do_something() or return 0;" idiom.

------- Additional Comment  #10 From Theo Van Dinter  2004-08-26 09:11 -------
Subject: Re:  umask gets overwriten in UnixLocker.pm

On Thu, Aug 26, 2004 at 05:25:38AM -0700, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> Looking through the code it looks like Flock::safe_lock doesn't restore umask.

Hrm.  Looking at the function, I would agree. :(

> BayesStore::DBM.pm also has several places that set umask to 0 and then exit on
> failure without restoring it, using a "do_something() or return 0;" idiom.

The only place in DBM that needs a change is in restore_database() before the
returns:

  my $umask = umask 0;
  unless (tie %new_toks, "DB_File", $tmptoksdbname, O_RDWR|O_CREAT|O_EXCL,
          (oct ($main->{conf}->{bayes_file_mode}) & 0666)) {
    dbg("bayes: Failed to tie temp toks db: $!");
    $self->untie_db();
    return 0;
  }
  unless (tie %new_seen, "DB_File", $tmpseendbname, O_RDWR|O_CREAT|O_EXCL,
          (oct ($main->{conf}->{bayes_file_mode}) & 0666)) {
    dbg("bayes: Failed to tie temp seen db: $!");
    untie %new_toks;
    unlink $tmptoksdbname;
    $self->untie_db();
    return 0;
  }
  umask $umask;

The rest of DBM is fine from what I can tell.

patch forthcoming. :(



------- Additional Comment  #11 From Theo Van Dinter  2004-08-26 09:12 -------
a few places need to fix the umask in 3.0... :(



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.