--- a/exim-exigrey.pl Tue Jan 02 21:36:31 2007 +0000
+++ b/exim-exigrey.pl Tue Jan 02 21:46:52 2007 +0000
@@ -104,9 +104,13 @@
# this file
if (!-f $db) {
(my $dir = $db) =~ s/^(.*)\/.*?$/$1/;
- local ($>, $)) = (stat $dir)[4,5] or die "Can't stat $dir: $!";
+ # copy mode, uid, gid from the directory
+ my ($mode, $user, $group) = (stat $dir)[2,4,5] or die "Can't stat $dir: $!";
+ my $umask = umask(($mode & 0777) ^ 0777);
+ local ($>, $)) = ($user, $group);
open(X, ">>$db") or die "Can't create $db: $!";
close(X);
+ umask $umask;
}
# now test which of the DB-Modules has been loaded