This commit is contained in:
Nick Bebout 2011-03-12 02:44:14 +00:00
parent 252d8c82b7
commit 1d6b1c8c48
7 changed files with 119 additions and 36 deletions

View file

@ -1,5 +1,13 @@
#!/bin/cat #!/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 Brian Cunnie
Write good French and a patch Write good French and a patch
to allow password input on command line to allow password input on command line

View file

@ -1,15 +1,24 @@
RCS file: RCS/imapsync,v RCS file: RCS/imapsync,v
Working file: imapsync Working file: imapsync
head: 1.125 head: 1.127
branch: branch:
locks: strict locks: strict
access list: access list:
symbolic names: symbolic names:
keyword substitution: kv keyword substitution: kv
total revisions: 125; selected revisions: 125 total revisions: 127; selected revisions: 127
description: 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 revision 1.125
date: 2005/04/22 01:12:18; author: gilles; state: Exp; lines: +23 -9 date: 2005/04/22 01:12:18; author: gilles; state: Exp; lines: +23 -9
Allow password input on command line Allow password input on command line

4
README
View file

@ -2,7 +2,7 @@ NAME
imapsync - IMAP synchronization, copy or migration tool. Synchronize imapsync - IMAP synchronization, copy or migration tool. Synchronize
mailboxes between two imap servers. Good at IMAP migration. mailboxes between two imap servers. Good at IMAP migration.
$Revision: 1.125 $ $Revision: 1.127 $
INSTALL INSTALL
imapsync works fine under any Unix OS. 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 teaching free open and gratis softwares. Don't hesitate to pay him for
that services. 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 $

View file

@ -1 +1 @@
1.125 1.127

View file

@ -6,7 +6,7 @@ imapsync - IMAP synchronization, copy or migration
tool. Synchronize mailboxes between two imap servers. Good tool. Synchronize mailboxes between two imap servers. Good
at IMAP migration. at IMAP migration.
$Revision: 1.125 $ $Revision: 1.127 $
=head1 INSTALL =head1 INSTALL
@ -288,7 +288,7 @@ Gilles LAMIRAL earn his living writing, installing,
configuring and teaching free open and gratis configuring and teaching free open and gratis
softwares. Don't hesitate to pay him for that services. 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 =cut
@ -332,7 +332,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option. 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+)/; $rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN"; $VERSION = ($1) ? $1 : "UNKNOWN";
@ -369,8 +369,8 @@ $error=0;
my $banner = join("", my $banner = join("",
'$RCSfile: imapsync,v $ ', '$RCSfile: imapsync,v $ ',
'$Revision: 1.125 $ ', '$Revision: 1.127 $ ',
'$Date: 2005/04/22 01:12:18 $ ', '$Date: 2005/05/09 04:14:48 $ ',
"\n", "\n",
"Mail::IMAPClient version used here is ", "Mail::IMAPClient version used here is ",
$VERSION_IMAPClient, " auth md5 : $md5_supported", $VERSION_IMAPClient, " auth md5 : $md5_supported",
@ -580,7 +580,7 @@ if ($foldersizes) {
foreach my $f_fold (@f_folders) { foreach my $f_fold (@f_folders) {
my $stot = 0; my $stot = 0;
my $smess = 0; my $smess = 0;
printf("From Folder %-25s", "[$f_fold]"); printf("From Folder %-35s", "[$f_fold]");
unless ($from->select($f_fold)) { unless ($from->select($f_fold)) {
warn warn
"From Folder $f_fold : Could not select ", "From Folder $f_fold : Could not select ",
@ -694,6 +694,25 @@ FOLDER: foreach my $f_fold (@f_folders) {
} }
} }
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)) { unless ($to->select($t_fold)) {
warn warn
"To Folder $t_fold : Could not select ", "To Folder $t_fold : Could not select ",
@ -713,20 +732,6 @@ FOLDER: foreach my $f_fold (@f_folders) {
unless($dry) { $to->subscribe($t_fold) }; 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); next FOLDER if ($justfolders);
my @f_msgs = $maxage ? $from->since(time - 86400 * $maxage) : $from->search("ALL"); my @f_msgs = $maxage ? $from->since(time - 86400 * $maxage) : $from->search("ALL");
@ -806,10 +811,9 @@ FOLDER: foreach my $f_fold (@f_folders) {
# copy # copy
print "+ Copying msg #$f_msg:$f_size to folder $t_fold\n"; print "+ Copying msg #$f_msg:$f_size to folder $t_fold\n";
my $string = $from->message_string($f_msg); my $string = $from->message_string($f_msg);
while (my $regexmess = shift(@regexmess)) { foreach my $regexmess (@regexmess) {
$debug and print "eval \$string =~ $regexmess\n"; $debug and print "eval \$string =~ $regexmess\n";
eval("\$string =~ $regexmess"); eval("\$string =~ $regexmess");
} }
$debug and print "F message content begin next line\n", $debug and print "F message content begin next line\n",
$string, $string,

View file

@ -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);

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/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 #### Shell pragmas
@ -108,7 +108,8 @@ plumeloul() {
--host1 plume --user1 tata@est.belle \ --host1 plume --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \ --passfile1 /var/tmp/secret.tata \
--host2 loul --user2 tata \ --host2 loul --user2 tata \
--passfile2 /var/tmp/secret.tata --passfile2 /var/tmp/secret.tata \
--nosyncacls
else else
: :
fi fi
@ -122,7 +123,8 @@ lp_folder() {
--passfile2 /var/tmp/secret.tata \ --passfile2 /var/tmp/secret.tata \
--folder INBOX.yop --folder INBOX.Trash \ --folder INBOX.yop --folder INBOX.Trash \
--host1 loul --user1 tata \ --host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata --passfile1 /var/tmp/secret.tata \
--nosyncacls
else else
: :
fi fi
@ -137,7 +139,8 @@ lp_justfolders() {
--folder INBOX.yop --folder INBOX.Trash \ --folder INBOX.yop --folder INBOX.Trash \
--host1 loul --user1 tata \ --host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata \ --passfile1 /var/tmp/secret.tata \
--justfolders --justfolders \
--nosyncacls
else else
: :
fi fi
@ -153,7 +156,8 @@ pl_folder_qqq() {
--folder INBOX.qqq \ --folder INBOX.qqq \
--prefix2 "" \ --prefix2 "" \
--host2 loul --user2 tata \ --host2 loul --user2 tata \
--passfile2 /var/tmp/secret.tata --passfile2 /var/tmp/secret.tata \
--nosyncacls
else else
: :
fi fi
@ -186,7 +190,8 @@ pl_folder() {
--passfile1 /var/tmp/secret.tata \ --passfile1 /var/tmp/secret.tata \
--folder INBOX.yop \ --folder INBOX.yop \
--host2 loul --user2 tata \ --host2 loul --user2 tata \
--passfile2 /var/tmp/secret.tata --passfile2 /var/tmp/secret.tata \
--nosyncacls
else else
: :
fi fi
@ -552,8 +557,7 @@ essnet_plume2()
--passfile2 /var/tmp/secret.tata \ --passfile2 /var/tmp/secret.tata \
--nosyncacls \ --nosyncacls \
--noauthmd5 --sep1 / --foldersizes \ --noauthmd5 --sep1 / --foldersizes \
--prefix2 INBOX. --regextrans2 's¤INBOX.INBOX¤INBOX¤' \ --prefix2 INBOX. --regextrans2 's¤INBOX.INBOX¤INBOX¤'
--nosyncacls
} }
regexmess() regexmess()