Merge branch 'isync_1_2_branch'
This commit is contained in:
commit
7ddd8d1737
15
README
15
README
|
@ -14,11 +14,13 @@ currently Maildir and IMAP4 mailboxes are supported. New messages, message
|
||||||
deletions and flag changes can be propagated both ways.
|
deletions and flag changes can be propagated both ways.
|
||||||
``mbsync'' is suitable for use in IMAP-disconnected mode.
|
``mbsync'' is suitable for use in IMAP-disconnected mode.
|
||||||
|
|
||||||
Synchronization is based on unique message identifiers (UIDs), so no
|
Synchronization is based on unique message identifiers (UIDs), so
|
||||||
identification conflicts can occur (as opposed to some other mail
|
no identification conflicts can occur (unlike with some other mail
|
||||||
synchronizers).
|
synchronizers).
|
||||||
Synchronization state is kept in one local text file per mailbox pair;
|
Synchronization state is kept in one local text file per mailbox pair;
|
||||||
multiple replicas of a mailbox can be maintained.
|
these files are protected against concurrent ``mbsync'' processes.
|
||||||
|
Mailboxes can be safely modified while ``mbsync'' operates.
|
||||||
|
Multiple replicas of each mailbox can be maintained.
|
||||||
|
|
||||||
isync is the project name, while mbsync is the current executable name; this
|
isync is the project name, while mbsync is the current executable name; this
|
||||||
change was necessary because of massive changes in the user interface. An
|
change was necessary because of massive changes in the user interface. An
|
||||||
|
@ -31,9 +33,8 @@ isync executable still exists; it is a compatibility wrapper around mbsync.
|
||||||
* Partial mirrors possible: keep only the latest messages locally
|
* Partial mirrors possible: keep only the latest messages locally
|
||||||
* Trash functionality: backup messages before removing them
|
* Trash functionality: backup messages before removing them
|
||||||
* IMAP features:
|
* IMAP features:
|
||||||
* Supports TLS/SSL via imaps: (port 993) and STARTTLS (RFC2595)
|
* Supports TLS/SSL via imaps: (port 993) and STARTTLS
|
||||||
* Supports SASL (RFC4422) for authentication
|
* Supports SASL for authentication
|
||||||
* Supports NAMESPACE (RFC2342) for simplified configuration
|
|
||||||
* Pipelining for maximum speed
|
* Pipelining for maximum speed
|
||||||
|
|
||||||
* Compatibility
|
* Compatibility
|
||||||
|
@ -66,6 +67,8 @@ isync executable still exists; it is a compatibility wrapper around mbsync.
|
||||||
|
|
||||||
Berkeley DB 4.1+ (optional)
|
Berkeley DB 4.1+ (optional)
|
||||||
OpenSSL for TLS/SSL support (optional)
|
OpenSSL for TLS/SSL support (optional)
|
||||||
|
Cyrus SASL (optional)
|
||||||
|
zlib (optional)
|
||||||
|
|
||||||
* Installation
|
* Installation
|
||||||
|
|
||||||
|
|
12
configure.ac
12
configure.ac
|
@ -36,10 +36,10 @@ AC_CHECK_LIB(nsl, inet_ntoa, [SOCK_LIBS="$SOCK_LIBS -lnsl"])
|
||||||
AC_SUBST(SOCK_LIBS)
|
AC_SUBST(SOCK_LIBS)
|
||||||
|
|
||||||
have_ipv6=true
|
have_ipv6=true
|
||||||
sav_LDFLAGS=$LDFLAGS
|
sav_LIBS=$LIBS
|
||||||
LDFLAGS="$LDFLAGS $SOCK_LIBS"
|
LIBS="$LIBS $SOCK_LIBS"
|
||||||
AC_CHECK_FUNCS(getaddrinfo inet_ntop, , [have_ipv6=false])
|
AC_CHECK_FUNCS(getaddrinfo inet_ntop, , [have_ipv6=false])
|
||||||
LDFLAGS=$sav_LDFLAGS
|
LIBS=$sav_LIBS
|
||||||
if $have_ipv6; then
|
if $have_ipv6; then
|
||||||
AC_DEFINE(HAVE_IPV6, 1, [if your libc has IPv6 support])
|
AC_DEFINE(HAVE_IPV6, 1, [if your libc has IPv6 support])
|
||||||
fi
|
fi
|
||||||
|
@ -141,15 +141,15 @@ AC_SUBST(SASL_LIBS)
|
||||||
|
|
||||||
AC_CACHE_CHECK([for Berkeley DB >= 4.1], ac_cv_berkdb4,
|
AC_CACHE_CHECK([for Berkeley DB >= 4.1], ac_cv_berkdb4,
|
||||||
[ac_cv_berkdb4=no
|
[ac_cv_berkdb4=no
|
||||||
sav_LDFLAGS=$LDFLAGS
|
sav_LIBS=$LIBS
|
||||||
LDFLAGS="$LDFLAGS -ldb"
|
LIBS="$LIBS -ldb"
|
||||||
AC_TRY_LINK([#include <db.h>],
|
AC_TRY_LINK([#include <db.h>],
|
||||||
[DB *db;
|
[DB *db;
|
||||||
db_create(&db, 0, 0);
|
db_create(&db, 0, 0);
|
||||||
db->truncate(db, 0, 0, 0);
|
db->truncate(db, 0, 0, 0);
|
||||||
db->open(db, 0, "foo", "foo", DB_HASH, DB_CREATE, 0)],
|
db->open(db, 0, "foo", "foo", DB_HASH, DB_CREATE, 0)],
|
||||||
[ac_cv_berkdb4=yes])
|
[ac_cv_berkdb4=yes])
|
||||||
LDFLAGS=$sav_LDFLAGS
|
LIBS=$sav_LIBS
|
||||||
])
|
])
|
||||||
if test "x$ac_cv_berkdb4" = xyes; then
|
if test "x$ac_cv_berkdb4" = xyes; then
|
||||||
AC_SUBST([DB_LIBS], ["-ldb"])
|
AC_SUBST([DB_LIBS], ["-ldb"])
|
||||||
|
|
|
@ -116,6 +116,7 @@ void *memrchr( const void *s, int c, size_t n );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int starts_with( const char *str, int strl, const char *cmp, int cmpl );
|
int starts_with( const char *str, int strl, const char *cmp, int cmpl );
|
||||||
|
int starts_with_upper( const char *str, int strl, const char *cmp, int cmpl );
|
||||||
int equals( const char *str, int strl, const char *cmp, int cmpl );
|
int equals( const char *str, int strl, const char *cmp, int cmpl );
|
||||||
|
|
||||||
#ifndef HAVE_TIMEGM
|
#ifndef HAVE_TIMEGM
|
||||||
|
|
|
@ -259,7 +259,12 @@ established with the IMAP server. (Default: \fIyes\fR)
|
||||||
..
|
..
|
||||||
.TP
|
.TP
|
||||||
\fBCertificateFile\fR \fIpath\fR
|
\fBCertificateFile\fR \fIpath\fR
|
||||||
File containing X.509 CA certificates used to verify server identities.
|
File containing additional X.509 certificates used to verify server
|
||||||
|
identities. Directly matched peer certificates are always trusted,
|
||||||
|
regardless of validity.
|
||||||
|
.br
|
||||||
|
Note that the system's default certificate store is always used
|
||||||
|
and should not be specified here.
|
||||||
..
|
..
|
||||||
.TP
|
.TP
|
||||||
\fBUseSSLv2\fR \fIyes\fR|\fIno\fR
|
\fBUseSSLv2\fR \fIyes\fR|\fIno\fR
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# doesn't specify it.
|
# doesn't specify it.
|
||||||
|
|
||||||
# SSL server certificate file
|
# SSL server certificate file
|
||||||
CertificateFile /etc/ssl/certs/ca-certificates.crt
|
CertificateFile ~/.isync.certs
|
||||||
|
|
||||||
# by default, expunge deleted messages (same as -e on command line)
|
# by default, expunge deleted messages (same as -e on command line)
|
||||||
Expunge yes
|
Expunge yes
|
||||||
|
|
|
@ -971,7 +971,7 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED )
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
if (!is_atom( tmp ))
|
if (!is_atom( tmp ))
|
||||||
goto bfail;
|
goto bfail;
|
||||||
if (starts_with( tmp->val, tmp->len, "X-TUID: ", 8 ))
|
if (starts_with_upper( tmp->val, tmp->len, "X-TUID: ", 8 ))
|
||||||
tuid = tmp->val + 8;
|
tuid = tmp->val + 8;
|
||||||
} else {
|
} else {
|
||||||
bfail:
|
bfail:
|
||||||
|
|
|
@ -33,15 +33,10 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <sys/file.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <utime.h>
|
#include <utime.h>
|
||||||
|
|
||||||
#ifdef __linux__
|
|
||||||
# define LEGACY_FLOCK 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(_POSIX_SYNCHRONIZED_IO) || _POSIX_SYNCHRONIZED_IO <= 0
|
#if !defined(_POSIX_SYNCHRONIZED_IO) || _POSIX_SYNCHRONIZED_IO <= 0
|
||||||
# define fdatasync fsync
|
# define fdatasync fsync
|
||||||
#endif
|
#endif
|
||||||
|
@ -621,13 +616,6 @@ maildir_uidval_lock( maildir_store_t *ctx )
|
||||||
/* The unlock timer is active, so we are obviously already locked. */
|
/* The unlock timer is active, so we are obviously already locked. */
|
||||||
return DRV_OK;
|
return DRV_OK;
|
||||||
}
|
}
|
||||||
#ifdef LEGACY_FLOCK
|
|
||||||
/* This is legacy only */
|
|
||||||
if (flock( ctx->uvfd, LOCK_EX ) < 0) {
|
|
||||||
error( "Maildir error: cannot flock UIDVALIDITY.\n" );
|
|
||||||
return DRV_BOX_BAD;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
/* This (theoretically) works over NFS. Let's hope nobody else did
|
/* This (theoretically) works over NFS. Let's hope nobody else did
|
||||||
the same in the opposite order, as we'd deadlock then. */
|
the same in the opposite order, as we'd deadlock then. */
|
||||||
#if SEEK_SET != 0
|
#if SEEK_SET != 0
|
||||||
|
@ -699,10 +687,6 @@ maildir_uidval_unlock( maildir_store_t *ctx )
|
||||||
#endif /* USE_DB */
|
#endif /* USE_DB */
|
||||||
lck.l_type = F_UNLCK;
|
lck.l_type = F_UNLCK;
|
||||||
fcntl( ctx->uvfd, F_SETLK, &lck );
|
fcntl( ctx->uvfd, F_SETLK, &lck );
|
||||||
#ifdef LEGACY_FLOCK
|
|
||||||
/* This is legacy only */
|
|
||||||
flock( ctx->uvfd, LOCK_UN );
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -35,11 +35,14 @@ New messages, message deletions and flag changes can be propagated both ways;
|
||||||
the operation set can be selected in a fine-grained manner.
|
the operation set can be selected in a fine-grained manner.
|
||||||
.br
|
.br
|
||||||
Synchronization is based on unique message identifiers (UIDs), so no
|
Synchronization is based on unique message identifiers (UIDs), so no
|
||||||
identification conflicts can occur (as opposed to some other mail synchronizers).
|
identification conflicts can occur (unlike with some other mail synchronizers).
|
||||||
OTOH, \fBmbsync\fR is susceptible to UID validity changes (that \fIshould\fR
|
OTOH, \fBmbsync\fR is susceptible to UID validity changes (that \fIshould\fR
|
||||||
never happen, but see "Compatibility" in the README).
|
never happen, but see "Compatibility" in the README).
|
||||||
Synchronization state is kept in one local text file per mailbox pair;
|
Synchronization state is kept in one local text file per mailbox pair;
|
||||||
multiple replicas of a mailbox can be maintained.
|
these files are protected against concurrent \fBmbsync\fR processes.
|
||||||
|
Mailboxes can be safely modified while \fBmbsync\fR operates
|
||||||
|
(see \fBINHERENT PROBLEMS\fR below for a minor exception).
|
||||||
|
Multiple replicas of each mailbox can be maintained.
|
||||||
..
|
..
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
.TP
|
.TP
|
||||||
|
|
|
@ -26,7 +26,6 @@ Pass xxxxxxxx
|
||||||
# "Account Name" USERNAME
|
# "Account Name" USERNAME
|
||||||
# "Password" PASSWORD
|
# "Password" PASSWORD
|
||||||
#PassCmd "/usr/bin/security find-internet-password -w -a USERNAME -s IMAPSERVER ~/Library/Keychains/login.keychain"
|
#PassCmd "/usr/bin/security find-internet-password -w -a USERNAME -s IMAPSERVER ~/Library/Keychains/login.keychain"
|
||||||
CertificateFile /etc/ssl/certs/ca-certificates.crt
|
|
||||||
|
|
||||||
Channel work
|
Channel work
|
||||||
Master :work:
|
Master :work:
|
||||||
|
|
|
@ -338,7 +338,7 @@ msg_fetched( int sts, void *aux )
|
||||||
if (c == '\r')
|
if (c == '\r')
|
||||||
lcrs++;
|
lcrs++;
|
||||||
else if (c == '\n') {
|
else if (c == '\n') {
|
||||||
if (starts_with( fmap + start, len - start, "X-TUID: ", 8 )) {
|
if (starts_with_upper( fmap + start, len - start, "X-TUID: ", 8 )) {
|
||||||
extra = (sbreak = start) - (ebreak = i);
|
extra = (sbreak = start) - (ebreak = i);
|
||||||
goto oke;
|
goto oke;
|
||||||
}
|
}
|
||||||
|
|
16
src/util.c
16
src/util.c
|
@ -27,6 +27,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
|
|
||||||
static int need_nl;
|
static int need_nl;
|
||||||
|
@ -241,6 +242,21 @@ starts_with( const char *str, int strl, const char *cmp, int cmpl )
|
||||||
return (strl >= cmpl) && !memcmp( str, cmp, cmpl );
|
return (strl >= cmpl) && !memcmp( str, cmp, cmpl );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
starts_with_upper( const char *str, int strl, const char *cmp, int cmpl )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (strl < 0)
|
||||||
|
strl = strnlen( str, cmpl + 1 );
|
||||||
|
if (strl < cmpl)
|
||||||
|
return 0;
|
||||||
|
for (i = 0; i < cmpl; i++)
|
||||||
|
if (str[i] != cmp[i] && toupper( str[i] ) != cmp[i])
|
||||||
|
return 0;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
equals( const char *str, int strl, const char *cmp, int cmpl )
|
equals( const char *str, int strl, const char *cmp, int cmpl )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user