From 8d7bb14b19318e79c15b776f07e4ace36e1498d3 Mon Sep 17 00:00:00 2001 From: Nick Bebout Date: Sat, 12 Mar 2011 02:43:51 +0000 Subject: [PATCH] 1.72 --- CREDITS | 3 +++ ChangeLog | 8 ++++++-- README | 4 ++-- VERSION | 2 +- imapsync | 48 +++++++++++++++++++++++++++++++++++++++--------- tests.sh | 26 ++++++++++++++++++++++++-- 6 files changed, 75 insertions(+), 16 deletions(-) diff --git a/CREDITS b/CREDITS index 32b2cc6..f833792 100644 --- a/CREDITS +++ b/CREDITS @@ -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 diff --git a/ChangeLog b/ChangeLog index bdf97aa..908299f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/README b/README index c86176c..017aa03 100644 --- a/README +++ b/README @@ -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 $ diff --git a/VERSION b/VERSION index 12816e6..cc31fcd 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.71 +1.72 diff --git a/imapsync b/imapsync index 47573bb..61560b2 100755 --- a/imapsync +++ b/imapsync @@ -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]; diff --git a/tests.sh b/tests.sh index 71c76f8..fe8c6a2 100644 --- a/tests.sh +++ b/tests.sh @@ -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