diff --git a/CREDITS b/CREDITS index 9cdc0e6..4a92c31 100644 --- a/CREDITS +++ b/CREDITS @@ -1,9 +1,20 @@ #!/bin/cat + +Arnaud Launay +Bug about --expunge12 (no option code) + +Kirk Averett +Bug about --subscribed option. I stupidly +commented a map line in release 1.138 + Here are the persons who helped me to develop imapsync. Feel free to tell me if a name is missing or if you want to remove one. +Evert Mouw +Gave the "Term::ReadKey" module dependency problem. + Roy Hoobler Problems with big folders. Bug about message sizes. diff --git a/ChangeLog b/ChangeLog index eda9d05..104e232 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,25 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.140 +head: 1.142 branch: locks: strict + gilles: 1.142 access list: symbolic names: keyword substitution: kv -total revisions: 140; selected revisions: 140 +total revisions: 142; selected revisions: 142 description: ---------------------------- +revision 1.142 locked by: gilles; +date: 2005/11/16 01:08:49; author: gilles; state: Exp; lines: +7 -5 +Added expunge1 and expunge2 getoption code +---------------------------- +revision 1.141 +date: 2005/11/16 01:05:16; author: gilles; state: Exp; lines: +6 -6 +fixed bug about subscribed folders. Was introduced +by a line commented in 1.137 +---------------------------- revision 1.140 date: 2005/10/30 10:16:52; author: gilles; state: Exp; lines: +21 -8 Added --expunge1 --expunge2 options diff --git a/INSTALL b/INSTALL index cd91fab..7ff9463 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ -# $Id: INSTALL,v 1.8 2005/06/21 01:29:55 gilles Exp gilles $ +# $Id: INSTALL,v 1.9 2005/11/16 01:14:18 gilles Exp gilles $ # # INSTALL file for imapsync # imapsync : IMAP sync or copy tool. @@ -37,6 +37,8 @@ You need : perl -mDigest::MD5 -e 'print $Digest::MD5::VERSION, "\n"' I use 2.20 (debian package) +- Term::ReadKey + - (Option) Perl Digest::HMAC_MD5 module Good for non plain text password over network. diff --git a/README b/README index a252b11..2a2c655 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.140 $ + $Revision: 1.142 $ INSTALL imapsync works fine under any Unix OS. @@ -261,5 +261,5 @@ AUTHOR teaching free open and gratis softwares. Don't hesitate to pay him for that services. - $Id: imapsync,v 1.140 2005/10/30 10:16:52 gilles Exp $ + $Id: imapsync,v 1.142 2005/11/16 01:08:49 gilles Exp gilles $ diff --git a/RECORD b/RECORD new file mode 100644 index 0000000..25aa6dd --- /dev/null +++ b/RECORD @@ -0,0 +1,9 @@ + + +------------------------------------------------------------------------------- +Olivier Morel: +Nous avons terminé notre migration et récupéré l'ensemble des boites aux lettres grace à votre outil, tout s'est déroulé à merveille (18 heures de traitement) +- 2200 Boites aux lettres +- 18 Go +- récupération via .bat + diff --git a/TODO b/TODO index f1c54e2..a50083b 100644 --- a/TODO +++ b/TODO @@ -1,6 +1,9 @@ TODO file for imapsync ---------------------- +Add an --exactsync option to remove target messages +that are not on source. + Read the IMAP RFC http://www.faqs.org/rfcs/rfc3501.html Respect the NAMESPACE behavior like the RFC. diff --git a/VERSION b/VERSION index d306e42..fd645df 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.140 +1.142 diff --git a/imapsync b/imapsync index 34ff7b6..ae20ac6 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.140 $ +$Revision: 1.142 $ =head1 INSTALL @@ -305,7 +305,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.140 2005/10/30 10:16:52 gilles Exp $ +$Id: imapsync,v 1.142 2005/11/16 01:08:49 gilles Exp gilles $ =cut @@ -350,7 +350,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.140 2005/10/30 10:16:52 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.142 2005/11/16 01:08:49 gilles Exp gilles $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -387,8 +387,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.140 $ ', - '$Date: 2005/10/30 10:16:52 $ ', + '$Revision: 1.142 $ ', + '$Date: 2005/11/16 01:08:49 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient,"\n" @@ -539,7 +539,7 @@ die unless $to->IsAuthenticated(); my (@f_folders, @t_folders, %fs_folders); # Make a hash of subscribed folders in source server. -# map { $fs_folders{$_}=1 } $from->subscribed(); +map { $fs_folders{$_}=1 } $from->subscribed(); @@ -1029,6 +1029,8 @@ sub get_options "foldersizes!" => \$foldersizes, "dry!" => \$dry, "expunge!" => \$expunge, + "expunge1!" => \$expunge1, + "expunge2!" => \$expunge2, "subscribed!" => \$subscribed, "subscribe!" => \$subscribe, "justconnect!"=> \$justconnect, diff --git a/patches/imapsync-1.139-ssl-authmech-authusing.patch b/patches/imapsync-1.139-ssl-authmech-authusing.patch new file mode 100644 index 0000000..f082f2d --- /dev/null +++ b/patches/imapsync-1.139-ssl-authmech-authusing.patch @@ -0,0 +1,224 @@ +--- imapsync 2005-07-16 08:46:35.000000000 -0400 ++++ ../imapsync.ssl 2005-10-05 14:46:23.000000000 -0400 +@@ -38,7 +38,8 @@ + [--user1 ] [--passfile1 ] + [--host2 server2] [--port2 ] + [--user2 ] [--passfile2 ] +- [--noauthmd5] ++ [--noauthmd5] [--authusing --prefix1 ] ++ [--authmech --folder ...] + [--include ] [--exclude ] + [--prefix2 ] [--regextrans2 ] +@@ -61,6 +62,7 @@ + [--debug] [--debugimap] + [--timeout ] [--fast] + [--version] [--help] ++ [--ssl] + + =cut + # comment +@@ -315,25 +317,28 @@ + use Digest::MD5 qw(md5_base64); + use Term::ReadKey; + #use Digest::HMAC_MD5; ++use IO::Socket::SSL; ++use MIME::Base64; + + eval { require 'usr/include/sysexits.ph' }; + + + my( + $rcs, $debug, $debugimap, $error, +- $host1, $host2, $port1, $port2, +- $user1, $user2, $password1, $password2, $passfile1, $passfile2, ++ $host1, $host2, $port1, $port2, ++ $user1, $user2, $password1, $password2, $passfile1, $passfile2, + @folder, $include, $exclude, $prefix2, $regextrans2, @regexmess, ++ $authusing, $prefix1, $authmech, + $sep1, $sep2, +- $syncinternaldates, $syncacls, ++ $syncinternaldates, $syncacls, + $fastio1, $fastio2, +- $maxsize, $maxage, ++ $maxsize, $maxage, + $skipheader, @useheader, + $skipsize, $foldersizes, $buffersize, +- $delete, $expunge, $dry, ++ $delete, $expunge, $dry, + $authmd5, + $subscribed, $subscribe, +- $version, $VERSION, $help, ++ $version, $VERSION, $help, + $justconnect, $justfolders, + $fast, + $mess_size_total_trans, +@@ -341,8 +346,9 @@ + $mess_size_total_error, + $mess_trans, $mess_skipped, + $timeout, # whr (ESS/PRW) +- $timestart, $timeend, $timediff, ++ $timestart, $timeend, $timediff, + $timesize, $timebefore, ++ $usessl + ); + + use vars qw ($opt_G); # missing code for this will be option. +@@ -406,11 +412,11 @@ + } + + $host1 || missing_option("--host1") ; +-$port1 = (defined($port1)) ? $port1 : 143; ++$port1 = (defined($port1)) ? $port1 : ((defined($usessl)) ? 993 : 143); + $user1 || missing_option("--user1"); + + $host2 || missing_option("--host2") ; +-$port2 = (defined($port2)) ? $port2 : 143; ++$port2 = (defined($port2)) ? $port2 : ((defined($usessl)) ? 993 : 143); + $user2 || missing_option("--user2"); + + $authmd5 = (defined($authmd5)) ? $authmd5 : 1; +@@ -424,8 +430,8 @@ + + @useheader = ("ALL") unless (@useheader); + +-print "From imap server [$host1] port [$port1] user [$user1]\n"; +-print "To imap server [$host2] port [$port2] user [$user2]\n"; ++(defined($authusing)) ? print "From imap server [$host1] port [$port1] user [$user1] authusing [$authusing]\n" : print "From imap server [$host1] port [$port1] user [$user1]\n"; ++(defined($authusing)) ? print "To imap server [$host2] port [$port2] user [$user2] authusing [$authusing]\n" : print "To imap server [$host2] port [$port2] user [$user2]\n"; + + $password1 || $passfile1 || do { + print "What's the password for $user1\@$host1? "; +@@ -447,8 +453,9 @@ + my $from = (); + my $to = (); + +-my $authmech = "CRAM-MD5"; +- ++if (!defined($authmech)) { ++ $authmech = "CRAM-MD5"; ++} + + $timestart = time(); + $timebefore = $timestart; +@@ -474,7 +481,19 @@ + sub login_imap { + my($host, $port, $user, $password, + $debugimap, $timeout, $fastio) = @_; +- my $imap = Mail::IMAPClient->new(); ++ my ($imap); ++ if ($usessl) { ++ my $ssl = new IO::Socket::SSL("$host:$port"); ++ die ("Error connecting - $@") unless defined $ssl; ++ $ssl->autoflush(1); ++ ++ $imap = Mail::IMAPClient->new( ++ Socket => $ssl, ++ Server => $host, ++ ); ++ } else { ++ $imap = Mail::IMAPClient->new(); ++ } + $imap->Server($host); + $imap->Port($port); + $imap->Fast_io($fastio); +@@ -482,13 +501,17 @@ + $imap->Uid(1); + $imap->Peek(1); + $imap->Debug($debugimap); +- $imap->connect() +- or die "Can not open imap connection on [$host] with user [$user] : $@\n"; +- if ($timeout) # whr (ESS/PRW) +- { +- $imap->Timeout($timeout); +- print "Setting imap timeout to $timeout\n"; +- } ++ $imap->Authcallback(\&plainauth); ++ if ($usessl) { ++ $imap->State(Mail::IMAPClient::Connected); ++ } else { ++ $imap->connect() ++ or die "Can not open imap connection on [$host] with user [$user] : $@\n"; ++ } ++ if ($timeout) { # whr (ESS/PRW) ++ $imap->Timeout($timeout); ++ print "Setting imap timeout to $timeout\n"; ++ } + + $imap->User($user); + $imap->Password($password); +@@ -497,6 +520,13 @@ + return($imap); + } + ++sub plainauth() { ++ my $code = shift; ++ my $imap = shift; ++ ++ my $string = sprintf("%s\x00%s\x00%s", $imap->User, defined($authusing) ? $authusing : $imap->User, $imap->Password); ++ return encode_base64("$string"); ++} + + sub md5auth() { + my ($imap) = @_; +@@ -537,7 +567,7 @@ + my (@f_folders, @t_folders, %fs_folders); + + # Make a hash of subscribed folders in source server. +-# map { $fs_folders{$_}=1 } $from->subscribed(); ++map { $fs_folders{$_}=1 } $from->subscribed($prefix1); + + + +@@ -550,7 +580,7 @@ + @f_folders = sort keys (%fs_folders); + }else { + # no option, all folders +- @f_folders = sort $from->folders(); ++ @f_folders = sort $from->folders($prefix1); + # consider (optional) includes and excludes + if ($include) { + @f_folders = grep /$include/,@f_folders; +@@ -996,6 +1026,8 @@ + "port2=i" => \$port2, + "user1=s" => \$user1, + "user2=s" => \$user2, ++ "authusing=s" => \$authusing, ++ "authmech=s" => \$authmech, + "password1=s" => \$password1, + "password2=s" => \$password2, + "passfile1=s" => \$passfile1, +@@ -1006,6 +1038,7 @@ + "folder=s" => \@folder, + "include=s" => \$include, + "exclude=s" => \$exclude, ++ "prefix1=s" => \$prefix1, + "prefix2=s" => \$prefix2, + "regextrans2=s" => \$regextrans2, + "regexmess=s" => \@regexmess, +@@ -1031,6 +1064,7 @@ + "skipsize!" => \$skipsize, + "fastio1!" => \$fastio1, + "fastio2!" => \$fastio2, ++ "ssl!" => \$usessl + ); + + $debug and print "get options: [$opt_ret]\n"; +@@ -1122,6 +1156,9 @@ + --host2 : "destination" imap server. Mandatory. + --port2 : port to connect. Default is 143. + --user2 : user to login. Mandatory. ++--authusing : user to auth with (when running on behalf of another) ++--authmech : auth mechanism to use (e.g. PLAIN, LOGIN, CRAM-MD5...) ++ default CRAM-MD5 + --password2 : password for the user2. Dangerous, use --passfile2 + --passfile2 : password file for the user2. Contains the password. + --noauthmd5 : don't use MD5 authentification. +@@ -1187,6 +1224,7 @@ + --nofastio1 : don't use fastio with the "from" server. + --nofastio2 : don't use fastio with the "destination" server. + --timeout : imap connect timeout. ++--ssl : use SSL connections. + --help : print this. + + Example: to synchronise imap account "foo" on "imap.truc.org"