diff --git a/ChangeLog b/ChangeLog index 2b1fbd0..80ccc74 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,15 +1,20 @@ RCS file: RCS/imapsync,v Working file: imapsync -head: 1.200 +head: 1.201 branch: locks: strict access list: symbolic names: keyword substitution: kv -total revisions: 200; selected revisions: 200 +total revisions: 201; selected revisions: 201 description: ---------------------------- +revision 1.201 +date: 2007/01/03 23:49:10; author: gilles; state: Exp; lines: +30 -6 +Use login2() instead of login() (literal form is not always +supported. +---------------------------- revision 1.200 date: 2007/01/02 08:27:04; author: gilles; state: Exp; lines: +48 -15 use message_to_file()instead of message_string() diff --git a/README b/README index b8c9477..fd8d2a2 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ NAME Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 25 different IMAP server softwares supported with success. - $Revision: 1.200 $ + $Revision: 1.201 $ INSTALL imapsync works fine under any Unix OS. @@ -301,5 +301,5 @@ AUTHOR teaching free open and gratis softwares. Don't hesitate to pay him for that services. - $Id: imapsync,v 1.200 2007/01/02 08:27:04 gilles Exp $ + $Id: imapsync,v 1.201 2007/01/03 23:49:10 gilles Exp $ diff --git a/TODO b/TODO index 5bac4fb..9c298f2 100644 --- a/TODO +++ b/TODO @@ -1,7 +1,10 @@ TODO file for imapsync ---------------------- -Try a 50Mo message transfer (slow ?) +Add an option to tell imapsync that the domain +is changing and have it replace the domain in all user names that are +related to ACLs. +See patches/imapsync-acls-users Add a best practice migration tips document, good options with such imap server. @@ -41,6 +44,9 @@ http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html Explain expunge behavior. +DONE. Try a 50Mo message transfer (slow ?) +fast ! + DONE. Add my amazon wishlist link. DONE. Remove file rfc2342.txt "IMAP4 Namespace" diff --git a/VERSION b/VERSION index 33fef12..6ef5c8c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.200 +1.201 diff --git a/freshmeat_submition.inp b/freshmeat_submition.inp index 9d18a48..629290e 100644 --- a/freshmeat_submition.inp +++ b/freshmeat_submition.inp @@ -12,6 +12,7 @@ RELEASE_FOCUS="Minor bugfixes" #TEXT_BODY="Syntax cleanup" #TEXT_BODY="Updated documentation" -TEXT_BODY="Bug fix: be case insensitive with header keywords." +#TEXT_BODY="Bug fix: be case insensitive with header keywords." +TEXT_BODY="Bug fix: corrected memory problem with big messages." diff --git a/freshmeat_submition.out b/freshmeat_submition.out index 6ca1dfc..4de79e1 100644 --- a/freshmeat_submition.out +++ b/freshmeat_submition.out @@ -1,9 +1,9 @@ Project: imapsync -Version: 1.190 +Version: 1.200 Release-Focus: Minor bugfixes Hide: Y Home-Page-URL: http://www.linux-france.org/prj/imapsync/ Gzipped-Tar-URL: http://www.linux-france.org/prj/imapsync/dist/ -Bug fix: be case insensitive with header keywords. +Bug fix: corrected memory problem with big messages. diff --git a/imapsync b/imapsync index ef7b7b6..fac82f6 100755 --- a/imapsync +++ b/imapsync @@ -7,7 +7,7 @@ tool. Synchronise mailboxes between two imap servers. Good at IMAP migration. More than 25 different IMAP server softwares supported with success. -$Revision: 1.200 $ +$Revision: 1.201 $ =head1 INSTALL @@ -353,7 +353,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.200 2007/01/02 08:27:04 gilles Exp $ +$Id: imapsync,v 1.201 2007/01/03 23:49:10 gilles Exp $ =cut @@ -410,7 +410,7 @@ my( use vars qw ($opt_G); # missing code for this will be option. -$rcs = ' $Id: imapsync,v 1.200 2007/01/02 08:27:04 gilles Exp $ '; +$rcs = ' $Id: imapsync,v 1.201 2007/01/03 23:49:10 gilles Exp $ '; $rcs =~ m/,v (\d+\.\d+)/; $VERSION = ($1) ? $1 : "UNKNOWN"; @@ -447,8 +447,8 @@ $error=0; my $banner = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.200 $ ', - '$Date: 2007/01/02 08:27:04 $ ', + '$Revision: 1.201 $ ', + '$Date: 2007/01/03 23:49:10 $ ', "\n", "Mail::IMAPClient version used here is ", $VERSION_IMAPClient,"\n" @@ -642,7 +642,7 @@ sub login_imap { $imap->User($user); $imap->Authuser($authuser); $imap->Password($password); - $imap->login() or die "Error login : [$host] with user [$user] : $@"; + $imap->login2() or die "Error login : [$host] with user [$user] : $@"; return($imap); } @@ -1669,6 +1669,30 @@ sub fetch_hash2 { # From IMAPClient.pm + +sub login2 { + my $self = shift; + return $self->authenticate($self->Authmechanism,$self->Authcallback) + if $self->{Authmechanism}; + + my $id = $self->User; + my $has_quotes = $id =~ /^".*"$/ ? 1 : 0; + my $string = "Login " . ( $has_quotes ? $id : qq("$id") ) . + " " . $self->Password . "\r\n"; + $self->_imap_command($string) + and $self->State(Authenticated); + # $self->folders and $self->separator unless $self->NoAutoList; + unless ( $self->IsAuthenticated) { + my($carp) = $self->LastError; + $carp =~ s/^[\S]+ ([^\x0d\x0a]*)\x0d?\x0a/$1/; + carp $carp unless defined wantarray; + return undef; + } + return $self; +} + +# From IMAPClient.pm + sub parse_headers2 { my($self,$msgspec_all,@fields) = @_; my(%fieldmap) = map { ( lc($_),$_ ) } @fields; diff --git a/patches/imapsync-acls-users b/patches/imapsync-acls-users new file mode 100644 index 0000000..902c887 --- /dev/null +++ b/patches/imapsync-acls-users @@ -0,0 +1,57 @@ +Hi Gilles, + +I have used your imapsync program many times over the past few months +and it has been a great help in our mail server migration, so first of +all: Thank you! :-) + +However, with the latest task, I ran into a problem: I'm migrating mail +from a Kolab 2.0.4 server to a Kolab 2.1beta2 server (both use Cyrus as +imapd). The problem is: We're also changing domains at the same time, +i.e. any user "NAME@OLD.DOMAIN" on the old server becomes +"NAME@NEW.DOMAIN" on the new server. When transferring mail, this +doesn't have any bad influence, but it does lead to problems when trying +to sync ACLs as well. Right now, imapsync will take the ACLs, compare +the folder on the old and the new server and will then happily set the +ACL for "NAME@NEW.DOMAIN" on the new server to "none" (because it +doesn't exist on the old server) and then try to set the ACLs for +"NAME@OLD.DOMAIN" on the new server - which a) fails (it just removed +the access for NAME@NEW.DOMAIN - hence, the user cannot access his own +mailbox anymore) and b) is not desirable anyway (only "NAME@NEW.DOMAIN" +should have permissions). + +So, basically, what I need is an option to tell imapsync that the domain +is changing and have it replace the domain in all user names that are +related to ACLs. Right now, I've solved this by crudely patching the +"acls_sync" subroutine: + +sub acls_sync { + my($f_fold, $t_fold) = @_; +[...] + foreach my $user (sort(keys(%users))) { + my $acl = $f_hash->{$user} || "none"; + if ($user eq $user2) + { + # the user we use to log in as on the target + # server gets "all" permissions always + $acl = "lrswipcda"; + } + my $new_user = $user; + $new_user =~ s/OLD.DOMAIN/NEW.DOMAIN/g; + + print "acl $user -> $new_user : [$acl]\n"; + next if ($f_hash->{$user} && $t_hash->{$new_user} && + $f_hash->{$user} eq $t_hash->{$new_user}); + unless ($dry) { + print "setting acl $t_fold $new_user $acl\n"; + $to->setacl($t_fold, $new_user, $acl) + or warn "Could not set acl: $@\n"; + } + } +[...] + +but this is really just a hack to suit my current needs. Maybe you could +consider adding something more refined than this hack in a future release? :-) + +Best regards, + +Thomas