From: <mn...@us...> - 2007-12-13 17:05:44
|
Revision: 31 http://panda-admin.svn.sourceforge.net/panda-admin/?rev=31&view=rev Author: mnencia Date: 2007-12-13 09:05:41 -0800 (Thu, 13 Dec 2007) Log Message: ----------- If a maildir isn't in the correct positione try to correct the mistake before to delete it. Modified Paths: -------------- trunk/setup/bin/vmaild Modified: trunk/setup/bin/vmaild =================================================================== --- trunk/setup/bin/vmaild 2007-12-13 16:21:14 UTC (rev 30) +++ trunk/setup/bin/vmaild 2007-12-13 17:05:41 UTC (rev 31) @@ -411,15 +411,33 @@ foreach my $maildir (@maildirs) { my $user = $maildir; $user =~ s%^.*/([^/]+)/?$%$1%; - if ( !$users{$user} - || "$domaindir/$users{$user}->{maildir}" ne $maildir ) { + if ( $users{$user} ) { + $users{$user}->{found} = 1; + $users{$user}->{sieveok} = check_sieve($maildir); + my $dbmaildir = "$domaindir/$users{$user}->{maildir}"; + $dbmaildir =~ s%/$%%; + if ($dbmaildir ne $maildir ) { + if ( -d $dbmaildir) { + logmsg( 'notice', "duplicate home found for user: $user\@$domain" ); + my $deldate = POSIX::strftime( "%F-%H%M%S", gmtime ); + sys_or_log("mv $maildir $deldir/${domain}_${user}_$deldate") + or $ok = 0; + } + else { + logmsg( 'notice', "incongruence in home location found for user: $user\@$domain" ); + if (sys_or_log("mv $maildir $dbmaildir")) { + my $deldate = POSIX::strftime( "%F-%H%M%S", gmtime ); + sys_or_log("mv $maildir $deldir/${domain}_${user}_$deldate") + or $ok = 0; + } + } + } + } + else { logmsg( 'notice', "invalid or deleted user: $user\@$domain " ); my $deldate = POSIX::strftime( "%F-%H%M%S", gmtime ); sys_or_log("mv $maildir $deldir/${domain}_${user}_$deldate") or $ok = 0; - } else { - $users{$user}->{found} = 1; - $users{$user}->{sieveok} = check_sieve($maildir); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |