RE: mbox ownership
andre deblire <[email protected]>
| Newsgroups | gmane.comp.lang.perl.modules.mail-box |
|---|---|
| Message-ID | <20040412220457.716E580BB@Host1> |
> > As root, I process several unix mbox files which belong to non-root
> > users.
>
> Isn't it saver to process the mailbox of a user with the
> permissions of
> that user? That way, to also avoid the ownership problem.
>
> foreach my $user (@users)
> { unless(my $kid = fork)
> { $> = getpwnam $user;
> # process user's mailbox
> exit 0;
> }
>
> waitpid $kid;
> }
>
> [untested]
>
> There is a good case for restoring the owner and permissions on the
> moment that the mailbox replacement is accepted. However: how do we
> get this to work for all unix/linux versions AND windows?
>
I found a workaround not extensively tested, but it seems to work :
########
$Folder->write();
chown(...);
$Folder->close();
########
Do you see a problem with this ?
If there is one, I'll try the fork method.