1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-17 00:02:29 +01:00
This commit is contained in:
Nick Bebout 2011-03-12 02:44:31 +00:00
parent 9cb7c657c7
commit ab2854d584
8 changed files with 108 additions and 15 deletions

View File

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

4
README
View File

@ -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 $

8
TODO
View File

@ -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"

View File

@ -1 +1 @@
1.200
1.201

View File

@ -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."

View File

@ -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.

View File

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

View File

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