This commit is contained in:
Nick Bebout 2011-03-12 02:43:51 +00:00
parent 1f3e4ec56b
commit 8d7bb14b19
6 changed files with 75 additions and 16 deletions

View file

@ -1,4 +1,7 @@
Holger Mauermann
Bug about missing "AUTH=CRAM-MD5" (also copy-paste mistake in login_imap)
Kaspar Brand
Wrote code implementing options

View file

@ -1,15 +1,19 @@
RCS file: RCS/imapsync,v
Working file: imapsync
head: 1.71
head: 1.72
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 71; selected revisions: 71
total revisions: 72; selected revisions: 72
description:
----------------------------
revision 1.72
date: 2004/02/09 15:42:33; author: gilles; state: Exp; lines: +39 -9
Better MD5 handling
----------------------------
revision 1.71
date: 2004/01/29 04:28:36; author: gilles; state: Exp; lines: +23 -7
Added statistics about bytes transfered, skipped

4
README
View file

@ -2,7 +2,7 @@ NAME
imapsync - IMAP sync or copy tool. Synchronize mailboxes between two
imap servers.
$Revision: 1.71 $
$Revision: 1.72 $
INSTALL
imapsync works fine under any Unix OS.
@ -193,5 +193,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will be always welcome.
$Id: imapsync,v 1.71 2004/01/29 04:28:36 gilles Exp $
$Id: imapsync,v 1.72 2004/02/09 15:42:33 gilles Exp $

View file

@ -1 +1 @@
1.71
1.72

View file

@ -4,7 +4,7 @@
imapsync - IMAP sync or copy tool. Synchronize mailboxes between two imap servers.
$Revision: 1.71 $
$Revision: 1.72 $
=head1 INSTALL
@ -229,7 +229,7 @@ Welcome in shell programming !
Feedback (good or bad) will be always welcome.
$Id: imapsync,v 1.71 2004/01/29 04:28:36 gilles Exp $
$Id: imapsync,v 1.72 2004/02/09 15:42:33 gilles Exp $
=cut
@ -264,7 +264,7 @@ my(
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.71 2004/01/29 04:28:36 gilles Exp $ ';
$rcs = ' $Id: imapsync,v 1.72 2004/02/09 15:42:33 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
@ -280,7 +280,7 @@ $mess_size_total_error = 0;
sub md5_supported {
# before 2.2.6 no md5 native
# I know this is ugly I should write a sort function
# I know this is ugly, I should write a sort function
if ($VERSION_IMAPClient =~ m/(\d+)\.(\d+)\.(\d+)/) {
$debug and print "VERSION_IMAPClient $1 $2 $3\n";
my($major,$minor,$sub) = ($1, $2, $3);
@ -299,8 +299,8 @@ $error=0;
my $banner = join("",
'$RCSfile: imapsync,v $ ',
'$Revision: 1.71 $ ',
'$Date: 2004/01/29 04:28:36 $ ',
'$Revision: 1.72 $ ',
'$Date: 2004/02/09 15:42:33 $ ',
"\n",
"Mail::IMAPClient version used here is ",
$VERSION_IMAPClient, " auth md5 : $md5_supported",
@ -340,6 +340,14 @@ my $to = ();
my $authmech = "CRAM-MD5";
unless ($md5_supported) {
print "Auth $authmech not supported by IMAPClient $VERSION_IMAPClient\n";
}else{
print "Auth $authmech supported by IMAPClient $VERSION_IMAPClient\n";
}
$debugimap and print "From connection\n";
$from = login_imap($host1, $port1, $user1, $password1, $debugimap);
@ -359,14 +367,36 @@ sub login_imap {
or die "can't open imap connection on [$host] with user [$user] : $@\n";
$imap->User($user);
$imap->Password($password);
$md5_supported and $imap->has_capability($authmech)
and $to->Authmechanism($authmech);
md5auth($imap);
$imap->login();
return($imap);
}
sub md5auth() {
my ($imap) = @_;
unless ($md5_supported) {
return;
}
if ($imap->has_capability($authmech)
or $imap->has_capability("AUTH=$authmech")) {
print "Server [", $imap->Server,
"] has capability $authmech\n";
}else{
print "Server [", $imap->Server,
"] has NOT capability $authmech\n";
return;
}
if ($imap->Authmechanism($authmech)) {
print "Using $authmech authentification\n";
}else{
print "Can NOT use $authmech authentification, using plain\n";
}
return;
}
print "From software : ", ($from->Report())[0];
print "To software : ", ($to->Report())[0];

View file

@ -1,8 +1,11 @@
#!/bin/sh
# $Id: tests.sh,v 1.13 2004/01/29 04:21:54 gilles Exp $
# $Id: tests.sh,v 1.14 2004/02/07 03:34:35 gilles Exp $
# $Log: tests.sh,v $
# Revision 1.14 2004/02/07 03:34:35 gilles
# Added lp_include()
#
# Revision 1.13 2004/01/29 04:21:54 gilles
# Added lp_maxage
# Added lp_maxsize
@ -298,6 +301,24 @@ lp_maxsize()
fi
}
lp_include()
{
sendtestmessage
if test X`hostname` = X"plume"; then
echo3 Here is plume
./imapsync \
--host2 plume --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
--host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata \
--include 'INBOX.yop'
else
:
fi
}
# mandatory tests
run_tests perl_syntax
@ -318,7 +339,8 @@ test $# -eq 0 && run_tests \
lp_justconnect \
lp_md5auth \
lp_maxage \
lp_maxsize
lp_maxsize \
lp_include
# selective tests