1
0
mirror of https://github.com/imapsync/imapsync.git synced 2024-11-16 15:52:47 +01:00
This commit is contained in:
Nick Bebout 2011-03-12 02:43:48 +00:00
parent d13a862f19
commit 5fd1a57d36
9 changed files with 155 additions and 31 deletions

View File

@ -1,4 +1,4 @@
Eric Yung (Suggested --sep1 option)
Eric Yung (Suggested --sep1 option) and tested it, and found a bug about it.

View File

@ -1,15 +1,30 @@
RCS file: RCS/imapsync,v
Working file: imapsync
head: 1.44
head: 1.47
branch:
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 44; selected revisions: 44
total revisions: 47; selected revisions: 47
description:
----------------------------
revision 1.47
date: 2003/11/21 03:15:31; author: gilles; state: Exp; lines: +19 -4
Added a SECURITY pod doc section.
----------------------------
revision 1.46
date: 2003/11/21 02:52:37; author: gilles; state: Exp; lines: +6 -4
Documented --subscribed option in usage()
Add GPL link
----------------------------
revision 1.45
date: 2003/11/21 02:42:49; author: gilles; state: Exp; lines: +28 -8
Added usage of sysexists constants.
Exit in error if a problem occurs with options.
Added --subscribed option
----------------------------
revision 1.44
date: 2003/11/11 18:01:49; author: gilles; state: Exp; lines: +5 -5
Fixed get_separator call bug for "to" server.

19
INSTALL
View File

@ -1,4 +1,4 @@
# $Id: INSTALL,v 1.4 2003/05/05 22:42:51 gilles Exp $
# $Id: INSTALL,v 1.6 2003/11/21 03:13:52 gilles Exp gilles $
#
# INSTALL file for ftpsync
@ -15,9 +15,21 @@ You need :
- Perl
try : perl -v
- Mail::IMAPClient module
try : perl -mMail::IMAPClient -e ''
Get Perl here:
http://www.perl.org/
- Perl Mail::IMAPClient module
try : perl -mMail::IMAPClient -e ''
Get the Mail::IMAPClient module here:
http://search.cpan.org/
http://search.cpan.org/~djkernen/
http://search.cpan.org/~djkernen/Mail-IMAPClient-2.2.9/
In fact I use Mail-IMAPClient-2.1.4
To know the version you have on your system try :
perl -mMail::IMAPClient -e 'print $Mail::IMAPClient::VERSION, "\n"'
INSTALLING
----------
@ -34,6 +46,7 @@ or copy the file imapsync where you want it to be.
TESTING
-------
The test will break as they are home specific.
You need a running imap server on localhost with two accounts
toto@est.belle with a password located in the file /var/tmp/secret1
titi@est.belle with a password located in the file /var/tmp/secret2

16
README
View File

@ -1,7 +1,7 @@
NAME
imapsync - synchronize mailboxes between two imap servers.
$Revision: 1.44 $
$Revision: 1.47 $
INSTALL
Get imapsync at http://www.linux-france.org/prj/imapsync/dist/
@ -25,6 +25,7 @@ SYNOPSIS
[--sep2 <char>]
[--syncinternaldate]
[--delete] [--expunge]
[--subscribed]
[--dry]
[--debug] [--debugimap]
[--version] [--help]
@ -77,6 +78,17 @@ EXAMPLES
Then, you will have buddy's mailbox updated from max's mailbox.
SECURITY
You can use --password1 instead of --passfile1 to give the password but
it is dangerous because any user on your host can see the password by
using the 'ps auxwwww' command. Using a variable (like $PASSWORD1) is
also dangerous because of the 'ps auxwwwwe' command. So, saving the
password in a well protected file (600 or rw-------) is the best
solution.
imasync is not protected against sniffers on the network so the
passwords are in plain text.
EXIT STATUS
imapsync will exit with a 0 status (return code) if everything went
good. Otherwise, it exits with a non-zero status.
@ -136,5 +148,5 @@ SIMILAR SOFTWARES
Feedback (good or bad) will be always welcome.
$Id: imapsync,v 1.44 2003/11/11 18:01:49 gilles Exp $
$Id: imapsync,v 1.47 2003/11/21 03:15:31 gilles Exp $

14
TODO
View File

@ -5,15 +5,16 @@ Add SASL support MD5 : DIGEST-MD5 and CRAM-MD5
see authenticate in IMAPClient.pm
Test the new Mail::IMAPClient (2.1.4 -> 2.2.8 or sup)
Update the list of tested IMAP servers (successes and failures).
Add a CREDITS file.
Pb if "to separator" is in "from folder" name.
Have to choose a caracter != to separator and
not in from folders.
DONE. Pb with namespace INBOX.
DONE. Add a --subscribed option.
DONE. Add a CREDITS file.
DONE. Pb with namespace INBOX. Some IMAP servers
don't have this CAPABILITY
http://www.inter7.com/courierimap/FAQ.html#namespace
http://www.rfc-editor.org/rfc/rfc2342.txt
@ -21,3 +22,6 @@ DONE. Pb with date
DONE. Pb with \Recent flag
DONE. Add the list of tested IMAP servers (successes and failures).

View File

@ -1 +1 @@
1.44
1.47

View File

@ -4,7 +4,7 @@
imapsync - synchronize mailboxes between two imap servers.
$Revision: 1.44 $
$Revision: 1.47 $
=head1 INSTALL
@ -30,6 +30,7 @@ $Revision: 1.44 $
[--sep2 <char>]
[--syncinternaldate]
[--delete] [--expunge]
[--subscribed]
[--dry]
[--debug] [--debugimap]
[--version] [--help]
@ -91,6 +92,20 @@ in too files "/etc/secret1" for "buddy", "/etc/secret2" for "max") :
Then, you will have buddy's mailbox updated from max's mailbox.
=head1 SECURITY
You can use --password1 instead of --passfile1 to give the
password but it is dangerous because any user on your host
can see the password by using the 'ps auxwwww'
command. Using a variable (like $PASSWORD1) is also
dangerous because of the 'ps auxwwwwe' command. So, saving
the password in a well protected file (600 or rw-------) is
the best solution.
imasync is not protected against sniffers on the network so
the passwords are in plain text.
=head1 EXIT STATUS
imapsync will exit with a 0 status (return code) if everything went good.
@ -157,7 +172,7 @@ Rate imapsync : http://freshmeat.net/projects/imapsync/
Feedback (good or bad) will be always welcome.
$Id: imapsync,v 1.44 2003/11/11 18:01:49 gilles Exp $
$Id: imapsync,v 1.47 2003/11/21 03:15:31 gilles Exp $
=cut
@ -168,6 +183,9 @@ use Getopt::Long;
use Mail::IMAPClient;
use Digest::MD5 qw(md5_base64);
eval { require 'usr/include/sysexits.ph' };
my(
$rcs, $debug, $debugimap, $error,
$host1, $host2, $port1, $port2,
@ -175,20 +193,24 @@ my(
@folder, $prefix2,
$sep1, $sep2,
$syncinternaldates,
$delete, $expunge, $dry,
$delete, $expunge, $dry, $subscribed,
$version, $VERSION, $help,
);
use vars qw ($opt_G); # missing code for this will be option.
$rcs = ' $Id: imapsync,v 1.44 2003/11/11 18:01:49 gilles Exp $ ';
$rcs = ' $Id: imapsync,v 1.47 2003/11/21 03:15:31 gilles Exp $ ';
$rcs =~ m/,v (\d+\.\d+)/;
$VERSION = ($1) ? $1 : "UNKNOWN";
$error=0;
my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.44 $ ' . '$Date: 2003/11/11 18:01:49 $ ' . "\n";
my $banner = '$RCSfile: imapsync,v $ ' . '$Revision: 1.47 $ ' . '$Date: 2003/11/21 03:15:31 $ ' . "\n";
unless(defined(&_SYSEXITS_H)) {
# 64 on my linux box.
eval 'sub EX_USAGE () {64;}' unless defined(&EX_USAGE);
}
get_options();
print $banner;
@ -248,7 +270,19 @@ print "From capability : ", join(" ", $from->capability()), "\n";
print "To capability : ", join(" ", $to->capability()), "\n";
my (@f_folders, @t_folders);
@f_folders = (scalar(@folder)) ? @folder : @{$from->folders()};
#@f_folders = (scalar(@folder)) ? @folder : @{$from->folders()};
if (scalar(@folder)) {
# folders given by option --folder
@f_folders = @folder;
}elsif ($subscribed) {
# option --subscribed
@f_folders = $from->subscribed();
}else {
# no option, all folders
@f_folders = $from->folders()
}
my($f_sep,$t_sep);
# what are the private folders separators for each server ?
@ -279,7 +313,7 @@ print "To separator : [$t_sep]\n";
# needed for setting flags
my $tohasuidplus = $to->has_capability("UIDPLUS");
# my $tohasuidplus = $to->has_capability("UIDPLUS");
@t_folders = @{$to->folders()};
@ -471,6 +505,7 @@ sub get_options
"syncinternaldates!" => \$syncinternaldates,
"dry!" => \$dry,
"expunge!" => \$expunge,
"subscribed!" => \$subscribed,
"version" => \$version,
"help" => \$help,
);
@ -478,7 +513,7 @@ sub get_options
$debug and print "get options: [$opt_ret]\n";
print "$VERSION\n" and exit if ($version) ;
usage() and exit if ($help or ! $numopt) ;
exit unless ($opt_ret) ;
exit(EX_USAGE()) unless ($opt_ret) ;
}
@ -555,6 +590,7 @@ Several options are mandatory.
expunge delete messages marked deleted.
--syncinternaldates : set the internal dates on host2 same as host1
--dry : do nothing, just print what would be done.
--subscribed : transfer only subscribed folders.
--debug : debug mode.
--debugimap : imap debug mode.
--version : print sotfware version.
@ -570,5 +606,6 @@ $0 \\
$rcs
imapsync copyleft is the GNU General Public License.
See http://www.gnu.org/copyleft/gpl.html
EOF
}

20
learn/memo Normal file
View File

@ -0,0 +1,20 @@
loul Cyrus
==========
vi /var/lib/cyrus/mailboxes
ls /var/spool/cyrus/mail/user/tata/
plume courier
=============
vi /etc/courier/userdb
ls -a /home/vmail/tata/

View File

@ -1,8 +1,13 @@
#!/bin/sh
# $Id: tests.sh,v 1.9 2003/10/20 22:53:29 gilles Exp $
# $Id: tests.sh,v 1.10 2003/11/21 03:20:14 gilles Exp $
# $Log: tests.sh,v $
# Revision 1.10 2003/11/21 03:20:14 gilles
# Renamed lp_folder_qqq() pl_folder_qqq()
# Removed --prefix2 INBOX. in pl_folder_qqq()
# Added lp_subscribed() test.
#
# Revision 1.9 2003/10/20 22:53:29 gilles
# Added lp_internaldate()
#
@ -138,16 +143,17 @@ lp_folder() {
fi
}
lp_folder_qqq() {
pl_folder_qqq() {
if test X`hostname` = X"plume"; then
echo3 Here is plume
./imapsync \
--host2 plume --user2 tata@est.belle \
--passfile2 /var/tmp/secret.tata \
--host1 plume --user1 tata@est.belle \
--passfile1 /var/tmp/secret.tata \
--folder INBOX.qqq \
--prefix2 INBOX. \
--host1 loul --user1 tata \
--passfile1 /var/tmp/secret.tata
--prefix2 "" \
--host2 loul --user2 tata \
--passfile2 /var/tmp/secret.tata
else
:
fi
@ -186,7 +192,23 @@ pl_folder() {
fi
}
lp_subscribed()
{
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 \
--subscribed
else
:
fi
}
@ -203,8 +225,9 @@ test $# -eq 0 && run_tests \
plumeloul \
lp_folder \
pl_folder \
lp_folder_qqq \
lp_internaldate
pl_folder_qqq \
lp_internaldate \
lp_subscribed
# selective tests