[ postfixadmin-Bugs-1750088 ] mailbox_remover.pl will remove all maildirs
Brought to you by:
christian_boltz,
gingerdog
From: SourceForge.net <no...@so...> - 2007-10-05 01:43:57
|
Bugs item #1750088, was opened at 2007-07-08 16:54 Message generated for change (Comment added) made by abatie You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=937964&aid=1750088&group_id=191583 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core Group: None Status: Closed Resolution: Fixed Priority: 5 Private: No Submitted By: rschetterer (rschetterer) Assigned to: Nobody/Anonymous (nobody) Summary: mailbox_remover.pl will remove all maildirs Initial Comment: mailbox_remover.pl will remove all maildirs and the directory above if a user creates a mailbox with name like *@example.com ( perhaps he has missunderstood the catch all mechanism in postfixadmin ) and after that he deletes that mail account from the database. mailbox_remover.pl will now remove . and .. starting from directory maildri path, so all mailboxes get deletet and all other subdir in the dir above heres is a small hack to fix it store maildir list to @directories opendir(DIRHANDLE, $maildir_path) || die "Cannot open dir $maildir_path: $!"; foreach $name (sort readdir(DIRHANDLE)) { push (@directories, $name) unless ($name eq '.' || $name eq '..'); } closedir(DIRHANDLE); # THIS IS STUPID: # eliminate "." and ".." from the maildir list # ($dot, $doubledot, @directories) = @directories; ---------------------------------------------------------------------- Comment By: Alan Batie (abatie) Date: 2007-10-04 18:43 Message: Logged In: YES user_id=629920 Originator: NO Thanks, I've made that change the linked file, in case people still use it, and I'll look into postdeletion. I see the attached file section, there's just no buttons or links I see to upload anything. I don't see anything for doing it in the raw html there either... ---------------------------------------------------------------------- Comment By: Christian Boltz (christian_boltz) Date: 2007-10-04 17:05 Message: Logged In: YES user_id=593261 Originator: NO @rschetterer: Thanks for your fix regarding "." and ".." Note: The file you attached contains a password. Please change it if you didn't do it already! @Alan: Thanks for solving the issue with subdir layouts and your other changes. I just commited your file to SVN, with a little change around line 119: print "Archiving $maildir\n"; # bad because it doesn't stop on failure: # system("$archcmd cvzf $archive $maildir"); @args = ($archcmd, "cvzf", $archive, $maildir); system(@args) == 0 or die "Creating archive for $maildir failed: $?" Regarding auto-cleanup after deleting a mailbox: You might want to use ADDITIONS/postfixadmin-mailbox-postdeletion.sh as $CONF['mailbox_postdeletion_script'] Oh, and attaching files here is possible - just scroll down... ---------------------------------------------------------------------- Comment By: Alan Batie (abatie) Date: 2007-07-12 15:15 Message: Logged In: YES user_id=629920 Originator: NO Ooops, forgot the archiving part, just updated to add archiving before removal. ---------------------------------------------------------------------- Comment By: Alan Batie (abatie) Date: 2007-07-12 14:45 Message: Logged In: YES user_id=629920 Originator: NO I've modified this to add support for domain subdir style layouts, and changed it so it logs to stdout and pauses before starting removal. If one wants, it could be run automatically just redirecting stdout to the desired logfile, but having to comment out a line, read a logfile and uncomment it seemed unwieldy... Also, rather than trying to interpret usernames and whether or not they included the domain, I just check the maildir entry directly. as I said, postfixadmin really needs to do this itself, but this will be a good occasional consistency checker. I don't see a way to attach a file, so here's a link to it: http://www.rdrop.com/files/mailbox_remover.pl ---------------------------------------------------------------------- Comment By: Alan Batie (abatie) Date: 2007-07-11 17:56 Message: Logged In: YES user_id=629920 Originator: NO Although a consistency checker like this is needed, postfixadmin itself should clean up after itself: whenever a mailbox is removed, whether individually or the entire domain, it should make a tarball of the mailbox in an archive directory and then remove the mailbox. Anything else is a security issue, because if you delete and recreate a mailbox, the old mail comes back, even though it could very well be a different person. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=937964&aid=1750088&group_id=191583 |