From 1d6b1c8c4872524fa94cb9e9b1acd6be8e27005c Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:44:14 +0000 Subject: [PATCH] 1.127 --- CREDITS | 8 +++++ ChangeLog | 13 ++++++-- README | 4 +-- VERSION | 2 +- imapsync | 50 +++++++++++++++++-------------- patches/imapsync-pb-acl.diff | 58 ++++++++++++++++++++++++++++++++++++ tests.sh | 20 ++++++++----- 7 files changed, 119 insertions(+), 36 deletions(-) create mode 100644 patches/imapsync-pb-acl.diff diff --git a/CREDITS b/CREDITS index 9a74e7a..3e2f55a 100644 --- a/CREDITS +++ b/CREDITS @@ -1,5 +1,13 @@ #!/bin/cat +Scott Glenn +Found the bug about --regexmess applied only on the first +message. + +Dag-Erling Smørgrav +Found a bug about acls sync. +Gave a patch that broke my acls... + Brian Cunnie Write good French and a patch to allow password input on command line diff --git a/ChangeLog b/ChangeLog index db85198..ed607bf 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,24 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.125 +head: 1.127 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 125; selected revisions: 125 +total revisions: 127; selected revisions: 127 description: ---------------------------- +revision 1.127 +date: 2005/05/09 04:14:48; author: gilles; state: Exp; lines: +6 -7 +Fixed bug about @regexmess who was applied for the first +message only. Thanks to Scott Glenn. +---------------------------- +revision 1.126 +date: 2005/05/09 04:04:20; author: gilles; state: Exp; lines: +26 -21 +Applied patch from Dag-Erling Smørgrav about acl sync pb +---------------------------- revision 1.125 date: 2005/04/22 01:12:18; author: gilles; state: Exp; lines: +23 -9 Allow password input on command line diff --git a/README b/README index 269e3f7..c0df328 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ NAME imapsync - IMAP synchronization, copy or migration tool. Synchronize mailboxes between two imap servers. Good at IMAP migration. - $Revision: 1.125 $ + $Revision: 1.127 $ INSTALL imapsync works fine under any Unix OS. @@ -246,5 +246,5 @@ AUTHOR teaching free open and gratis softwares. Don't hesitate to pay him for that services. - $Id: imapsync,v 1.125 2005/04/22 01:12:18 gilles Exp $ + $Id: imapsync,v 1.127 2005/05/09 04:14:48 gilles Exp $ diff --git a/VERSION b/VERSION index 2fbe148..8332445 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.125 +1.127 diff --git a/imapsync b/imapsync index 768f8a8..c442ccd 100755 --- a/imapsync +++ b/imapsync @@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration tool. Synchronize mailboxes between two imap servers. Good at IMAP migration. -$Revision: 1.125 $ +$Revision: 1.127 $ =head1 INSTALL @@ -288,7 +288,7 @@ Gilles LAMIRAL earn his living writing, installing, configuring and teaching free open and gratis softwares. Don't hesitate to pay him for that services. -$Id: imapsync,v 1.125 2005/04/22 01:12:18 gilles Exp $ +$Id: imapsync,v 1.127 2005/05/09 04:14:48 gilles Exp $ =cut @@ -332,7 +332,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.125 2005/04/22 01:12:18 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.127 2005/05/09 04:14:48 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -369,8 +369,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.125 $ ', - '$Date: 2005/04/22 01:12:18 $ ', + '$Revision: 1.127 $ ', + '$Date: 2005/05/09 04:14:48 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient, " auth md5 : $md5_supported", @@ -580,7 +580,7 @@ if ($foldersizes) { foreach my $f_fold (@f_folders) { my $stot = 0; my $smess = 0; - printf("From Folder %-25s", "[$f_fold]"); + printf("From Folder %-35s", "[$f_fold]"); unless ($from->select($f_fold)) { warn "From Folder $f_fold : Could not select ", @@ -693,7 +693,26 @@ FOLDER: foreach my $f_fold (@f_folders) { next FOLDER; } } - + + if ($syncacls) { + my $f_hash = $from->getacl($f_fold) + or warn "Could not getacl for $f_fold: $@\n"; + my $t_hash = $to->getacl($t_fold) + or warn "Could not getacl for $t_fold: $@\n"; + my %users = map({ ($_, 1) } (keys(%$f_hash), keys(%$t_hash))); + foreach my $user (sort(keys(%users))) { + my $acl = $f_hash->{$user} || "none"; + print "acl $user : [$acl]\n"; + next if ($f_hash->{$user} && $t_hash->{$user} && + $f_hash->{$user} eq $t_hash->{$user}); + unless ($dry) { + print "setting acl $t_fold $user $acl\n"; + $to->setacl($t_fold, $user, $acl) + or warn "Could not set acl: $@\n"; + } + } + } + unless ($to->select($t_fold)) { warn "To Folder $t_fold : Could not select ", @@ -713,20 +732,6 @@ FOLDER: foreach my $f_fold (@f_folders) { unless($dry) { $to->subscribe($t_fold) }; } - if ($syncacls) { - my $hash = $from->getacl($f_fold) - or warn "Could not getacl for $f_fold: $@\n"; - foreach my $user (keys(%$hash)) { - my $acl = $hash->{$user}; - print "acl $user : " . $acl . "\n"; - unless ($dry) { - print "setting acl $t_fold $user $acl\n"; - $to->setacl($t_fold, $user, $acl) - or warn "Could not set acl: $@\n"; - } - } - } - next FOLDER if ($justfolders); my @f_msgs = $maxage ? $from->since(time - 86400 * $maxage) : $from->search("ALL"); @@ -806,10 +811,9 @@ FOLDER: foreach my $f_fold (@f_folders) { # copy print "+ Copying msg #$f_msg:$f_size to folder $t_fold\n"; my $string = $from->message_string($f_msg); - while (my $regexmess = shift(@regexmess)) { + foreach my $regexmess (@regexmess) { $debug and print "eval \$string =~ $regexmess\n"; eval("\$string =~ $regexmess"); - } $debug and print "F message content begin next line\n", $string, diff --git a/patches/imapsync-pb-acl.diff b/patches/imapsync-pb-acl.diff new file mode 100644 index 0000000..a28b752 --- /dev/null +++ b/patches/imapsync-pb-acl.diff @@ -0,0 +1,58 @@ +--- imapsync.orig Fri Apr 22 03:12:18 2005 ++++ imapsync Mon May 2 11:16:51 2005 +@@ -580,7 +580,7 @@ + foreach my $f_fold (@f_folders) { + my $stot = 0; + my $smess = 0; +- printf("From Folder %-25s", "[$f_fold]"); ++ printf("From Folder %-35s", "[$f_fold]"); + unless ($from->select($f_fold)) { + warn + "From Folder $f_fold : Could not select ", +@@ -694,6 +694,25 @@ + } + } + ++ if ($syncacls) { ++ my $f_hash = $from->getacl($f_fold) ++ or warn "Could not getacl for $f_fold: $@\n"; ++ my $t_hash = $to->getacl($t_fold) ++ or warn "Could not getacl for $t_fold: $@\n"; ++ my %users = map({ ($_, 1) } (keys(%$f_hash), keys(%$t_hash))); ++ foreach my $user (sort(keys(%users))) { ++ my $acl = $f_hash->{$user} || "none"; ++ print "acl $user : [$acl]\n"; ++ next if ($f_hash->{$user} && $t_hash->{$user} && ++ $f_hash->{$user} eq $t_hash->{$user}); ++ unless ($dry) { ++ print "setting acl $t_fold $user $acl\n"; ++ $to->setacl($t_fold, $user, $acl) ++ or warn "Could not set acl: $@\n"; ++ } ++ } ++ } ++ + unless ($to->select($t_fold)) { + warn + "To Folder $t_fold : Could not select ", +@@ -711,20 +730,6 @@ + if ($subscribe and exists $fs_folders{$f_fold}) { + print "Subscribing to folder $t_fold on destination server\n"; + unless($dry) { $to->subscribe($t_fold) }; +- } +- +- if ($syncacls) { +- my $hash = $from->getacl($f_fold) +- or warn "Could not getacl for $f_fold: $@\n"; +- foreach my $user (keys(%$hash)) { +- my $acl = $hash->{$user}; +- print "acl $user : " . $acl . "\n"; +- unless ($dry) { +- print "setting acl $t_fold $user $acl\n"; +- $to->setacl($t_fold, $user, $acl) +- or warn "Could not set acl: $@\n"; +- } +- } + } + + next FOLDER if ($justfolders); diff --git a/tests.sh b/tests.sh index aea17d1..fb21ae8 100644 --- a/tests.sh +++ b/tests.sh @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: tests.sh,v 1.35 2005/01/17 14:47:49 gilles Exp $ +# $Id: tests.sh,v 1.36 2005/05/09 04:22:44 gilles Exp $ #### Shell pragmas @@ -108,7 +108,8 @@ plumeloul() { --host1 plume --user1 tata@est.belle \ --passfile1 /var/tmp/secret.tata \ --host2 loul --user2 tata \ - --passfile2 /var/tmp/secret.tata + --passfile2 /var/tmp/secret.tata \ + --nosyncacls else : fi @@ -122,7 +123,8 @@ lp_folder() { --passfile2 /var/tmp/secret.tata \ --folder INBOX.yop --folder INBOX.Trash \ --host1 loul --user1 tata \ - --passfile1 /var/tmp/secret.tata + --passfile1 /var/tmp/secret.tata \ + --nosyncacls else : fi @@ -137,7 +139,8 @@ lp_justfolders() { --folder INBOX.yop --folder INBOX.Trash \ --host1 loul --user1 tata \ --passfile1 /var/tmp/secret.tata \ - --justfolders + --justfolders \ + --nosyncacls else : fi @@ -153,7 +156,8 @@ pl_folder_qqq() { --folder INBOX.qqq \ --prefix2 "" \ --host2 loul --user2 tata \ - --passfile2 /var/tmp/secret.tata + --passfile2 /var/tmp/secret.tata \ + --nosyncacls else : fi @@ -186,7 +190,8 @@ pl_folder() { --passfile1 /var/tmp/secret.tata \ --folder INBOX.yop \ --host2 loul --user2 tata \ - --passfile2 /var/tmp/secret.tata + --passfile2 /var/tmp/secret.tata \ + --nosyncacls else : fi @@ -552,8 +557,7 @@ essnet_plume2() --passfile2 /var/tmp/secret.tata \ --nosyncacls \ --noauthmd5 --sep1 / --foldersizes \ - --prefix2 INBOX. --regextrans2 's€INBOX.INBOX€INBOX€' \ - --nosyncacls + --prefix2 INBOX. --regextrans2 's€INBOX.INBOX€INBOX€' } regexmess()