diff --git a/FAQ b/FAQ index 9ce327c..59ad635 100644 --- a/FAQ +++ b/FAQ @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: FAQ,v 1.135 2013/07/23 11:28:22 gilles Exp gilles $ +# $Id: FAQ,v 1.136 2013/08/03 02:07:30 gilles Exp gilles $ +------------------+ | FAQ for imapsync | @@ -818,6 +818,18 @@ b) Use stunnel stunnel -c -d 143 -r imap.foo.org:993 then use imapsync on localhost (or bar machine) imap (143) port. +======================================================================= +Q. On windows ssl use to work with imapsync.exe 1.536 or previous then + an upgrade to next release makes it fail. + +R. The I0::Socket::SSL can have SSL_version set by default to + "SSLv23:!SSLv2" but the auto-negociation can fail with + some ssl servers. Use --ssl1_SSL_version or + --ssl2_SSL_version to change SSL_version. + +Try: + + imapsync ... --ssl1 --ssl1_SSL_version "SSLv3" ======================================================================= Q: How to have an imaps server? @@ -839,7 +851,7 @@ Imapsync appears to require IO::Socket::SSL. What can I do? R1: use standalone imapsync.exe, it contains IO::Socket::SSL Perl module embeded. -R2: IO::Socket::SSLio-socket-ssl is available on Win32 +R2: Module IO::Socket::SSL is available on Win32 with Strawberry Perl. ======================================================================= diff --git a/Makefile b/Makefile index 094556f..db879c8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -# $Id: Makefile,v 1.123 2013/07/23 11:27:18 gilles Exp gilles $ +# $Id: Makefile,v 1.125 2013/08/03 17:25:50 gilles Exp gilles $ .PHONY: help usage all @@ -14,7 +14,7 @@ usage: @echo "make tests_win32 # run --test and W/test.bat on win32" @echo "make tests_win32_dev # run W/test2.bat on win32" @echo "make tests_win32_dev3 # run W/test3.bat on win32" - @echo "make prereq_win32 # run examples/install_modules.bat on win32" + @echo "make .prereq_win32 # run examples/install_modules.bat on win32" @echo "make all " @echo "make upload_index" @echo "make upload_ks" @@ -166,11 +166,12 @@ test_imapsync_exe: dosify_bat scp W/test_exe.bat Admin@c:'C:/msys/1.0/home/Admin/imapsync/' time ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/test_exe.bat' -prereq_win32: examples/install_modules.bat .dosify_bat +.prereq_win32: examples/install_modules.bat .dosify_bat scp examples/install_modules.bat Admin@c:'C:/msys/1.0/home/Admin/imapsync/' ssh Admin@c 'C:/msys/1.0/home/Admin/imapsync/install_modules.bat' + touch .prereq_win32 -imapsync.exe: imapsync prereq_win32 build_exe.bat .dosify_bat +imapsync.exe: imapsync .prereq_win32 rcsdiff imapsync ssh Admin@c 'perl -V' (date "+%s"| tr "\n" " "; echo -n "BEGIN " $(VERSION) ": "; date) >> W/.BUILD_EXE_TIME @@ -293,7 +294,22 @@ ksa: rsync -avHz --delete -P \ . imapsync@ks.lamiral.info:public_html/imapsync/ -publish: ksa upload_ks ml +upload_ks: ci tarball + rsync -lptvHzP $(PUBLIC_FILES) \ + root@ks.lamiral.info:/var/www/imapsync/ + rsync -lptvHzP $(PUBLIC_FILES_W) \ + root@ks.lamiral.info:/var/www/imapsync/W/ + rsync -lptvHzP $(PUBLIC_FILES_IMAGES) \ + root@ks.lamiral.info:/var/www/imapsync/W/images/ + rsync -lptvHzP ./W/ks.htaccess \ + root@ks.lamiral.info:/var/www/imapsync/.htaccess + rsync -lptvHzrP ./dist/ \ + root@ks.lamiral.info:/var/www/imapsync/dist/ + rsync -lptvHzrP ./examples/ \ + root@ks.lamiral.info:/var/www/imapsync/examples/ + +publish: upload_ks ksa + echo Now ou can do make ml PUBLIC_FILES = ./ChangeLog ./NOLIMIT ./LICENSE ./CREDITS ./FAQ \ ./index.shtml ./INSTALL \ @@ -312,20 +328,6 @@ ml: dist_dir mailq -upload_ks: ci - rsync -lptvHzP $(PUBLIC_FILES) \ - root@ks.lamiral.info:/var/www/imapsync/ - rsync -lptvHzP $(PUBLIC_FILES_W) \ - root@ks.lamiral.info:/var/www/imapsync/W/ - rsync -lptvHzP $(PUBLIC_FILES_IMAGES) \ - root@ks.lamiral.info:/var/www/imapsync/W/images/ - rsync -lptvHzP ./W/ks.htaccess \ - root@ks.lamiral.info:/var/www/imapsync/.htaccess - rsync -lptvHzrP ./dist/ \ - root@ks.lamiral.info:/var/www/imapsync/dist/ - rsync -lptvHzrP ./examples/ \ - root@ks.lamiral.info:/var/www/imapsync/examples/ - upload_lfo: #rm -rf /home/gilles/public_html/www.linux-france.org/html/prj/imapsync/ #rm -rf /home/gilles/public_html/www.linux-france.org/ftp/prj/imapsync/ diff --git a/TODO b/TODO index f3a6ccc..8691162 100644 --- a/TODO +++ b/TODO @@ -1,5 +1,5 @@ #!/bin/cat -# $Id: TODO,v 1.120 2013/07/22 07:40:44 gilles Exp gilles $ +# $Id: TODO,v 1.122 2013/08/03 02:08:33 gilles Exp gilles $ TODO file for imapsync ---------------------- @@ -11,17 +11,15 @@ Add a best practice migration tips document. Write a Mail::imapsync package and use it. - -Fix the mailing-list archive bug with From at -the beginning of a line -http://www.linux-france.org/prj/imapsync_list/msg00307.html - Evaluate http://www.rackspace.com/apps/email_hosting/migrations http://www.yippiemove.com/ http://www.migrationwiz.com/ http://www.microsoft.com/download/en/details.aspx?id=1329 "Microsoft Transporter Suite" +Print the timeout value. +Inform --timeout is is seconds. + Add an exit value when exiting because of --exitwhenover The goal is to know easily why to restart later. @@ -43,9 +41,15 @@ on some Unix at reboot) Add a FAQ entry about long path over than 260 character on Win32. -Fix long path over than 260 character on Win32. +Fix long path over than 260 character on Win32 with --usecache +Fix inode crunching with --usecache Think about Digest::SHA or Digest::SHA::PurePerl. Think about a file database like DBM instead. +Look at https://en.wikipedia.org/wiki/Radix_tree (David M advice) +Look at leveldb (Simon Th actux advice) +Look at http://fallabs.com/kyotocabinet/ (JYB advice) +Also Redis (Ludovic Danigo advice) + Find a way to avoid passwords in --debugimap unless needed. @@ -124,9 +128,7 @@ vs 250s avec la version 1.217". Marc Jauvin Add LITERAL+ [RFC 2088] support to imapsync. -Add an entry to -http://lsm.execpc.com/lsm/ -See template lsm.imapsync +Make a m4 file for lsm.imapsync and generate it at each public release. Add an option to tell imapsync that the domain is changing and have it replace the domain in all user names that are @@ -150,6 +152,13 @@ http://asg.web.cmu.edu/cyrus/download/imapd/altnamespace.html =========================================================================== +DONE. Add an entry to http://lsm.qqx.org/lsm/ +See lsm.imapsync + +DONE. Fix the mailing-list archive bug with From at +the beginning of a line +http://www.linux-france.org/prj/imapsync_list/msg00307.html + DONE. Remove 2.2.9 Mail::IMAPClient support. DONE. Add OAUTH autentication support diff --git a/VERSION_EXE b/VERSION_EXE index 0a92d41..35f5e47 100644 --- a/VERSION_EXE +++ b/VERSION_EXE @@ -1 +1 @@ -1.555 +1.558 diff --git a/W/.BUILD_EXE_TIME b/W/.BUILD_EXE_TIME index 3186b00..c35dff0 100644 --- a/W/.BUILD_EXE_TIME +++ b/W/.BUILD_EXE_TIME @@ -214,3 +214,13 @@ 1374581003 END 1.555 : mardi 23 juillet 2013, 14:03:23 (UTC+0200) 1374582566 BEGIN 1.555 : mardi 23 juillet 2013, 14:29:26 (UTC+0200) 1374583297 END 1.555 : mardi 23 juillet 2013, 14:41:37 (UTC+0200) +1375316925 BEGIN 1.556 : jeudi 1 août 2013, 02:28:45 (UTC+0200) +1375317443 END 1.556 : jeudi 1 août 2013, 02:37:23 (UTC+0200) +1375488764 BEGIN 1.557 : samedi 3 août 2013, 02:12:44 (UTC+0200) +1375489277 END 1.557 : samedi 3 août 2013, 02:21:17 (UTC+0200) +1375492828 BEGIN 1.558 : samedi 3 août 2013, 03:20:28 (UTC+0200) +1375494466 END 1.558 : samedi 3 août 2013, 03:47:46 (UTC+0200) +1375495357 BEGIN 1.558 : samedi 3 août 2013, 04:02:37 (UTC+0200) +1375497013 END 1.558 : samedi 3 août 2013, 04:30:13 (UTC+0200) +1375534760 BEGIN 1.558 : samedi 3 août 2013, 14:59:20 (UTC+0200) +1375536286 END 1.558 : samedi 3 août 2013, 15:24:46 (UTC+0200) diff --git a/W/learn/dbfile b/W/learn/dbfile index 2cadcd1..8877abd 100755 --- a/W/learn/dbfile +++ b/W/learn/dbfile @@ -13,7 +13,7 @@ my $X = tie %hash, 'DB_File', 'test_dbfile.db' ; print ( scalar keys %hash, "\n" ) ; -#exit ; +@ARGV and exit ; for my $num ( 0 .. 255 ) { print "$num\n" ; diff --git a/W/learn/test_dbmdeep.db b/W/learn/test_dbmdeep.db deleted file mode 100644 index fec8500..0000000 Binary files a/W/learn/test_dbmdeep.db and /dev/null differ diff --git a/W/lsm.imapsync b/W/lsm.imapsync index a007b99..b75a5fc 100644 --- a/W/lsm.imapsync +++ b/W/lsm.imapsync @@ -1,16 +1,17 @@ Begin4 Title: imapsync -Version: 1.209 -Entered-date: 2007-01-09 -Description: IMAP synchronisation, sync, copy or migration tool. - Synchronise mailboxes between two imap servers. Good at IMAP migration. - More than 32 different IMAP server softwares supported with success. -Keywords: IMAP synchronisation mail -Author: lamiral@linux-france.org (Gilles LAMIRAL) -Maintained-by: lamiral@linux-france.org (Gilles LAMIRAL) -Primary-site: http://www.linux-france.org/prj/imapsync/dist/ -Alternate-site: -Original-site: http://www.linux-france.org/prj/imapsync/dist/ -Platforms: UNIX Windows -Copying-policy: GPL +Version: 1.555 +Entered-date: 2013-07-30 +Description: IMAP synchronization, backup, copy or migration tool. + Synchronizes mailboxes between two IMAP servers. Good at IMAP migration. + More than 52 different IMAP server softwares supported. +Keywords: email IMAP synchronization migration backup migration +Author: gilles.lamiral@laposte.net (Gilles LAMIRAL) +Maintained-by: gilles.lamiral@laposte.net (Gilles LAMIRAL) +Primary-site: http://imapsync.lamiral.info/ +Alternate-site: https://github.com/imapsync/ +Original-site: http://imapsync.lamiral.info/ +Platforms: Any UNIX with Perl or Windows +Copying-policy: No limit to do anything with this work and this license. + 50 EUR at http://imapsync.lamiral.info/ or gratis at github End diff --git a/W/paypal_reply/paypal_build_invoices b/W/paypal_reply/paypal_build_invoices index 85fa826..19111f3 100755 --- a/W/paypal_reply/paypal_build_invoices +++ b/W/paypal_reply/paypal_build_invoices @@ -1,6 +1,6 @@ #!/bin/sh -# $Id: paypal_build_invoices,v 1.53 2013/06/10 14:33:30 gilles Exp gilles $ +# $Id: paypal_build_invoices,v 1.54 2013/07/28 04:19:32 gilles Exp gilles $ # usage: sh paypal_build_invoices /g/var/paypal_invoices/???? @@ -38,7 +38,8 @@ cp /home/gilles/public_html/AGIL/factures/000/facture_imapsync-000.tex /g/var/pa #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2451 /g/paypal/paypal_2013_03_complet.csv #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2519 /g/paypal/paypal_2013_04_complet.csv #/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2572 /g/paypal/paypal_2013_05_complet.csv -/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2627 /g/paypal/paypal_2013_06_complet.csv +#/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2627 /g/paypal/paypal_2013_06_complet.csv +/g/public_html/imapsync/W/paypal_reply/paypal_bilan --write_invoices --first_in 2682 /g/paypal/paypal_2013_07_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 147 /g/paypal/paypal_2010_11_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 214 /g/paypal/paypal_2010_12_complet.csv @@ -71,9 +72,10 @@ cp /home/gilles/public_html/AGIL/factures/000/facture_imapsync-000.tex /g/var/pa : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2451 /g/paypal/paypal_2013_03_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2519 /g/paypal/paypal_2013_04_complet.csv : /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2572 /g/paypal/paypal_2013_05_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2627 /g/paypal/paypal_2013_06_complet.csv set -x -: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2627 /g/paypal/paypal_2013_06_complet.csv +: /g/public_html/imapsync/W/paypal_reply/paypal_bilan --first_in 2682 /g/paypal/paypal_2013_07_complet.csv set +x # La totale @@ -89,12 +91,12 @@ set -v set +v # 2012 -echo 2012 -set -v +#echo 2012 +#set -v : /g/public_html/imapsync/W/paypal_reply/paypal_bilan \ --first_in 1335 --usdeur 1.2952 --bnc --avoid_numbers '292 293 643 644 731 732 1093 1330 1331 1332 1333 1334 1652 1653 2131 2132 2295 2296 2297 2298' \ /g/paypal/paypal_2012_??_complet.csv -set +v +#set +v echo 'sh paypal_build_invoices /g/var/paypal_invoices/2???' diff --git a/W/test3.bat b/W/test3.bat index d434ebf..9e9adf9 100644 --- a/W/test3.bat +++ b/W/test3.bat @@ -2,7 +2,17 @@ cd C:\msys\1.0\home\Admin\imapsync -.\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --justconnect +perl imapsync --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --folder INBOX +REM .\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --justconnect +REM PAUSE +REM cmail.cmich.edu has address 207.75.116.61 + +REM imapsync.exe --host1 cmail.cmich.edu --ssl1 --ssl1_SSL_version SSLv3 ^ +REM --host2 cmail.cmich.edu --ssl2 --ssl2_SSL_version SSLv3 ^ +REM --justconnect + +PAUSE + REM .\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2 --folder INBOX REM .\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2 --folder INBOX --usecache diff --git a/W/test3_gmail.bat b/W/test3_gmail.bat index 99e1bef..8f07c20 100644 --- a/W/test3_gmail.bat +++ b/W/test3_gmail.bat @@ -1,5 +1,5 @@ -REM $Id: test3.bat,v 1.2 2013/05/22 10:09:27 gilles Exp gilles $ +REM $Id: test3_gmail.bat,v 1.1 2013/07/23 13:29:56 gilles Exp gilles $ cd /D %~dp0 diff --git a/W/test_exe.bat b/W/test_exe.bat index 45d960f..f7ea611 100644 --- a/W/test_exe.bat +++ b/W/test_exe.bat @@ -5,6 +5,8 @@ perl -mMail::IMAPClient -mDigest::MD5 -mTerm::ReadKey -mIO::Socket::SSL -mFile:: .\imapsync.exe .\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --justconnect +.\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl1_SSL_version SSLv3 --ssl2 --justconnect +.\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl1_SSL_version SSLv3 --ssl2 --justlogin .\imapsync.exe --host1 p --user1 toto --passfile1 secret.toto --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2 .\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2 --folder INBOX .\imapsync.exe --host1 p --user1 tata --passfile1 secret.tata --host2 p --user2 titi --passfile2 secret.titi --ssl1 --ssl2 --delete2 --folder INBOX --usecache diff --git a/build_exe.bat b/build_exe.bat index bacbd4f..8569da0 100644 --- a/build_exe.bat +++ b/build_exe.bat @@ -1,13 +1,13 @@ -REM $Id: build_exe.bat,v 1.18 2013/07/23 11:27:50 gilles Exp gilles $ +REM $Id: build_exe.bat,v 1.19 2013/08/03 12:42:36 gilles Exp gilles $ @ECHO OFF ECHO Building imapsync.exe -CALL .\examples\install_modules.bat - cd /D %~dp0 +CALL .\examples\install_modules.bat + perl -mMail::IMAPClient -mIO::Socket -mIO::Socket::SSL -mIO::Socket::IP ^ -mDigest::MD5 -mDigest::HMAC_MD5 -mDigest::HMAC_SHA1 ^ -mTerm::ReadKey -mFile::Spec -mAuthen::NTLM ^ diff --git a/examples/install_modules.bat b/examples/install_modules.bat index 9a432f8..3f8d055 100644 --- a/examples/install_modules.bat +++ b/examples/install_modules.bat @@ -1,5 +1,5 @@ -REM $Id: install_modules.bat,v 1.6 2013/07/23 11:30:58 gilles Exp gilles $ +REM $Id: install_modules.bat,v 1.7 2013/08/03 02:19:58 gilles Exp gilles $ @ECHO OFF @@ -12,8 +12,9 @@ IF ERRORLEVEL 1 ECHO Perl needed. Install Strawberry Perl. Get it at http://stra REM perl is there -FOR %%M in ( IO::Socket IO::Socket::IP ^ - Net::SSLeay IO::Socket::SSL ^ +FOR %%M in ( IO::Socket::INET IO::Socket::INET6 IO::Socket::IP ^ + Net::SSLeay ^ + Crypt::SSLeay Net::SSL IO::Socket::SSL ^ Digest::MD5 Digest::HMAC_MD5 ^ Term::ReadKey File::Spec ^ Time::HiRes ^ @@ -21,8 +22,11 @@ FOR %%M in ( IO::Socket IO::Socket::IP ^ Authen::NTLM ^ Time::Local ^ Mail::IMAPClient ^ - PAR::Packer ) DO ECHO Testing %%M ^ - & perl -m%%M -e "" || perl -MCPAN -e "install %%M" + Getopt::ArgvFile Module::ScanDeps ^ + PAR::Packer ) DO ECHO Updating %%M ^ + & perl -MCPAN -e "install %%M" + +REM & perl -m%%M -e "" || perl -MCPAN -e "install %%M" ECHO Perl modules for imapsync installed diff --git a/imapsync b/imapsync index a218a35..4c8a44b 100755 --- a/imapsync +++ b/imapsync @@ -22,7 +22,7 @@ Synchronises mailboxes between two imap servers. Good at IMAP migration. More than 52 different IMAP server softwares supported with success, few failures. -$Revision: 1.555 $ +$Revision: 1.558 $ =head1 SYNOPSIS @@ -534,7 +534,7 @@ Entries for imapsync: Feedback (good or bad) will often be welcome. -$Id: imapsync,v 1.555 2013/07/23 11:41:10 gilles Exp gilles $ +$Id: imapsync,v 1.558 2013/08/03 01:13:37 gilles Exp gilles $ =cut @@ -626,7 +626,8 @@ my( $timeout, $timestart, $timestart_int, $timeend, $timebefore, - $ssl1, $ssl2, + $ssl1, $ssl2, + $ssl1_SSL_version, $ssl2_SSL_version, $tls1, $tls2, $uid1, $uid2, $authuser1, $authuser2, @@ -660,7 +661,7 @@ my( # global variables initialisation -$rcs = '$Id: imapsync,v 1.555 2013/07/23 11:41:10 gilles Exp gilles $ '; +$rcs = '$Id: imapsync,v 1.558 2013/08/03 01:13:37 gilles Exp gilles $ '; $total_bytes_transferred = 0; $total_bytes_skipped = 0; @@ -972,13 +973,13 @@ $debugimap1 and print "Host1 connection\n"; $imap1 = login_imap($host1, $port1, $user1, $domain1, $password1, $debugimap1, $timeout, $fastio1, $ssl1, $tls1, $authmech1, $authuser1, $reconnectretry1, - $proxyauth1, $uid1, $split1, 'Host1'); + $proxyauth1, $uid1, $split1, 'Host1', $ssl1_SSL_version ); $debugimap2 and print "Host2 connection\n"; $imap2 = login_imap($host2, $port2, $user2, $domain2, $password2, $debugimap2, $timeout, $fastio2, $ssl2, $tls2, $authmech2, $authuser2, $reconnectretry2, - $proxyauth2, $uid2, $split2, 'Host2'); + $proxyauth2, $uid2, $split2, 'Host2', $ssl2_SSL_version ); $debug and print "Host1 Buffer I/O: ", $imap1->Buffer(), "\n"; @@ -1911,9 +1912,9 @@ sub catch_continue { sub connect_imap { - my($host, $port, $mydebugimap, $ssl, $tls) = @_; + my( $host, $port, $mydebugimap, $ssl, $tls, $SSL_version ) = @_; my $imap = Mail::IMAPClient->new(); - $imap->Ssl($ssl) if ($ssl); + if ( $ssl ) { set_ssl( $imap, $ssl, $SSL_version ) } $imap->Tls($tls) if ($tls); $imap->Server($host); $imap->Port($port); @@ -1930,14 +1931,14 @@ sub connect_imap { sub justconnect { - $imap1 = connect_imap($host1, $port1, $debugimap1, $ssl1, $tls1); - print "Host1 software: ", server_banner($imap1); - print "Host1 capability: ", join(" ", $imap1->capability()), "\n"; - $imap2 = connect_imap($host2, $port2, $debugimap2, $ssl2, $tls2); - print "Host2 software: ", server_banner($imap2); - print "Host2 capability: ", join(" ", $imap2->capability()), "\n"; - $imap1->logout(); - $imap2->logout(); + $imap1 = connect_imap( $host1, $port1, $debugimap1, $ssl1, $tls1, $ssl1_SSL_version ) ; + print "Host1 software: ", server_banner( $imap1 ) ; + print "Host1 capability: ", join(" ", $imap1->capability( ) ), "\n" ; + $imap2 = connect_imap( $host2, $port2, $debugimap2, $ssl2, $tls2, $ssl2_SSL_version ) ; + print "Host2 software: ", server_banner( $imap2 ) ; + print "Host2 capability: ", join(" ", $imap2->capability( ) ), "\n" ; + $imap1->logout() ; + $imap2->logout() ; return( ) ; } @@ -1991,7 +1992,7 @@ sub login_imap { my($host, $port, $user, $domain, $password, $mydebugimap, $mytimeout, $fastio, $ssl, $tls, $authmech, $authuser, $reconnectretry, - $proxyauth, $uid, $split, $Side ) = @allargs ; + $proxyauth, $uid, $split, $Side, $SSL_version ) = @allargs ; my $side = lc( $Side ) ; my $imap = init_imap( @allargs ) ; @@ -2096,17 +2097,33 @@ sub check_capability { return( ) ; } +sub set_ssl { + my ( $imap, $ssl, $SSL_version ) = @_ ; + # SSL_version can be + # SSLv3 SSLv2 SSLv23 SSLv23:!SSLv2 (last one is the default in IO-Socket-SSL-1.953) + # + $SSL_version = $SSL_version || '' ; + #print "[$SSL_version]\n" ; + IO::Socket::SSL::set_ctx_defaults( + SSL_verify_mode => 'SSL_VERIFY_PEER', + SSL_verifycn_scheme => 'imap', + SSL_version => $SSL_version, + ) ; + $imap->Ssl( $ssl ) ; + return( ) ; +} + sub init_imap { my($host, $port, $user, $domain, $password, $mydebugimap, $mytimeout, $fastio, $ssl, $tls, $authmech, $authuser, $reconnectretry, - $proxyauth, $uid, $split ) = @_ ; + $proxyauth, $uid, $split, $Side, $SSL_version ) = @_ ; my ( $imap ) ; $imap = Mail::IMAPClient->new() ; - $imap->Ssl($ssl) if ($ssl); + if ( $ssl ) { set_ssl( $imap, $ssl, $SSL_version ) } $imap->Tls($tls) if ($tls); $imap->Clear(1); $imap->Server($host); @@ -2117,7 +2134,7 @@ sub init_imap { #$imap->Uid(0); $imap->Peek(1); $imap->Debug($mydebugimap); - $mytimeout and $imap->Timeout($mytimeout); + defined( $mytimeout ) and $imap->Timeout($mytimeout); $imap->Reconnectretry($reconnectretry) if ($reconnectretry); $imap->Ignoresizeerrors( $allowsizemismatch ) ; @@ -2221,8 +2238,8 @@ sub banner_imapsync { my @argv = @_ ; my $banner_imapsync = join("", '$RCSfile: imapsync,v $ ', - '$Revision: 1.555 $ ', - '$Date: 2013/07/23 11:41:10 $ ', + '$Revision: 1.558 $ ', + '$Date: 2013/08/03 01:13:37 $ ', "\n",localhost_info(), "\n", "Command line used:\n", "$0 ", command_line_nopassword( @argv ), "\n", @@ -4323,10 +4340,7 @@ sub load_modules { if ( $ssl1 or $ssl2 or $tls1 or $tls2 ) { require IO::Socket::SSL ; - #$IO::Socket::SSL::DEBUG = 3 ; - IO::Socket::SSL::set_ctx_defaults( - SSL_verify_mode => 0, - ); + #$IO::Socket::SSL::DEBUG = 4 ; } require Term::ReadKey if ( @@ -4530,7 +4544,7 @@ sub check_last_release { } sub imapsync_version { - my $rcs_imapsync = '$Id: imapsync,v 1.555 2013/07/23 11:41:10 gilles Exp gilles $ ' ; + my $rcs_imapsync = '$Id: imapsync,v 1.558 2013/08/03 01:13:37 gilles Exp gilles $ ' ; my $imapsync_version ; if ( $rcs_imapsync =~ m{,v\s+(\d+\.\d+)}xo ) { @@ -5235,7 +5249,7 @@ sub max_line_length { my $string = shift ; my $max = 0 ; my $i ; - while ( $string =~ m/([^\n]*(?:\n|\E))/msxg ) { + while ( $string =~ m/([^\n]*\n?)/msxg ) { $max = max( $max, length( $1 ) ) ; #++$i ; #print "max $max $i\n" ; @@ -5602,6 +5616,8 @@ sub get_options { "fastio2!" => \$fastio2, "ssl1!" => \$ssl1, "ssl2!" => \$ssl2, + "ssl1_SSL_version=s" => \$ssl1_SSL_version, + "ssl2_SSL_version=s" => \$ssl2_SSL_version, "tls1!" => \$tls1, "tls2!" => \$tls2, "uid1!" => \$uid1, diff --git a/index.shtml b/index.shtml index f7d0bb8..3ab01a4 100644 --- a/index.shtml +++ b/index.shtml @@ -5,7 +5,7 @@