[commit] master: ensure sequencing of message propagation and store closing

2013-12-11 Thread Oswald Buddenhagen
commit 5a21042e980a4697623eaf5614a1dad0e6fdee23
Author: Oswald Buddenhagen 
Date:   Wed Dec 11 16:25:30 2013 +0100

ensure sequencing of message propagation and store closing

by putting the message propagation last, d3f634702 uncovered a
long-standing problem: we might have closed the source store before all
messages were propagated from it.

 src/sync.c |   17 +++--
 1 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 94b3fb7..957188c 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -204,6 +204,7 @@ static int check_cancel( sync_vars_t *svars );
 #define ST_CANCELED(1<<9)
 #define ST_SELECTED(1<<10)
 #define ST_DID_EXPUNGE (1<<11)
+#define ST_CLOSING (1<<12)
 
 
 static void
@@ -1594,7 +1595,12 @@ msgs_copied( sync_vars_t *svars, int t )
if (!(svars->state[t] & ST_SENT_NEW) || svars->new_done[t] < 
svars->new_total[t])
return;
 
+   sync_ref( svars );
+
Fprintf( svars->jfp, "%c %d\n", ")("[t], svars->maxuid[1-t] );
+   sync_close( svars, 1-t );
+   if (check_cancel( svars ))
+   goto out;
 
if (svars->state[t] & ST_FIND_NEW) {
debug( "finding just copied messages on %s\n", str_ms[t] );
@@ -1602,6 +1608,9 @@ msgs_copied( sync_vars_t *svars, int t )
} else {
msgs_new_done( svars, t );
}
+
+  out:
+   sync_deref( svars );
 }
 
 static void
@@ -1775,9 +1784,13 @@ static void box_closed_p2( sync_vars_t *svars, int t );
 static void
 sync_close( sync_vars_t *svars, int t )
 {
-   if ((~svars->state[t] & (ST_FOUND_NEW|ST_SENT_TRASH)) ||
-   svars->trash_done[t] < svars->trash_total[t])
+   if ((~svars->state[t] & (ST_FOUND_NEW|ST_SENT_TRASH)) || 
svars->trash_done[t] < svars->trash_total[t] ||
+   !(svars->state[1-t] & ST_SENT_NEW) || svars->new_done[1-t] < 
svars->new_total[1-t])
+   return;
+
+   if (svars->state[t] & ST_CLOSING)
return;
+   svars->state[t] |= ST_CLOSING;
 
if ((svars->chan->ops[t] & OP_EXPUNGE) /*&& !(svars->state[t] & 
ST_TRASH_BAD)*/) {
debug( "expunging %s\n", str_ms[t] );

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] master: fix error paths wrt sync drivers, take 3

2013-12-11 Thread Oswald Buddenhagen
commit c47ee1c8c4bc1961cf7fd665326bfa05504ab0e7
Author: Oswald Buddenhagen 
Date:   Wed Dec 11 16:13:49 2013 +0100

fix error paths wrt sync drivers, take 3

msgs_copied() was not checked at all, and msgs_flags_set() was doing it
wrong (sync_close() was not checked).

instead of trying to fix/extend the msgs_flags_set() model (ref-counting
and cancelation checking in lower-level functions, and return values to
propagate the status), place the refs/derefs around higher-level scopes
and do the checking only there. this is effectively simpler, and does
away with some obscure macros.

 src/sync.c |   98 +---
 1 files changed, 47 insertions(+), 51 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index bc55911..94b3fb7 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -166,25 +166,9 @@ typedef struct {
 } sync_vars_t;
 
 static void sync_ref( sync_vars_t *svars ) { ++svars->ref_count; }
-static int sync_deref( sync_vars_t *svars );
-static int deref_check_cancel( sync_vars_t *svars );
+static void sync_deref( sync_vars_t *svars );
 static int check_cancel( sync_vars_t *svars );
 
-#define DRIVER_CALL_RET(call) \
-   do { \
-   sync_ref( svars ); \
-   svars->drv[t]->call; \
-   return deref_check_cancel( svars ); \
-   } while (0)
-
-#define DRIVER_CALL(call) \
-   do { \
-   sync_ref( svars ); \
-   svars->drv[t]->call; \
-   if (deref_check_cancel( svars )) \
-   return; \
-   } while (0)
-
 #define AUX &svars->t[t]
 #define INV_AUX &svars->t[1-t]
 #define DECL_SVARS \
@@ -282,7 +266,7 @@ typedef struct copy_vars {
 
 static void msg_fetched( int sts, void *aux );
 
-static int
+static void
 copy_msg( copy_vars_t *vars )
 {
DECL_INIT_SVARS(vars->aux);
@@ -290,7 +274,7 @@ copy_msg( copy_vars_t *vars )
t ^= 1;
vars->data.flags = vars->msg->flags;
vars->data.date = svars->chan->use_internal_date ? -1 : 0;
-   DRIVER_CALL_RET(fetch_msg( svars->ctx[t], vars->msg, &vars->data, 
msg_fetched, vars ));
+   svars->drv[t]->fetch_msg( svars->ctx[t], vars->msg, &vars->data, 
msg_fetched, vars );
 }
 
 static void msg_stored( int sts, int uid, void *aux );
@@ -534,14 +518,6 @@ store_bad( void *aux )
 }
 
 static int
-deref_check_cancel( sync_vars_t *svars )
-{
-   if (sync_deref( svars ))
-   return -1;
-   return check_cancel( svars );
-}
-
-static int
 check_cancel( sync_vars_t *svars )
 {
return (svars->state[M] | svars->state[S]) & (ST_SENT_CANCEL | 
ST_CANCELED);
@@ -640,13 +616,17 @@ sync_boxes( store_t *ctx[], const char *names[], 
channel_conf_t *chan,
}
/* Both boxes must be fully set up at this point, so that error exit 
paths
 * don't run into uninitialized variables. */
+   sync_ref( svars );
for (t = 0; t < 2; t++) {
info( "Selecting %s %s...\n", str_ms[t], ctx[t]->orig_name );
-   DRIVER_CALL(select( ctx[t], (chan->ops[t] & OP_CREATE) != 0, 
box_selected, AUX ));
+   svars->drv[t]->select( ctx[t], (chan->ops[t] & OP_CREATE) != 0, 
box_selected, AUX );
+   if (check_cancel( svars ))
+   break;
}
+   sync_deref( svars );
 }
 
-static int load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int 
nmexcs );
+static void load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int 
nmexcs );
 
 static void
 box_selected( int sts, void *aux )
@@ -1083,14 +1063,16 @@ box_selected( int sts, void *aux )
} else {
minwuid = INT_MAX;
}
-   if (load_box( svars, M, minwuid, mexcs, nmexcs ))
-   return;
-   load_box( svars, S, (ctx[S]->opts & OPEN_OLD) ? 1 : INT_MAX, 0, 0 );
+   sync_ref( svars );
+   load_box( svars, M, minwuid, mexcs, nmexcs );
+   if (!check_cancel( svars ))
+   load_box( svars, S, (ctx[S]->opts & OPEN_OLD) ? 1 : INT_MAX, 0, 
0 );
+   sync_deref( svars );
 }
 
 static void box_loaded( int sts, void *aux );
 
-static int
+static void
 load_box( sync_vars_t *svars, int t, int minwuid, int *mexcs, int nmexcs )
 {
sync_rec_t *srec;
@@ -1109,7 +1091,7 @@ load_box( sync_vars_t *svars, int t, int minwuid, int 
*mexcs, int nmexcs )
maxwuid = 0;
info( "Loading %s...\n", str_ms[t] );
debug( maxwuid == INT_MAX ? "loading %s [%d,inf]\n" : "loading %s 
[%d,%d]\n", str_ms[t], minwuid, maxwuid );
-   DRIVER_CALL_RET(load( svars->ctx[t], minwuid, maxwuid, 
svars->newuid[t], mexcs, nmexcs, box_loaded, AUX ));
+   svars->drv[t]->load( svars->ctx[t], minwuid, maxwuid, svars->newuid[t], 
mexcs, nmexcs, box_loaded, AUX );

[commit] master: MaxMessages: ignore entries with no master while calculating bulk fetch

2013-12-13 Thread Oswald Buddenhagen
commit 359091625daefccfa1a957dbfb7536376a4c56fc
Author: Oswald Buddenhagen 
Date:   Fri Dec 13 15:36:33 2013 +0100

MaxMessages: ignore entries with no master while calculating bulk fetch

 src/sync.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 4df172c..687911d 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -1018,7 +1018,7 @@ box_selected( int sts, void *aux )
/* First, find out the lower bound for the bulk fetch. 
*/
minwuid = INT_MAX;
for (srec = svars->srecs; srec; srec = srec->next) {
-   if (srec->status & S_DEAD)
+   if ((srec->status & S_DEAD) || srec->uid[M] <= 
0)
continue;
if (srec->status & S_EXPIRED) {
if (!srec->uid[S]) {

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] branch 'sasl' created

2013-12-13 Thread Oswald Buddenhagen
The branch 'sasl' has been created at 583bb75.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


ever seen unmotivated "duplicate UID" errors?

2013-12-15 Thread Oswald Buddenhagen
hello *,

from time to time, mbsync will throw a "duplicate UID" error for no
reason whatsoever. i tracked this down to readdir() apparently returning
the same entries multiple times, even for directories which were not
touched for months. i suspect a kernel bug, but maybe i'm just missing
some invalid assumption in my code. anyone has an idea?
>From b4d7e0d63dd83850f1db97082a1b12a2c5fb82ad Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen 
Date: Sat, 3 Aug 2013 09:36:31 +0200
Subject: [PATCH] *** work around readdir() sometimes returning the same
 entries multiple times

this appears to ever happen only on my ReiserFS partition at home. it's
not reproducible with "ls -U", mc, or any attempt at looping mbsync - it
happens from time to time when mbsync runs in the background during
regular operation.
---
 src/drv_maildir.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index b62848e..1eb50f5 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -764,6 +764,11 @@ maildir_scan( maildir_store_t *ctx, msglist_t *msglist )
 		qsort( msglist->ents, msglist->nents, sizeof(msg_t), maildir_compare );
 		for (uid = i = 0; i < msglist->nents; i++) {
 			entry = &msglist->ents[i];
+			/* ReiserFS bogosity hack. */
+			if (i && !strcmp( entry->base, msglist->ents[i-1].base )) {
+warn( "Maildir warning: duplicate directory entries. Retrying ...\n" );
+goto retry;
+			}
 			if (entry->uid != INT_MAX) {
 if (uid == entry->uid) {
 #if 1
-- 
1.8.4.3

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: [clarifications] needed

2013-12-15 Thread Oswald Buddenhagen
On Sat, Nov 16, 2013 at 10:55:17AM +0100, Oswald Buddenhagen wrote:
> actually, to support your mode of operation, a rather simple extension
> should be sufficient:
> 
> Master :remote:INBOX
> Master :local:Account1
> Patterns *
> 
this is implemented in master now.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] master: elaborate on expunging and trashing

2013-12-15 Thread Oswald Buddenhagen
commit 8b2bc912b462f8b6b7444616a42288a3bd36c5e4
Author: Oswald Buddenhagen 
Date:   Sat Dec 14 12:37:11 2013 +0100

elaborate on expunging and trashing

 src/mbsync.1 |   34 --
 1 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/src/mbsync.1 b/src/mbsync.1
index 11ec971..419d3f7 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -20,7 +20,7 @@
 \" As a special exception, mbsync may be linked with the OpenSSL library,
 \" despite that library's more restrictive license.
 ..
-.TH mbsync 1 "2013 Aug 3"
+.TH mbsync 1 "2013 Dec 14"
 ..
 .SH NAME
 mbsync - synchronize IMAP4 and Maildir mailboxes
@@ -167,7 +167,8 @@ under \fBPath\fR, including the "INBOX\fIdelim\fR" prefix.
 .TP
 \fBTrash\fR \fImailbox\fR
 Specifies a mailbox (relative to \fBPath\fR) to copy deleted messages to
-prior to expunging. See \fBINHERENT PROBLEMS\fR below.
+prior to expunging.
+See \fBRECOMMENDATIONS\fR and \fBINHERENT PROBLEMS\fR below.
 (Default: none)
 ..
 .TP
@@ -483,6 +484,7 @@ does not exist.
 .TP
 \fBExpunge\fR {\fINone\fR|\fIMaster\fR|\fISlave\fR|\fIBoth\fR}
 Permanently remove all messages [on the Master/Slave] marked for deletion.
+See \fBRECOMMENDATIONS\fR below.
 (Global default: \fINone\fR)
 ..
 .TP
@@ -549,6 +551,34 @@ in particular modern systems like ext4, btrfs and xfs. The 
performance impact
 on older file systems may be disproportionate.
 (Default: \fIyes\fR)
 ..
+.SH RECOMMENDATIONS
+Make sure your IMAP server does not auto-expunge deleted messages - it is
+slow, and semantically somewhat questionable. Specifically, Gmail needs to
+be configured not to do it.
+.P
+By default, \fBmbsync\fR will not delete any messages - deletions are
+propagated by marking the messages as deleted on the remote store.
+Once you have verified that your setup works, you will typically want to
+set \fBExpunge\fR to \fBBoth\fR, so that deletions become effective.
+.P
+\fBmbsync\fR's built-in trash functionality relies on \fBmbsync\fR doing
+the expunging of deleted messages. This is the case when it propagates
+deletions of previously propagated messages, and the trash is on the target
+store (typically your IMAP server).
+.br
+However, when you intend \fBmbsync\fR to trash messages which were not
+propagated yet, the MUA must mark the messages as deleted without expunging
+them (e.g., \fBMutt\fR's \fBmaildir_trash\fR option). Note that most
+messages are propagated a long time before they are deleted, so this is a
+corner case you probably do not want to optimize for. This also implies
+that the \fBTrashNewOnly\fR and \fBTrashRemoteNew\fR options are typically
+not very useful.
+.P
+If your server supports auto-trashing (as Gmail does), it is probably a
+good idea to rely on that instead of \fBmbsync\fR's trash functionality.
+If you do that, and intend to synchronize the trash like other mailboxes,
+you should not use \fBmbsync\fR's \fBTrash\fR option at all.
+..
 .SH INHERENT PROBLEMS
 Changes done after \fBmbsync\fR has retrieved the message list will not be
 synchronised until the next time \fBmbsync\fR is invoked.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] master: clarify wording in MapInbox doc

2013-12-15 Thread Oswald Buddenhagen
commit 4481702da300cebe1ebe94923f574c7b311bd292
Author: Oswald Buddenhagen 
Date:   Fri Dec 13 19:07:05 2013 +0100

clarify wording in MapInbox doc

 src/mbsync.1 |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mbsync.1 b/src/mbsync.1
index 37a09d9..11ec971 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -146,7 +146,7 @@ If \fIsize\fR is 0, the maximum message size is 
\fBunlimited\fR.
 ..
 .TP
 \fBMapInbox\fR \fImailbox\fR
-Create a virtual mailbox (relative to \fBPath\fR), which is backed by
+Create a virtual mailbox (relative to \fBPath\fR) which aliases
 the \fBINBOX\fR. Makes sense in conjunction with \fBPatterns\fR in the
 Channels section, though with a Maildir slave, you probably want to
 place \fBInbox\fR under \fBPath\fR instead.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] master: pre-release doc updates

2013-12-15 Thread Oswald Buddenhagen
commit 760bfa2cc66d30d6bb6272d55f82874c8fb0c0ae
Author: Oswald Buddenhagen 
Date:   Sun Dec 8 22:29:15 2013 +0100

pre-release doc updates

 NEWS|   10 ++-
 README  |1 +
 TODO|   66 ++
 src/mbsyncrc.sample |2 +-
 4 files changed, 46 insertions(+), 33 deletions(-)

diff --git a/NEWS b/NEWS
index ff72886..dd69fba 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,15 @@ UIDPLUS extension (e.g., M$ Exchange).
 
 More automatic handling of SSL certificates.
 
-Data safety in case of system crashes is improved.
+IPv6 support.
+
+IMAP password query can be scripted.
+
+Message arrival dates can be propagated.
+
+Data safety in case of system crashes was improved.
+
+MaxMessages was made vastly more useful.
 
 [1.0.0]
 
diff --git a/README b/README
index 9d5f29e..2c634e5 100644
--- a/README
+++ b/README
@@ -47,6 +47,7 @@ isync executable still exists; it is a compatibility wrapper 
around mbsync.
 c-client (UW-IMAP, Pine) is mostly fine, but versions less than 2004a.352
 tend to change UIDVALIDITY pretty often when used with unix/mbox mailboxes,
 making isync refuse synchronization.
+M$ Exchange (up to 2010 at least) occasionally exposes the same problem.
 The "cure" is to simply copy the new UIDVALIDITY from the affected
 mailbox to mbsync's state file. This is a Bad Hack (TM), but it works -
 use at your own risk (if the UIDVALIDITY change was genuine, this will
diff --git a/TODO b/TODO
index c12931c..aa041b3 100644
--- a/TODO
+++ b/TODO
@@ -5,15 +5,24 @@ f{,data}sync() usage could be optimized by batching the calls.
 add some marker about message being already [remotely] trashed.
 real transactions would be certainly not particularly useful ...
 
-check whether disappearing (M_DEAD) messages (due to maildir rescans) are
-properly accounted for by the syncing code.
-
 make sync_chans() aware of servers, so a bad server (e.g., wrong password)
 won't cause the same error message for every attached store.
 
+add support for more authentication methods: oauth, ntlm, ... use SASL?
+possibly by calling an external command. that might be overkill, and
+wouldn't be very user-friendly, though.
+
 make SSL (connect) timeouts produce a bit more than "Unidentified socket 
error".
 
 network timeout handling in general would be a good idea.
+lock timeout handling, too.
+
+add message expiration based on arrival date (message date would be too
+unreliable). MaxAge; probably mutually exclusive to MaxMessages.
+
+add alternative treatments of expired messages. ExpiredMessageMode: Prune
+(delete messages like now), Keep (just don't sync) and Archive (move to
+separate folder - ArchiveSuffix, default .archive).
 
 unify maildir locking between the two UID storage schemes.
 re-opening the db may be expensive, so keep it open.
@@ -26,21 +35,26 @@ can name a single (in-)box (curr. broken with maildir). an 
empty box name
 actually means empty, so the IMAP mailbox should use INBOX for Path (can't
 make that the default, as it would mess up the NAMESPACE).
 
+add regexp-based mailbox path rewriting to the drivers. user would provide
+expressions for both directions. every transformation would be immediately
+verified with the inverse transform. PathDelimiter and Flatten would become
+special cases of this.
+
 add daemon mode. primary goal: keep imap password in memory.
 also: idling mode.
 
 parallel fetching of multiple mailboxes.
 
-set_flags:
-- imap: grouping commands for efficiency
-- callback should get the flags actually affected. but then, why could flag
-  changes fail at all?
+imap_set_flags(): group commands for efficiency, don't call back until
+imap_commit().
 
 add streaming from fetching to storing.
 
 handle custom flags (keywords).
 
-handle google IMAP extensions.
+make use of IMAP CONDSTORE extension (rfc4551; CHANGEDSINCE FETCH Modifier);
+make use of IMAP QRESYNC extension (rfc5162) to avoid SEARCH to find vanished
+messages.
 
 use MULTIAPPEND and FETCH with multiple messages.
 
@@ -48,33 +62,23 @@ create dummies describing MIME structure of messages bigger 
than MaxSize.
 flagging the dummy would fetch the real message. possibly remove --renew.
 note that all interaction needs to happen on the slave side probably.
 
+propagate folder deletions. for safety, the target must be empty.
+
 don't SELECT boxes unless really needed; in particular not for appending,
 and in write-only mode not before changes are made.
 problem: UIDVALIDITY change detection is delayed, significantly complicating
 matters.
 
-possibly request message attributes on a per-message basis from the drivers.
-considerations:
-- record non-existing UID ranges in the sync database, so IMAP FETCHes needn't
-  to exclude anyway non-existing messages explicitly.
-- when detect unborn pairs and orphaned messages being gone? implied by 
expunge:
-  with trashing, by local dri

[commit] master: avoid array underflow in IMAP LIST .lock workaround

2013-12-15 Thread Oswald Buddenhagen
commit 4fa57791930ea07ede9070d3923613b51ed871fc
Author: Oswald Buddenhagen 
Date:   Sun Dec 15 12:46:03 2013 +0100

avoid array underflow in IMAP LIST .lock workaround

suggested by Mark Wielaard .

fwiw, the workaround really is still necessary with panda imap ...

 src/drv_imap.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index edef457..2f1f2b1 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1094,7 +1094,7 @@ parse_list_rsp_p2( imap_store_t *ctx, list_t *list, char 
*cmd ATTR_UNUSED )
goto skip;
}
}
-   if (!memcmp( arg + strlen( arg ) - 5, ".lock", 5 )) /* workaround 
broken servers */
+   if ((l = strlen( arg )) >= 5 && !memcmp( arg + l - 5, ".lock", 5 )) /* 
workaround broken servers */
goto skip;
if (map_name( arg, (char **)&narg, offsetof(string_list_t, string), 
ctx->delimiter, "/") < 0) {
warn( "IMAP warning: ignoring mailbox %s (reserved character 
'/' in name)\n", arg );

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] master: remove apparently obsolete item about Mutt's confusion

2013-12-15 Thread Oswald Buddenhagen
commit f9386d0b839076f42a6f5218b887a002e7d87cdb
Author: Oswald Buddenhagen 
Date:   Sun Dec 15 14:04:55 2013 +0100

remove apparently obsolete item about Mutt's confusion

seems to work just fine ...

 TODO |2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/TODO b/TODO
index aa041b3..ba556f9 100644
--- a/TODO
+++ b/TODO
@@ -1,5 +1,3 @@
-find out why mutt's message size calc is confused.
-
 f{,data}sync() usage could be optimized by batching the calls.
 
 add some marker about message being already [remotely] trashed.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] tag 'isync_1_1_0' created

2013-12-18 Thread Oswald Buddenhagen
The tag 'isync_1_1_0' has been created at f9386d0.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] branch 'isync_1_1_branch' created

2013-12-18 Thread Oswald Buddenhagen
The branch 'isync_1_1_branch' has been created at f9386d0.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[www-commit] fix download links

2013-12-18 Thread Oswald Buddenhagen
commit 211431b0ca8f937355794f7608e5b1a8f570be69
Author: Oswald Buddenhagen 
Date:   Wed Dec 18 22:29:28 2013 +0100

fix download links

 index.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.html b/index.html
index a5b3a9a..f241a38 100644
--- a/index.html
+++ b/index.html
@@ -67,8 +67,8 @@ isync executable still exists; it is a compatibility wrapper 
around mbsync.
 
 Download
 
-http://sourceforge.net/scm/?type=git&group_id=69662";>Git 
repository
-http://sourceforge.net/project/showfiles.php?group_id=69662";>Releases
+https://sourceforge.net/p/isync/isync/ci/master/tree/";>Git 
repository
+https://sourceforge.net/projects/isync/files/isync/";>Releases
 
 
 Links

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[www-commit] refer explicitly to GPLv2

2013-12-18 Thread Oswald Buddenhagen
commit b3be0259b9f26155ab10bb79adbd07775a7f6b25
Author: Oswald Buddenhagen 
Date:   Wed Dec 18 22:26:28 2013 +0100

refer explicitly to GPLv2

 index.html |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/index.html b/index.html
index 8f492b3..a5b3a9a 100644
--- a/index.html
+++ b/index.html
@@ -19,7 +19,7 @@ multiple replicas of a mailbox can be maintained.
 
 
 isync is free software in the sense of the 
-http://www.gnu.org/licenses/gpl.html";>GNU GPL.
+http://www.gnu.org/licenses/gpl2.html";>GNU GPL v2.
 
 
 Features
@@ -109,7 +109,7 @@ is written in Perl
 
 
 
-Last update: Sat Oct 02 11:12:10 CEST 2010.
+Last update: Wed Dec 18 22:26:23 CET 2013.
 
 
 

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[www-commit] .cvsignore -> .gitignore

2013-12-18 Thread Oswald Buddenhagen
commit 075a2d4309012ce8d4cf04aeb8aa7853799fabf3
Author: Oswald Buddenhagen 
Date:   Wed Dec 18 22:19:40 2013 +0100

.cvsignore -> .gitignore

 .cvsignore |2 --
 .gitignore |2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/.cvsignore b/.cvsignore
deleted file mode 100644
index 2b84bf7..000
--- a/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-isync.html
-mbsync.html
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..ba36eb3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+/isync.html
+/mbsync.html

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[announcement] isync/mbsync 1.1.0 released

2013-12-18 Thread Oswald Buddenhagen
as you may have guessed from the tag and branch creation, 1.1.0 is
released now, including:

Support for hierarchical mailboxes in Patterns.

Full support for IMAP pipelining (streaming, parallelization) added.
This is considerably faster especially with high-latency networks.

Faster and hopefully more reliable support for IMAP servers without the
UIDPLUS extension (e.g., M$ Exchange).

More automatic handling of SSL certificates.

IPv6 support.

IMAP password query can be scripted.

Message arrival dates can be propagated.

Data safety in case of system crashes was improved.

MaxMessages was made vastly more useful.

A number of bug fixes. And probably new bugs. ;)

have fun!

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Duplicate Exchange folders, password encryption & IMAP quick sync speed

2014-01-02 Thread Oswald Buddenhagen
On Mon, Dec 30, 2013 at 02:04:34PM +, Rob Stewart wrote:
> 1. Duplicate folders on Exchange server.
> 
> I am using davmail to sync with an Exchange server. For some reason,
> there are two "Sent" folders on the server:
> 
to analyze the problem the contents of the .mbsyncrc and the output of
$ mbsync -l -V uni
would be necessary. send them to me in private if you want to.

> 2. Plain text passwords.
> 
as maxim pointed out, one can use PassCmd for that. there are example
bindings to several password storage systems in mbsyncrc.sample.

> 3. Speeding up IMAP.
> 
> Is there a lightweight "quick sync" feature in mbsync, [...]?
> 
you want to use --pull-new --push (or Sync PullNew Push in the config
file).

> In an loosely related question. I have previously used Thunderbird via
> davmail, to use my remote Exchange account. I never experienced long
> send/receive times, i.e. a few seconds.
>
an online imap client can do a lot of optimizations, like partial
fetches - that's what imap was designed for.

> Moreover, when I send a test file to my Exchange server, Thunderbird
> appeared to immediately receive it (seconds later), despite thee fact
> that I had configured Thunderbird to check for mail only every one
> minute.
> 
it's using the IDLE extension. see the other thread going on.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Duplicate Exchange folders, password encryption & IMAP quick sync speed

2014-01-02 Thread Oswald Buddenhagen
On Thu, Jan 02, 2014 at 05:18:46PM +, Rob Stewart wrote:
> On 2 January 2014 16:53, Oswald Buddenhagen  wrote:
> > On Mon, Dec 30, 2013 at 02:04:34PM +, Rob Stewart wrote:
> >> 1. Duplicate folders on Exchange server.
> >>
> >> I am using davmail to sync with an Exchange server. For some reason,
> >> there are two "Sent" folders on the server:
> >>
> > to analyze the problem the contents of the .mbsyncrc and the output of
> > $ mbsync -l -V uni
> > would be necessary. send them to me in private if you want to.
> 
> I've sent you an email privately about this.
> 
-
> * LIST (\HasNoChildren) "/" "Sent"
> * LIST (\HasNoChildren) "/" "Sent"
> * LIST (\HasNoChildren) "/" "Sent Mail"
> * LIST (\HasNoChildren) "/" "Sent Messages"
-

clearly, the proxy is buggy or misconfigured.

> >> 3. Speeding up IMAP.
> >>
> >> Is there a lightweight "quick sync" feature in mbsync, [...]?
> >>
> > you want to use --pull-new --push (or Sync PullNew Push in the config
> > file).
> 
> Done. It still takes a while.. about 30 seconds or so. Should I be
> satisfied with this?
> 
hmm, no, not really. something is wrong.
try whether just --pull-new is equally slow.
the output of the two runs with -D -V would be interesting here.

> OK. To be clear, is mbsync in any way an online imap client?
>
no. it's kinda the whole point of it that it isn't ...

there are some imap extensions to optimize offline operation, but mbsync
doesn't use them yet. see other recent threads on this list.

> Are there command line online imap Linux clients?
> 
depending on what you mean by command line. assuming you mean a text
console, i would expect any halfways decent MUA to support it - mutt and
pine (or whatever successors still exist) certainly do.


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Duplicate Exchange folders, password encryption & IMAP quick sync speed

2014-01-02 Thread Oswald Buddenhagen
On Thu, Jan 02, 2014 at 06:58:23PM +, Rob Stewart wrote:
> On 2 January 2014 18:16, Oswald Buddenhagen  wrote:
> >> Done. It still takes a while.. about 30 seconds or so. Should I be
> >> satisfied with this?
> >>
> > hmm, no, not really. something is wrong.
> > try whether just --pull-new is equally slow.
> > the output of the two runs with -D -V would be interesting here.
> 
> I've just ran it again, this time with --pull-only.
> 
> $ time mbsync -c ~/.emacs.d/.mbsyncrc -D -V --pull-new uni > ~/mbsync-out 2>&1
> 
> real1m6.731s
> user0m0.237s
> sys 0m0.166s
> 
> See the output here:
> https://gist.github.com/robstewart57/8224449
> 
it clearly does basically nothing, as it should. so i think davmail (or
the exchange server behind it) is simply incredibly slow.
you can can run with just -V and watch the network roundtrips at the
console - i suspect some will take seconds.

> Your suggestion makes me wonder whether there is a daemon mode in mutt
> or pine, allowing you not to use it is a client, but instead more as a
> proxy for online IMAP for another client (e.g. mu4e).
> 
no such thing. it doesn't even make sense - such a daemon would be
best done as ... an imap server. uw-imap/panda-imap actually does
exactly that - it serves normal mailboxes over imap.

On Thu, Jan 02, 2014 at 02:05:25PM -0500, Chris Nehren wrote:
> Actually, mutt's poor handling of IMAP is what brought me to isync.
> [...]
>
now that you mention it ... yeah, sounds familiar. ^^


--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: make date parsing portable, take 2

2014-01-02 Thread Oswald Buddenhagen
commit aee0fa3b68461fdc3208db8987752660810bddf3
Author: Oswald Buddenhagen 
Date:   Thu Jan 2 20:50:42 2014 +0100

make date parsing portable, take 2

the global timezone variable is glibc-specific.
so use timegm() instead of mktime() for the conversion.
as that is specific to the BSDs and glibc, provide a fallback.
amends 62a6099.

 configure.ac   |2 +-
 src/common.h   |5 +++
 src/drv_imap.c |4 +-
 src/util.c |   65 
 4 files changed, 73 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 5f7c331..3a9927d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,7 @@ if test "x$ob_cv_strftime_z" = x"no"; then
 fi
 
 AC_CHECK_HEADERS(sys/poll.h sys/select.h)
-AC_CHECK_FUNCS(vasprintf memrchr)
+AC_CHECK_FUNCS(vasprintf memrchr timegm)
 
 AC_CHECK_LIB(socket, socket, [SOCK_LIBS="-lsocket"])
 AC_CHECK_LIB(nsl, inet_ntoa, [SOCK_LIBS="$SOCK_LIBS -lnsl"])
diff --git a/src/common.h b/src/common.h
index d1ec8b7..fb868b3 100644
--- a/src/common.h
+++ b/src/common.h
@@ -94,6 +94,11 @@ void free_string_list( string_list_t *list );
 void *memrchr( const void *s, int c, size_t n );
 #endif
 
+#ifndef HAVE_TIMEGM
+# include 
+time_t timegm( struct tm *tm );
+#endif
+
 void *nfmalloc( size_t sz );
 void *nfcalloc( size_t sz );
 void *nfrealloc( void *mem, size_t sz );
diff --git a/src/drv_imap.c b/src/drv_imap.c
index 2f1f2b1..5a28392 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -835,11 +835,11 @@ parse_date( const char *str )
memset( &datetime, 0, sizeof(datetime) );
if (!(end = strptime( str, "%d-%b-%Y %H:%M:%S ", &datetime )))
return -1;
-   if ((date = mktime( &datetime )) == -1)
+   if ((date = timegm( &datetime )) == -1)
return -1;
if (sscanf( end, "%3d%2d", &hours, &mins ) != 2)
return -1;
-   return date - (hours * 60 + mins) * 60 - timezone;
+   return date - (hours * 60 + mins) * 60;
 }
 
 static int
diff --git a/src/util.c b/src/util.c
index 1acbfc9..1ba65e5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -203,6 +203,71 @@ memrchr( const void *s, int c, size_t n )
 }
 #endif
 
+#ifndef HAVE_TIMEGM
+/*
+   Converts struct tm to time_t, assuming the data in tm is UTC rather
+   than local timezone.
+
+   mktime is similar but assumes struct tm, also known as the
+   "broken-down" form of time, is in local time zone.  timegm
+   uses mktime to make the conversion understanding that an offset
+   will be introduced by the local time assumption.
+
+   mktime_from_utc then measures the introduced offset by applying
+   gmtime to the initial result and applying mktime to the resulting
+   "broken-down" form.  The difference between the two mktime results
+   is the measured offset which is then subtracted from the initial
+   mktime result to yield a calendar time which is the value returned.
+
+   tm_isdst in struct tm is set to 0 to force mktime to introduce a
+   consistent offset (the non DST offset) since tm and tm+o might be
+   on opposite sides of a DST change.
+
+   Some implementations of mktime return -1 for the nonexistent
+   localtime hour at the beginning of DST.  In this event, use
+   mktime(tm - 1hr) + 3600.
+
+   Schematically
+ mktime(tm)   --> t+o
+ gmtime(t+o)  --> tm+o
+ mktime(tm+o) --> t+2o
+ t+o - (t+2o - t+o) = t
+
+   Contributed by Roger Beeman , with the help of
+   Mark Baushke  and the rest of the Gurus at CISCO.
+   Further improved by Roger with assistance from Edward J. Sabol
+   based on input by Jamie Zawinski.
+*/
+
+static time_t
+my_mktime( struct tm *t )
+{
+   time_t tl = mktime( t );
+   if (tl == -1) {
+   t->tm_hour--;
+   tl = mktime( t );
+   if (tl != -1)
+   tl += 3600;
+   }
+   return tl;
+}
+
+time_t
+timegm( struct tm *t )
+{
+   time_t tl, tb;
+   struct tm *tg;
+
+   if ((tl = my_mktime( t )) == -1)
+   return tl;
+   tg = gmtime( &tl );
+   tg->tm_isdst = 0;
+   if ((tb = my_mktime( tg )) == -1)
+   return tb;
+   return tl - (tb - tl);
+}
+#endif
+
 void
 oob( void )
 {

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: bump version

2014-01-02 Thread Oswald Buddenhagen
commit 813b4942db53688c9cbdcf62801076cb60126f7b
Author: Oswald Buddenhagen 
Date:   Thu Jan 2 21:08:57 2014 +0100

bump version

 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index ed3e124..5f7c331 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([isync], [1.1.0])
+AC_INIT([isync], [1.1.1])
 AC_CONFIG_HEADERS([autodefs.h])
 AM_INIT_AUTOMAKE
 

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: fix _POSIX_SYNCHRONIZED_IO usage

2014-01-02 Thread Oswald Buddenhagen
commit 6d2fd370a60de5cacaf8e60c117efe66c245dc16
Author: Oswald Buddenhagen 
Date:   Thu Jan 2 19:36:45 2014 +0100

fix _POSIX_SYNCHRONIZED_IO usage

it can be -1 for unsupported, or 0 for runtime detection (which we don't
do).

 src/drv_maildir.c |2 +-
 src/sync.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index b62848e..46b4cb1 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -43,7 +43,7 @@
 # define LEGACY_FLOCK 1
 #endif
 
-#ifndef _POSIX_SYNCHRONIZED_IO
+#if !defined(_POSIX_SYNCHRONIZED_IO) || _POSIX_SYNCHRONIZED_IO <= 0
 # define fdatasync fsync
 #endif
 
diff --git a/src/sync.c b/src/sync.c
index 687911d..851b2db 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -35,7 +35,7 @@
 #include 
 #include 
 
-#ifndef _POSIX_SYNCHRONIZED_IO
+#if !defined(_POSIX_SYNCHRONIZED_IO) || _POSIX_SYNCHRONIZED_IO <= 0
 # define fdatasync fsync
 #endif
 

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Issues building 1.1.0 on FreeBSD

2014-01-02 Thread Oswald Buddenhagen
On Sun, Dec 22, 2013 at 09:54:54PM -0500, Chris Nehren wrote:
On Wed, Dec 25, 2013 at 09:29:38PM +0100, Emanuel Haupt wrote:
> [compile on freebsd is teh FAIL]
>
fixed in isync_1_1_branch. presumably.

--
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Problem with swedish characters

2014-01-13 Thread Oswald Buddenhagen
On Mon, Jan 13, 2014 at 04:54:19AM +0100, martin wrote:
> I have som problems with swedish characters. [...]

> I read the man page but didn't find anything about character encodings.
>
that's because mbsync doesn't know anything about encodings. the entire mail
transmission chain is designed to be agnostic to encodings; it does
simple 8-bit passthrough.
the problem must be with the configuration of your MUA.


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: 1.0.6 working, but not 1.1.0

2014-01-17 Thread Oswald Buddenhagen
On Thu, Jan 16, 2014 at 06:27:45PM -0800, Allen Akin wrote:
>   Master :tuo:/home/akin/Mail/
>   Slave :ein:/home/akin/Mail/
> 
> Any ideas?
> 
the box names above were ignored before, now they actually have meaning
(re-read the docu about these options (and Patterns)).
they make no sense at all in your config, so just remove them.

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Segfault gmail <-> Dovecot 1.1.0

2014-01-21 Thread Oswald Buddenhagen
On Tue, Jan 21, 2014 at 03:50:31PM +, Alex Crow wrote:
> S: * 504 FETCH (UID 1314 FLAGS (\Seen) BODY[HEADER.FIELDS (X-TUID)] {4}
> S: )
>
you can add another -V to see what is in there. that might give a clue
how it came to be.

you could also inspect the message manually (open the mailbox with a MUA
that can display UIDs (thunderbird can, though it calls them something
else)) - check is there an X-TUID: header? how do its immediage
surroundings look like?

> IMAP error: unable to parse BODY[HEADER.FIELDS ...]
> S: 13 OK Success
> Warning: lost track of 1 pulled message(s)
> Segmentation fault
> 
obviously, this should not happen ...


--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't error out if we don't get an X-TUID header

2014-01-25 Thread Oswald Buddenhagen
commit f4a192f375c47bc910f7b6216aa270855012d0a2
Author: Oswald Buddenhagen 
Date:   Sat Jan 25 11:34:03 2014 +0100

don't error out if we don't get an X-TUID header

the BODY[] item in the FETCH response corresponds to what we requested,
and its presence doesn't imply that it actually contains anything useful
- new messages may appear in the mailbox in addition to those we stored
ourselves, and these will obviously have no TUID.

 src/drv_imap.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 5a28392..6007e54 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -922,9 +922,10 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s 
ATTR_UNUSED )
if (!is_atom( tmp ) || strcmp( 
tmp->val, "]" ))
goto bfail;
tmp = tmp->next;
-   if (!is_atom( tmp ) || memcmp( 
tmp->val, "X-TUID: ", 8 ))
+   if (!is_atom( tmp ))
goto bfail;
-   tuid = tmp->val + 8;
+   if (!memcmp( tmp->val, "X-TUID: ", 8 ))
+   tuid = tmp->val + 8;
} else {
  bfail:
error( "IMAP error: unable to parse 
BODY[HEADER.FIELDS ...]\n" );

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Segfault gmail <-> Dovecot 1.1.0

2014-01-25 Thread Oswald Buddenhagen
On Tue, Jan 21, 2014 at 03:50:31PM +, Alex Crow wrote:
> S: * 504 FETCH (UID 1314 FLAGS (\Seen) BODY[HEADER.FIELDS (X-TUID)] {4}
> S: )
> IMAP error: unable to parse BODY[HEADER.FIELDS ...]
>
i pushed a fix for this ...

> Program received signal SIGSEGV, Segmentation fault.
> 0x00409089 in box_loaded (sts=, aux= out>) at sync.c:1427
> 1427debug( " 
> pair(%d,%d): %d (pending)\n", srec->uid[M], srec->uid[S], nex );
> 
... but i really can make no sense of this (if anything, it should have
crashed earlier).
if the problem persists despite the above fix (somewhat unlikely,
actually, so maybe better try it without the fix again), please add -D
to the command line and run the thing through valgrind/memcheck.

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: fix typos

2014-01-25 Thread Oswald Buddenhagen
commit 1c758be695c2a10f1145d318831c63b384ce811c
Author: Oswald Buddenhagen 
Date:   Sat Jan 25 13:19:02 2014 +0100

fix typos

 src/mbsync.1 |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/mbsync.1 b/src/mbsync.1
index 419d3f7..e2fe2b3 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -199,7 +199,7 @@ versions 0.8 and 0.9.x. The invariant parts of the file 
names of the messages
 are used as keys into a Berkeley database named .isyncuidmap.db, which holds
 the UID validity as well.
 .br
-The \fBnative\fR scheme is faster, more space efficient, endianess independent
+The \fBnative\fR scheme is faster, more space efficient, endianness independent
 and "human readable", but will be disrupted if a message is copied from another
 mailbox without getting a new file name; this would result in duplicated UIDs
 sooner or later, which in turn results in a UID validity change, making
@@ -439,7 +439,7 @@ Store are marked as deleted only, i.e., they won't be 
really deleted until
 that Store is expunged.
 .br
 \fBFlags\fR - propagate flag changes. Note that Deleted/Trashed is a flag as
-well; this is particularily interesting if you use \fBmutt\fR with the
+well; this is particularly interesting if you use \fBmutt\fR with the
 maildir_trash option.
 .br
 \fBAll\fR (\fB--full\fR on the command line) - all of the above.

--
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Gmail → Maildir on Windows?

2014-01-29 Thread Oswald Buddenhagen
On Wed, Jan 29, 2014 at 10:06:25AM +0100, Felix E. Klee wrote:
> I am looking for a Windows tool that can be used to create daily backups
> of a Gmail account to Maildir format. I am basically looking for a
> one-way sync, Gmail → Maildir. When a new dail backup is made, then:
> 
>   * Is isync the right tool, or is it overkill (as I only need one-way
> sync)?
> 
it works just fine for one-way sync. details in the man page.

>   * Does is run natively on Windows (without Cygwin)?
> 
it won't build without cygwin, because it uses bsd/unix sockets, which
windows does not provide natively.

suppose it builds with cygwin (it wouldn't be too much effort if it
doesn't yet), i have no clue whether it would actually work (with IMAP).

it certainly won't work with maildir, because the windows file system
limitations make it impossible to implement maildir as specified.
i would suggest you set up a local IMAP server that uses a mailbox
format compatible with windows.

>   * Does it work well with Gmail IMAP?
> 
gmail has some quirks to take into account, but people have reported
success.

--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Gmail → Maildir on Windows?

2014-01-29 Thread Oswald Buddenhagen
On Wed, Jan 29, 2014 at 11:13:40AM +0100, Felix E. Klee wrote:
> On Wed, Jan 29, 2014 at 10:59 AM, Oswald Buddenhagen 
>  wrote:
> > it certainly won't work with maildir, because the windows file system
> > limitations make it impossible to implement maildir as specified. i
> > would suggest you set up a local IMAP server that uses a mailbox
> > format compatible with windows.
> 
> Or, instead of an IMAP server, perhaps there is a mail program that can
> be automatized. Basically, I want one file per message. I don't need
> full Maildir functionality.
> 
in this case i'd really suggest just using fetchmail, possibly in
combination with procmail and/or some custom MDA script.

--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Gmail → Maildir on Windows?

2014-01-29 Thread Oswald Buddenhagen
On Wed, Jan 29, 2014 at 12:59:06PM +0100, Felix E. Klee wrote:
> On Wed, Jan 29, 2014 at 12:50 PM, Oswald Buddenhagen 
>  wrote:
> > in this case i'd really suggest just using fetchmail, possibly in
> > combination with procmail and/or some custom MDA script.
> 
> I doubt that fetchmail can sync, i.e. locally remove messages that were
> deleted on the server.
> 
right, i didn't consider that.

the thing is, the "mail program" you describe is ... an imap server.
if there isn't one that uses a mailbox format you can use, you could
find one that comes closest to your needs and hack the mailbox driver
(probably maildir).

but in this case you could also hack the maildir driver in mbsync
(specifically, the flag handling needs to be removed. or you could morph
it into an mh driver, which embeds flags into the files instead of
producing funny file names. note that this is a slow mailbox format,
though.)

--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Gmail → Maildir on Windows?

2014-01-29 Thread Oswald Buddenhagen
On Wed, Jan 29, 2014 at 04:52:07PM +0100, Felix E. Klee wrote:
> On Wed, Jan 29, 2014 at 4:35 PM, Oswald Buddenhagen
>  wrote:
> > did you even read http://isync.sourceforge.net/mbsync.html ?
> 
> I don't understand why you ask this. If there's a misunderstanding,
> please let me know.
> 
i'll ask differently then: what makes you think mbsync could not sync
imap <> imap? clearly, you brought imapsync into this discussion because
of this.

--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Gmail → Maildir on Windows?

2014-01-29 Thread Oswald Buddenhagen
On Wed, Jan 29, 2014 at 05:15:23PM +0100, Felix E. Klee wrote:
> On Wed, Jan 29, 2014 at 4:57 PM, Oswald Buddenhagen 
>  wrote:
> > i'll ask differently then: what makes you think mbsync could not sync
> > imap <> imap?
> 
> True, I didn't think about using "mbsync" for IMAP to IMAP. However, in
> case I would chose a solution with an IMAP server, "imapsync" would
> probably still be my no. 1 choice:
> 
>   * It runs on Windows, without the need for Cygwin. In fact, I tried
> that.
> 
if i get it right, the "stand-alone" executable is a perl program
treated with perl2exe or a similar tool. i wonder how *that* compares to
the cygwin runtime (which you can link statically to get a single
executable just fine) ...

--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Gmail → Maildir on Windows?

2014-01-29 Thread Oswald Buddenhagen
On Wed, Jan 29, 2014 at 03:46:48PM +0100, Felix E. Klee wrote:
> On Wed, Jan 29, 2014 at 1:11 PM, Oswald Buddenhagen 
>  wrote:
> > the thing is, the "mail program" you describe is ... an imap server.
> 
> Right, I could store emails in an IMAP server. However, that doesn't
> solve the syncing problem. For that I would need a software like
> [imapsync][1]. 
>
did you even read http://isync.sourceforge.net/mbsync.html ?


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Segfault gmail <-> Dovecot 1.1.0

2014-02-01 Thread Oswald Buddenhagen
On Fri, Jan 31, 2014 at 02:23:09PM +, Alex Crow wrote:
> I'm afraid it it's still crashing (although a bit differently this time):
> 
this isn't different (except for the -VV output, which was to be
expected).
i'd even venture that you did something wrong:
- are you sure you are on the right branch (isync_1_1_branch) and that
  it is current (1c758be695c2a10f1145d318831c63b384ce811c)?
- are you sure you re-built and installed it?

also, please run this crashing version through valgrind as requested
previously. i need to understand the crash irrespective of the parsing
fix.


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: remove pointless use of AI_V4MAPPED flag

2014-02-02 Thread Oswald Buddenhagen
commit 12be7dd1f31d9b48c666a6c3431cc529f331093b
Author: Oswald Buddenhagen 
Date:   Sun Feb 2 12:24:34 2014 +0100

remove pointless use of AI_V4MAPPED flag

this flag is ineffective if ai_family is not explicitly AF_INET6.
on top of that, attempting to use it breaks on FreeBSD.

 src/socket.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/socket.c b/src/socket.c
index 044bd5f..f47e375 100644
--- a/src/socket.c
+++ b/src/socket.c
@@ -349,7 +349,7 @@ socket_connect( conn_t *sock, void (*cb)( int ok, void *aux 
) )
memset( &hints, 0, sizeof(hints) );
hints.ai_family = AF_UNSPEC;
hints.ai_socktype = SOCK_STREAM;
-   hints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
+   hints.ai_flags = AI_ADDRCONFIG;
infon( "Resolving %s... ", conf->host );
if ((gaierr = getaddrinfo( conf->host, NULL, &hints, 
&sock->addrs ))) {
error( "IMAP error: Cannot resolve server '%s': %s\n", 
conf->host, gai_strerror( gaierr ) );

--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Segfault gmail <-> Dovecot 1.1.0

2014-02-02 Thread Oswald Buddenhagen
On Sun, Feb 02, 2014 at 02:09:13PM +, Alex Crow wrote:
> And ran it under valgrind:
> 
ok, this one is different (the fix is clearly effective).
not that it appears to have fixed *much*, though ...

> ==6503== Invalid read of size 4
> ==6503==at 0x409029: box_loaded (sync.c:1427)
> ==6503==by 0x40EF78: imap_refcounted_done (drv_imap.c:524)
> ==6503==by 0x40CFC6: done_imap_cmd (drv_imap.c:230)
> ==6503==by 0x411152: imap_socket_read (drv_imap.c:1298)
> ==6503==by 0x40C3F9: socket_fd_cb (socket.c:728)
> ==6503==by 0x40B7CC: main_loop (util.c:663)
> ==6503==by 0x40382B: main (main.c:501)
> ==6503==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
> ==6503==
>
i cannot make any sense of this. it rather clearly indicates that srec
is actually null - but that should be plain impossible, because in this
case it must have crashed a few lines above already.

the gdb output you posted previously suggests that this is an optimized
build. care to make an unoptimized build and see whether/how this
changes the situation?

the next thing i'd try is setting a breakpoint at line 1411, and when it
gets hit, set a *data* breakpoint on srec with a condition of it being
null.


--
WatchGuard Dimension instantly turns raw network data into actionable 
security intelligence. It gives you real-time visual feedback on key
security issues and trends.  Skip the complicated setup - simply import
a virtual appliance and go from zero to informed in seconds.
http://pubads.g.doubleclick.net/gampad/clk?id=123612991&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Better alternative to calling mbsync every minute via crontab?

2014-02-04 Thread Oswald Buddenhagen
On Mon, Feb 03, 2014 at 02:31:17PM -0600, John Gafnea wrote:
> This is all well and good except that I'm calling mbsync every minute
> with crontab and many times at work I'll reply to an email in a thread
> only to find out that there have been several new emails in the <60
> seconds since mbsync last delivered mail to me... so I'm wondering
> if/hoping there's a better way to do what I'm doing. I'm aware of
> mswatch, but, again, I do not have shell access to the remote IMAP
> store. 
> 
support for IMAP IDLE has been discussed on this list somewhat recently.
so far, mbsync has nothing to address your problem.

--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: local mail not propagated to server

2014-02-06 Thread Oswald Buddenhagen
On Wed, Feb 05, 2014 at 04:46:46PM +0100, Tino Mettler wrote:
> Any hints where I best start any debugging?
> 
add -V to the mbsync command line.
posting (or sending me directly) the config file usually makes sense as
well.

--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: fix crash on store without prior fetch with non-UIDPLUS servers

2014-02-08 Thread Oswald Buddenhagen
commit 3161540ab9d4702809b9bf90a2fb39db1f3a7c9c
Author: Oswald Buddenhagen 
Date:   Sat Feb 8 13:21:28 2014 +0100

fix crash on store without prior fetch with non-UIDPLUS servers

we'd never initialize the message list append pointer, so
imap_find_new_msgs()'s FETCH would go awry.

REFMAIL: <20140207101719.gb17...@mac.home>

 src/drv_imap.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 6007e54..fbb8817 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1818,6 +1818,7 @@ imap_select( store_t *gctx, int create,
 
free_generic_messages( gctx->msgs );
gctx->msgs = 0;
+   ctx->msgapp = &gctx->msgs;
 
if (prepare_box( &buf, ctx ) < 0) {
cb( DRV_BOX_BAD, aux );
@@ -1852,7 +1853,6 @@ imap_load( store_t *gctx, int minuid, int maxuid, int 
newuid, int *excs, int nex
} else {
struct imap_cmd_refcounted_state *sts = 
imap_refcounted_new_state( cb, aux );
 
-   ctx->msgapp = &ctx->gen.msgs;
sort_ints( excs, nexcs );
for (i = 0; i < nexcs; ) {
for (bl = 0; i < nexcs && bl < 960; i++) {

--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] branch 'master' fast-forwarded

2014-02-12 Thread Oswald Buddenhagen
The branch 'master', previously at f9386d0, has been fast-forwarded by
7 revision(s) to 3161540.

--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: More segfaults

2014-02-14 Thread Oswald Buddenhagen
On Fri, Feb 14, 2014 at 03:09:09PM +, Alex Crow wrote:
> Not sure if this is a new one, the verbose output is different from 
> before but it's faulting in the same function:
> 
looks similar enough to me.
but the backtrace is even more useless than before.
did you have any luck with the breakpoints meanwhile?
anyway, please send me the _complete_ log of a crashing session run with
-D -V -V - maybe i can just deduce what is going wrong.

--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Creating a personal keyring for isync

2014-02-15 Thread Oswald Buddenhagen
On Fri, Feb 14, 2014 at 07:54:31PM +, doa379 wrote:
> I am not using Gnome keyring or any other password management service. I 
> simply wish to create a local keyring of my own and access it via local 
> Pyhthon/Perl script.
> 
> So what is the best way to do it?
> 
use the PassCmd option (new in 1.1). the sample config file should give
you enough ideas.

--
Android apps run on BlackBerry 10
Introducing the new BlackBerry 10.2.1 Runtime for Android apps.
Now with support for Jelly Bean, Bluetooth, Mapview and more.
Get your Android app in front of a whole new audience.  Start now.
http://pubads.g.doubleclick.net/gampad/clk?id=124407151&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: NO Mailbox already exists

2014-02-21 Thread Oswald Buddenhagen
On Thu, Feb 20, 2014 at 04:17:37PM -0600, Jon Thompson wrote:
> I’m trying to migrate users from exchange to dovecot, and am using mbsync to 
> do so.
> 
> I’ve got two questions that I haven’t figured out in the documentation..
> 
> 1) Is there a way to auto replace periods with something else (or just remove 
> them) in a folder? They’re being skipped because period is the delimiter.
>
maybe, depending on what you actually need. show me a short listing of
what you have and what you want.

> 2) I’m getting consistent errors that are represented by the subject line of 
> this message. Here’s the rest of the -D -V -V output..
> 
> M: 319 NO Server Unavailable. 15
>
the command belonging to this reply is missing from the log. i'm
assuming it's a SELECT. in this case the server is botched - this isn't
very surprising in the case of m$ exchange. usually, these errors go
away when you retry a few times. if the problem persists with particular
mailboxes, they are apparently damaged.


--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: NO Mailbox already exists

2014-02-22 Thread Oswald Buddenhagen
On Fri, Feb 21, 2014 at 07:15:38AM -0600, Jon Thompson wrote:
> Occasionally, the organizations users will have a folder like. "Project 2506 
> cherry ln."
> 
> That her than failing because of the period, strip it out. "Project 2506 
> cherry ln"
> 
if the number of such boxes is manageable, you can (have your users) do
that manually ahead of the migration. that is likely to produce a more
useful result, too.

other than that, you want
http://sourceforge.net/p/isync/feature-requests/5/ (which has no ETA,
possibly to be reconsidered upon offering an adequate (financial)
incentive).

> Can you make it so that the select errors don't kill your process? I
> can re run it if they keep coming up, but I want the data past them
> too. 
>
select errors don't kill anything. they cause the faulty box to be
skipped (as your own log shows), and that is the most optimistic
response possible. if the error is intermittent, running mbsync
sufficiently many times will get all data in the end.

--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: More segfaults

2014-02-23 Thread Oswald Buddenhagen
On Fri, Feb 21, 2014 at 10:02:28AM +, Alex Crow wrote:
> Ok, here's a valgrind and then a full session log.
>
no clues in it ... :(

> I'm having real trouble building a version with debugging symbols so I
> can set breakpoints as you asked earlier. Any hints?
> 
only what i said before ...

  CFLAGS="-g3 -O0" ./configure ...
  make clean
  make


--
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Cannot synchronize subdirectories

2014-02-24 Thread Oswald Buddenhagen
On Sun, Feb 23, 2014 at 07:23:12PM -0300, Facundo Aguirre wrote:
>   >>> 102 SELECT "debian-ml/testing-security-announce"
>   Maildir error: '/home/legion/maildir/facundo-cd/debian-ml/' is no valid 
> mailbox
>   * OK [CLOSED] Previous mailbox closed.
> 
upgrade to 1.1.
consider using the Flatten option.

--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Cannot synchronize subdirectories

2014-02-25 Thread Oswald Buddenhagen
On Wed, Feb 26, 2014 at 01:15:54AM -0300, Facundo Aguirre wrote:
> Thanks Oswald, it works with the Flatten option.
> 
> But just for curiosity, is there any way to keep the same folder 
> hierarchy instead of using the Flatten option? mbsync knows that the 
> debian-ml folder has subfolders.
> 
there was a bug in folder creation. it's already fixed in git.
note that "the same" is not entirely accurate, though - subfolders are
prefixed with a dot.

--
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't needlessly spell out INBOX

2014-03-10 Thread Oswald Buddenhagen
commit 183f256557246bcf2d67aa960c3cba5245b972ce
Author: Oswald Buddenhagen 
Date:   Mon Mar 10 11:54:22 2014 +0100

don't needlessly spell out INBOX

 src/compat/main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/compat/main.c b/src/compat/main.c
index 1ff0554..532f09c 100644
--- a/src/compat/main.c
+++ b/src/compat/main.c
@@ -174,7 +174,7 @@ main( int argc, char **argv )
global.user = getenv( "LOGNAME" );
 #endif
global.port = 143;
-   global.box = "INBOX";
+   global.box = ""; /* implicit INBOX in resulting Master/Slave entries */
global.use_namespace = 1;
global.require_ssl = 1;
global.use_tlsv1 = 1;

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: rework maildir store mapping

2014-03-10 Thread Oswald Buddenhagen
commit 19d86d2aa9415047d8e0a391bd2502023bff80fc
Author: Oswald Buddenhagen 
Date:   Mon Mar 10 11:57:37 2014 +0100

rework maildir store mapping

the trivial approach of having "home" and "root" stores produced ugly
results, and totally failed with the introduction of nested folder
handling.
instead, create a store per local directory, just as one would manually.

CCMAIL: 737...@bugs.debian.org

 src/compat/config.c |   86 +++
 src/compat/isync.h  |7 +++
 src/compat/util.c   |   13 ++
 3 files changed, 82 insertions(+), 24 deletions(-)

diff --git a/src/compat/config.c b/src/compat/config.c
index 2e160b6..39bbbe9 100644
--- a/src/compat/config.c
+++ b/src/compat/config.c
@@ -29,8 +29,6 @@
 #include 
 #include 
 
-static int local_home, local_root;
-
 static char *
 my_strndup( const char *s, size_t nchars )
 {
@@ -121,16 +119,6 @@ load_config( const char *path, config_t ***stor )
cfg = **stor = nfmalloc( sizeof(config_t) );
*stor = &cfg->next;
memcpy( cfg, &global, sizeof(config_t) );
-   if (val[0] == '~' && val[1] == '/') {
-   val += 2;
-   local_home = 1;
-   } else if (!memcmp( val, Home, HomeLen ) && 
val[HomeLen] == '/') {
-   val += HomeLen + 1;
-   local_home = 1;
-   } else if (val[0] == '/')
-   local_root = 1;
-   else
-   local_home = 1;
/* not expanded at this point */
cfg->path = nfstrdup( val );
} else if (!strcasecmp( "OneToOne", cmd )) {
@@ -382,7 +370,9 @@ write_config( int fd )
 {
FILE *fp;
const char *cn, *scn;
+   char *path, *local_box, *local_store;
config_t *box, *sbox, *pbox;
+   int pl;
 
if (!(fp = fdopen( fd, "w" ))) {
perror( "fdopen" );
@@ -395,15 +385,17 @@ write_config( int fd )
if (global.expunge || expunge)
fputs( "Expunge Both\n", fp );
fputc( '\n', fp );
-   if (local_home || o2o)
-   fprintf( fp, "MaildirStore local\nPath \"%s/\"\nInbox 
\"%s/INBOX\"\nAltMap %s\n\n",
-maildir, maildir, tb( altmap > 0 ) );
-   if (local_root)
-   fprintf( fp, "MaildirStore local_root\nPath /\nAltMap %s\n\n", 
tb( altmap > 0 ) );
if (o2o) {
write_imap_server( fp, &global );
write_imap_store( fp, &global );
-   fprintf( fp, "Channel o2o\nMaster :%s:\nSlave :local:\nPattern 
%%\n", global.store_name );
+   fprintf( fp, "MaildirStore local\nPath %s/\n", quotify( maildir 
) );
+   if (!inbox) { /* just in case listing actually produces an 
INBOX ... */
+   nfasprintf( (char **)&inbox, "%s/INBOX", maildir );
+   fprintf( fp, "Inbox %s\n", quotify( inbox ) );
+   }
+   if (altmap > 0)
+   fputs( "AltMap yes\n", fp );
+   fprintf( fp, "\nChannel o2o\nMaster :%s:\nSlave 
:local:\nPattern %%\n", global.store_name );
write_channel_parm( fp, &global );
} else {
for (box = boxes; box; box = box->next) {
@@ -446,6 +438,55 @@ write_config( int fd )
  gotsrv:
write_imap_store( fp, box );
  gotall:
+
+   path = expand_strdup( box->path );
+   if (!memcmp( path, Home, HomeLen ) && path[HomeLen] == 
'/')
+   nfasprintf( &path, "~%s", path + HomeLen );
+   local_store = local_box = strrchr( path, '/' ) + 1;
+   pl = local_store - path;
+   /* try to re-use existing store */
+   for (pbox = boxes; pbox != box; pbox = pbox->next)
+   if (pbox->local_store_path && !memcmp( 
pbox->local_store_path, path, pl ) && !pbox->local_store_path[pl])
+   goto gotstor;
+   box->local_store_path = my_strndup( path, pl );
+   /* derive a suitable name */
+   if (!strcmp( box->local_store_path, "/var/mail/" ) || 
!strcmp( box->local_store_path, "/var/spool/mail/" )) {
+ 

[commit] isync_1_1_branch: don't bother checking impossible condition

2014-03-10 Thread Oswald Buddenhagen
commit f55f42bdfc13d22b995289b666a30612469fcdf6
Author: Oswald Buddenhagen 
Date:   Sun Mar 9 15:56:52 2014 +0100

don't bother checking impossible condition

the config readear already verified that at least host or tunnel are
set.

 src/compat/config.c |5 +
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/src/compat/config.c b/src/compat/config.c
index bcbe214..d17eaa7 100644
--- a/src/compat/config.c
+++ b/src/compat/config.c
@@ -245,7 +245,7 @@ write_imap_server( FILE *fp, config_t *cfg )
 
if (cfg->tunnel)
nfasprintf( (char **)&cfg->old_server_name, "tunnel%d", 
++tunnels );
-   else if (cfg->host) {
+   else {
if (sscanf( cfg->host, "%d.%d.%d.%d", &a1, &a2, &a3, &a4 ) == 4)
hl = nfsnprintf( buf, sizeof(buf), "%s", cfg->host );
else {
@@ -269,9 +269,6 @@ write_imap_server( FILE *fp, config_t *cfg )
cfg->old_server_name = nfstrdup( buf );
cfg->old_servers = 1;
  gotsrv: ;
-   } else {
-   fprintf( stderr, "ERROR: Neither host nor tunnel specified for 
mailbox %s.\n", cfg->path );
-   exit( 1 );
}
 
if (cfg->user)

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't needlessly quote strings

2014-03-10 Thread Oswald Buddenhagen
commit 0edb606e0f07aed3552375c9380ccf2fe3e6ba99
Author: Oswald Buddenhagen 
Date:   Mon Mar 10 11:57:22 2014 +0100

don't needlessly quote strings

 src/compat/config.c |   28 ++--
 1 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/compat/config.c b/src/compat/config.c
index ee15305..2e160b6 100644
--- a/src/compat/config.c
+++ b/src/compat/config.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 
 static int local_home, local_root;
 
@@ -234,6 +235,21 @@ tb( int on )
return on ? "yes" : "no";
 }
 
+static const char *
+quotify( const char *str )
+{
+   char *ostr;
+   int i;
+
+   for (i = 0; str[i]; i++) {
+   if (isspace( str[i] )) {
+   nfasprintf( &ostr, "\"%s\"", str );
+   return ostr;
+   }
+   }
+   return str;
+}
+
 static void
 write_imap_server( FILE *fp, config_t *cfg )
 {
@@ -304,16 +320,16 @@ write_imap_server( FILE *fp, config_t *cfg )
fprintf( fp, "Port %d\n", cfg->port );
}
if (cfg->user)
-   fprintf( fp, "User \"%s\"\n", cfg->user );
+   fprintf( fp, "User %s\n", quotify( cfg->user ) );
if (cfg->pass)
-   fprintf( fp, "Pass \"%s\"\n", cfg->pass );
+   fprintf( fp, "Pass %s\n", quotify( cfg->pass ) );
fprintf( fp, "RequireCRAM %s\nRequireSSL %s\n"
 "UseSSLv2 %s\nUseSSLv3 %s\nUseTLSv1 %s\n",
 tb(cfg->require_cram), tb(cfg->require_ssl),
 tb(cfg->use_sslv2), tb(cfg->use_sslv3), tb(cfg->use_tlsv1) 
);
if ((cfg->use_imaps || cfg->use_sslv2 || cfg->use_sslv3 || 
cfg->use_tlsv1) &&
cfg->cert_file)
-   fprintf( fp, "CertificateFile %s\n", cfg->cert_file );
+   fprintf( fp, "CertificateFile %s\n", quotify( cfg->cert_file ) 
);
fputc( '\n', fp );
 }
 
@@ -327,13 +343,13 @@ write_imap_store( FILE *fp, config_t *cfg )
fprintf( fp, "IMAPStore %s\nAccount %s\n",
 cfg->store_name, cfg->server_name );
if (*folder)
-   fprintf( fp, "Path \"%s\"\n", folder );
+   fprintf( fp, "Path %s\n", quotify( folder ) );
else
fprintf( fp, "UseNamespace %s\n", tb(cfg->use_namespace) );
if (inbox)
-   fprintf( fp, "MapInbox \"%s\"\n", inbox );
+   fprintf( fp, "MapInbox %s\n", quotify( inbox ) );
if (cfg->copy_deleted_to)
-   fprintf( fp, "Trash \"%s\"\n", cfg->copy_deleted_to );
+   fprintf( fp, "Trash %s\n", quotify( cfg->copy_deleted_to ) );
fputc( '\n', fp );
 }
 

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: write Sync and Expunge to global section if applicable

2014-03-10 Thread Oswald Buddenhagen
commit bf9d7c769503a5418baee936ffa9b0d8d88cdf1a
Author: Oswald Buddenhagen 
Date:   Sun Mar 9 16:38:09 2014 +0100

write Sync and Expunge to global section if applicable

makes for leaner Channel sections.

note: the global delete and expunge variables exist so the command line
can override the config file despite the otherwise backwards behavior.

 src/compat/config.c |   13 +
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/compat/config.c b/src/compat/config.c
index d17eaa7..ee15305 100644
--- a/src/compat/config.c
+++ b/src/compat/config.c
@@ -344,9 +344,9 @@ write_channel_parm( FILE *fp, config_t *cfg )
fprintf( fp, "MaxSize %d\n", cfg->max_size );
if (cfg->max_messages)
fprintf( fp, "MaxMessages %d\n", cfg->max_messages );
-   if (!cfg->delete && !delete)
-   fputs( "Sync New ReNew Flags\n", fp );
-   if (cfg->expunge || expunge)
+   if (cfg->delete && !global.delete && !delete)
+   fputs( "Sync All\n", fp );
+   if (cfg->expunge && !global.expunge && !expunge)
fputs( "Expunge Both\n", fp );
fputc( '\n', fp );
 }
@@ -373,7 +373,12 @@ write_config( int fd )
return;
}
 
-   fprintf( fp, "SyncState *\n\n" );
+   fputs( "SyncState *\n", fp );
+   if (!global.delete && !delete)
+   fputs( "Sync New ReNew Flags\n", fp );
+   if (global.expunge || expunge)
+   fputs( "Expunge Both\n", fp );
+   fputc( '\n', fp );
if (local_home || o2o)
fprintf( fp, "MaildirStore local\nPath \"%s/\"\nInbox 
\"%s/INBOX\"\nAltMap %s\n\n",
 maildir, maildir, tb( altmap > 0 ) );

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: fix zero MaxSize override in Channels

2014-03-19 Thread Oswald Buddenhagen
commit bee7ceb0fb3d553a178e66886298a8a3503e4c33
Author: Oswald Buddenhagen 
Date:   Wed Mar 19 10:09:20 2014 +0100

fix zero MaxSize override in Channels

REFMAIL: ca+tk8fzb9i9lrc_k4g978c5xr5urnz_s0fpon_-6esdrbne...@mail.gmail.com

 src/config.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/config.c b/src/config.c
index 7743615..c8d9d61 100644
--- a/src/config.c
+++ b/src/config.c
@@ -422,8 +422,11 @@ load_config( const char *where, int pseudo )
} else if (merge_ops( cops, channel->ops ))
cfile.err = 1;
else {
-   if (max_size >= 0)
+   if (max_size >= 0) {
+   if (!max_size)
+   max_size = INT_MAX;
channel->stores[M]->max_size = 
channel->stores[S]->max_size = max_size;
+   }
*channelapp = channel;
channelapp = &channel->next;
}

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: actually use prime numbers for all hash bucket sizes

2014-03-19 Thread Oswald Buddenhagen
commit dec5f73f577a5e320b6044b1488d64816546d3bf
Author: Oswald Buddenhagen 
Date:   Wed Mar 19 10:27:06 2014 +0100

actually use prime numbers for all hash bucket sizes

for some reason lost in history, the prime_deltas were actually wrong,
leading to using composite numbers.
the right sequence is available at http://oeis.org/A092131.

 src/util.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/util.c b/src/util.c
index 1ba65e5..c76916b 100644
--- a/src/util.c
+++ b/src/util.c
@@ -537,8 +537,8 @@ arc4_getbyte( void )
 }
 
 static const unsigned char prime_deltas[] = {
-0,  0,  1,  3,  1,  5,  3,  3,  1,  9,  7,  5,  3,  9, 25,  3,
-1, 21,  3, 21,  7, 15,  9,  5,  3, 29, 15,  0,  0,  0,  0,  0
+0,  0,  1,  3,  1,  5,  3,  3,  1,  9,  7,  5,  3, 17, 27,  3,
+1, 29,  3, 21,  7, 17, 15,  9, 43, 35, 15,  0,  0,  0,  0,  0
 };
 
 int

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: CPU usage and timeout when synchronizing large amount of emails (on GMail)

2014-03-19 Thread Oswald Buddenhagen
On Tue, Mar 18, 2014 at 06:45:39PM +0200, Ciprian Dorin Craciun wrote:
> What is strange is that an initial synchronization works until the
> connection drops (the largest number was 70 k emails fetched).
> However on a second try the CPU usage happens, just after both stores
> have been "selected" (i.e. after it receives all the flags from GMail
> for all the emails).
> 
> I must note that the previous version (1.0.4) didn't have this issue.
> 
weird - the exact opposite should be the case (see commit 6d49c343f). :}

though i just remembered that an issue was fixed just recently in the qt
code i borrowed from, so see commit dec5f73f5.
if that doesn't solve the problem, please run the thing through valgrind
--tool callgrind (make sure you have a debug build of mbsync). let it
run until you have the feeling that the time spent hanging was
sufficient relative to the other time (everything cpu-bound will be
incredibly slow, as usually with valgrind). then try to make sense of
the log with kcachegrind, or just send it to me.
you can also send me the output of adding -D to the mbsync command line.
make sure the compressed size is at most in the single-digit megabytes -
otherwise please cut out the too repetetive parts. ^^

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/13534_NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: increasing timeout? (or some other solution)

2014-04-10 Thread Oswald Buddenhagen
On Thu, Apr 10, 2014 at 02:31:54PM +0800, Eric Abrahamsen wrote:
> I'm having a hell of a time getting my imap mail through China's
> national firewall, even with a VPN. I'm fairly sure it's because all of
> my accounts are gmail, and they don't like google/gmail.
> 
if that really is the problem, any kind of tuneling/proxying will do.

> Connecting via SSH through the server is another possibility, but SSH
> traffic is dicey as well, and I wonder if Google's domain/IP would ever
> be visible in the process?
> 
the whole point of ssh tuneling is privacy, so of course nothing of that
will be visible.

> If I do want to mirror the whole store on the server, is that something
> that isync can do on its own, or do I need some auxiliary programs?
>
well, you need cron.

> This would also mean I'd need to keep my login credentials on the
> server, though...
> 
yes. you can obscure them, but ultimately you need to trust root on that
machine. you wouldn't have that problem with a plain tunnel.


--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: increasing timeout? (or some other solution)

2014-04-10 Thread Oswald Buddenhagen
On Thu, Apr 10, 2014 at 07:21:09AM -0400, Chris Nehren wrote:
> On Thu, Apr 10, 2014 at 11:05:36 +0200, Oswald Buddenhagen wrote:
> > On Thu, Apr 10, 2014 at 02:31:54PM +0800, Eric Abrahamsen wrote:
> > > I'm having a hell of a time getting my imap mail through China's
> > > national firewall, even with a VPN. I'm fairly sure it's because all of
> > > my accounts are gmail, and they don't like google/gmail.
> > > 
> > if that really is the problem, any kind of tuneling/proxying will do.
> > 
> > > Connecting via SSH through the server is another possibility, but SSH
> > > traffic is dicey as well, and I wonder if Google's domain/IP would ever
> > > be visible in the process?
> > > 
> > the whole point of ssh tuneling is privacy, so of course nothing of that
> > will be visible.
> 
> That depends, actually.  If you're not routing DNS through the
> tunnel, then DNS requests will be leaked and the local ISP is
> free to intervene and return whatever they like for them.
> 
i don't think there is much to worry about. suppose you use this
command:

$ ssh -N -L 40143:mail.google.com:143 myproxy.com

myproxy.com is obviously resolved by your local DNS. you should make
reasonably sure that you actually are getting the ip of your proxy
server, e.g., verifying its fingerprint once you are connected.

but google.com is resolved by the proxy server. for one, it is resolved
on demand only (i.e., when you actually connect to localhost:40143), and
second because if you log into a NATed network, the client's DNS might
not even know how to resolve the target host.

fwiw, the best way to use an ssh tunnel with mbsync would be

Tunnel "ssh myproxy.com tcpconnect mail.google.com 143"

- in this case it is even more obvious that the resolution will be done
by the proxy, as the tcpconnect command is run there.

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: fix segfault on passing --{create, expunge}-{master, slave}

2014-04-12 Thread Oswald Buddenhagen
commit 31ba8375b0afbd0902a596bff7fb55249908ce9a
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 15:16:22 2014 +0200

fix segfault on passing --{create,expunge}-{master,slave}

stupid copy&pasto.

found by coverity.

 src/main.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main.c b/src/main.c
index f2faf25..8c3afda 100644
--- a/src/main.c
+++ b/src/main.c
@@ -289,9 +289,9 @@ main( int argc, char **argv )
if (!*opt)
cops |= op;
else if (!strcmp( opt, "-master" ))
-   mvars->ops[M] |= op, ochar++;
+   mvars->ops[M] |= op;
else if (!strcmp( opt, "-slave" ))
-   mvars->ops[S] |= op, ochar++;
+   mvars->ops[S] |= op;
else
goto badopt;
mvars->ops[M] |= op & 
(XOP_HAVE_CREATE|XOP_HAVE_EXPUNGE);

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't crash on truncated LIST response

2014-04-12 Thread Oswald Buddenhagen
commit fd872a7ff7078c76fa255305c630258d02934d49
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 14:58:18 2014 +0200

don't crash on truncated LIST response

found by coverity.

 src/drv_imap.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index fbb8817..98f23ba 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1040,8 +1040,9 @@ parse_list_rsp( imap_store_t *ctx, list_t *list, char 
*cmd )
list_t *lp;
 
if (!is_list( list )) {
-   error( "IMAP error: malformed LIST response\n" );
free_list( list );
+ bad_list:
+   error( "IMAP error: malformed LIST response\n" );
return LIST_BAD;
}
for (lp = list->child; lp; lp = lp->next)
@@ -1050,7 +1051,8 @@ parse_list_rsp( imap_store_t *ctx, list_t *list, char 
*cmd )
return LIST_OK;
}
free_list( list );
-   arg = next_arg( &cmd );
+   if (!(arg = next_arg( &cmd )))
+   goto bad_list;
if (!ctx->delimiter)
ctx->delimiter = nfstrdup( arg );
return parse_list( ctx, cmd, parse_list_rsp_p2 );

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: error-check reading of old uidvalidity and maxuid files

2014-04-12 Thread Oswald Buddenhagen
commit 09db83809a60a3999b733129061b69882ec86f59
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 18:34:26 2014 +0200

error-check reading of old uidvalidity and maxuid files

found by coverity.

 src/compat/convert.c |   12 ++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/compat/convert.c b/src/compat/convert.c
index 19209aa..921335c 100644
--- a/src/compat/convert.c
+++ b/src/compat/convert.c
@@ -128,13 +128,21 @@ convert( config_t *box )
sys_error( "Cannot open %s", iuvname );
goto err2;
}
-   fscanf( fp, "%d", &uidval );
+   if (fscanf( fp, "%d", &uidval ) != 1) {
+   sys_error( "Cannot read %s", iuvname );
+ err3:
+   fclose( fp );
+   goto err2;
+   }
fclose( fp );
if (!(fp = fopen( imuname, "r" ))) {
sys_error( "Cannot open %s", imuname );
goto err2;
}
-   fscanf( fp, "%d", &maxuid );
+   if (fscanf( fp, "%d", &maxuid ) != 1) {
+   sys_error( "Cannot read %s", imuname );
+   goto err3;
+   }
fclose( fp );
 
if (!stat( iumname, &sb )) {

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: better error messages for sync state and journal related errors

2014-04-12 Thread Oswald Buddenhagen
commit aa0118d047444873f20a6900e040619a9c6f5cef
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 18:30:09 2014 +0200

better error messages for sync state and journal related errors

we can make perfectly good use of errno here.

 src/sync.c |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 353d1ac..e97efe8 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -787,7 +787,7 @@ box_selected( int sts, void *aux )
fclose( jfp );
} else {
if (errno != ENOENT) {
-   error( "Error: cannot read sync state %s\n", 
svars->dname );
+   sys_error( "Error: cannot read sync state %s", 
svars->dname );
goto bail;
}
}
@@ -932,7 +932,7 @@ box_selected( int sts, void *aux )
fclose( jfp );
} else {
if (errno != ENOENT) {
-   error( "Error: cannot read journal %s\n", svars->jname 
);
+   sys_error( "Error: cannot read journal %s", 
svars->jname );
goto bail;
}
}
@@ -948,11 +948,11 @@ box_selected( int sts, void *aux )
goto bail;
 
if (!(svars->nfp = fopen( svars->nname, "w" ))) {
-   error( "Error: cannot write new sync state %s\n", svars->nname 
);
+   sys_error( "Error: cannot create new sync state %s", 
svars->nname );
goto bail;
}
if (!(svars->jfp = fopen( svars->jname, "a" ))) {
-   error( "Error: cannot write journal %s\n", svars->jname );
+   sys_error( "Error: cannot create journal %s", svars->jname );
fclose( svars->nfp );
goto bail;
}

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: error-check renaming of uid mapping database

2014-04-12 Thread Oswald Buddenhagen
commit 532d964aea327c4ff77fac5c3979c7d302f97d76
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 18:59:45 2014 +0200

error-check renaming of uid mapping database

for pedantry.

found by coverity.

 src/compat/convert.c |5 -
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/src/compat/convert.c b/src/compat/convert.c
index 921335c..ba18da0 100644
--- a/src/compat/convert.c
+++ b/src/compat/convert.c
@@ -240,7 +240,10 @@ convert( config_t *box )
goto err4;
}
db->close( db, 0 );
-   rename( iumname, diumname );
+   if (rename( iumname, diumname )) {
+   sys_error( "Cannot rename %s to %s", iumname, diumname 
);
+   goto err4;
+   }
} else {
if (!(fp = fopen( uvname, "w" ))) {
sys_error( "Cannot create %s", uvname );

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: fix "inverse copy&pasto" in account labeling code

2014-04-12 Thread Oswald Buddenhagen
commit d7d5fd20bc81db0aff711a540a2186a4f93b21e8
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 16:56:00 2014 +0200

fix "inverse copy&pasto" in account labeling code

the code was copied and the original adjusted ... but not quite
completely.
this means that clashing server names never really worked since - not
that i would have expected this to be a particularly common
configuration to start with. :D

also added comments explaining why there are two implementations of the
same thing.

amends aea4be19e3 (anno 2006).

found by coverity.

 src/compat/config.c |6 +-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/compat/config.c b/src/compat/config.c
index 39bbbe9..70360fc 100644
--- a/src/compat/config.c
+++ b/src/compat/config.c
@@ -247,6 +247,8 @@ write_imap_server( FILE *fp, config_t *cfg )
char buf[128], ubuf[64];
static int tunnels;
 
+   /* The old server names determine the derived store names. They are 
kinda stupid,
+* but can't be changed, because store names are encoded in state file 
names. */
if (cfg->tunnel)
nfasprintf( (char **)&cfg->old_server_name, "tunnel%d", 
++tunnels );
else {
@@ -266,7 +268,7 @@ write_imap_server( FILE *fp, config_t *cfg )
}
if (boxes) /* !o2o */
for (pbox = boxes; pbox != cfg; pbox = pbox->next)
-   if (!memcmp( pbox->server_name, buf, hl + 1 )) {
+   if (!memcmp( pbox->old_server_name, buf, hl + 1 
)) {
nfasprintf( (char 
**)&cfg->old_server_name, "%s-%d", buf, ++pbox->old_servers );
goto gotsrv;
}
@@ -275,6 +277,8 @@ write_imap_server( FILE *fp, config_t *cfg )
  gotsrv: ;
}
 
+   /* The "new" server names determine the names of the accounts 
themselves.
+* They are optimized for descriptiveness, e.g. in password prompts. */
if (cfg->user)
nfsnprintf( ubuf, sizeof(ubuf), "%s@", cfg->user );
else

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: remove pointless pointer assignment

2014-04-12 Thread Oswald Buddenhagen
commit 0dfbf6f6fba286e901cfdf52157cf35e106da583
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 13:08:10 2014 +0200

remove pointless pointer assignment

 src/compat/main.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/compat/main.c b/src/compat/main.c
index 532f09c..b8cc976 100644
--- a/src/compat/main.c
+++ b/src/compat/main.c
@@ -307,7 +307,7 @@ main( int argc, char **argv )
 
if (!all && !o2o)
for (i = optind; argv[i]; i++)
-   if (!(box = find_box( argv[i] ))) {
+   if (!find_box( argv[i] )) {
box = nfmalloc( sizeof(config_t) );
memcpy( box, &global, sizeof(config_t) );
box->path = argv[i];

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: fix hypothetical buffer overflows

2014-04-12 Thread Oswald Buddenhagen
commit d34baeb88607706ab5eec8f049cdc900030f2601
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 13:03:46 2014 +0200

fix hypothetical buffer overflows

if something managed to make the maildir .uidvalidity files big enough
(possible only by appending garbage or scrambling them alltogether), we
would overflow the read buffer by one when appending the terminating
null.
this is not expected to have any real-world impact.

found by coverity.

 src/drv_maildir.c |2 +-
 src/mdconvert.c   |2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index e751f4b..cb2d268 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -496,7 +496,7 @@ maildir_uidval_lock( maildir_store_t *ctx )
return DRV_BOX_BAD;
}
lseek( ctx->uvfd, 0, SEEK_SET );
-   if ((n = read( ctx->uvfd, buf, sizeof(buf) )) <= 0 ||
+   if ((n = read( ctx->uvfd, buf, sizeof(buf) - 1 )) <= 0 ||
(buf[n] = 0, sscanf( buf, "%d\n%d", &ctx->gen.uidvalidity, 
&ctx->nuid ) != 2)) {
 #if 1
/* In a generic driver, resetting the UID validity would be the 
right thing.
diff --git a/src/mdconvert.c b/src/mdconvert.c
index da9970f..ec2a558 100644
--- a/src/mdconvert.c
+++ b/src/mdconvert.c
@@ -135,7 +135,7 @@ convert( const char *box, int altmap )
key.data = (void *)"UIDVALIDITY";
key.size = 11;
if (altmap) {
-   if ((n = read( sfd, buf, sizeof(buf) )) <= 0 ||
+   if ((n = read( sfd, buf, sizeof(buf) - 1 )) <= 0 ||
(buf[n] = 0, sscanf( buf, "%d\n%d", &uv[0], &uv[1] ) != 2))
{
fprintf( stderr, "Error: cannot read UIDVALIDITY of 
'%s'.\n", box );

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't crash in message expiration debug print

2014-04-12 Thread Oswald Buddenhagen
commit c5f2943ff6f3d506a06a896ab634063bff223af0
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 15:28:28 2014 +0200

don't crash in message expiration debug print

we would try to print the uids from the non-existing srec of unpaired
messages while preparing expiration.
this would happen only if a) MaxMessages was configured and b) new
messages appeared on the slave but we were not pushing, so it's a bit of
a corner case.

found by coverity.

 src/sync.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 851b2db..cdd6c3d 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -1360,7 +1360,7 @@ box_loaded( int sts, void *aux )
continue;
if (!(srec = tmsg->srec) || srec->uid[M] <= 0) {
/* We did not push the message, so it must be 
kept. */
-   debug( "  old pair(%d,%d) unpropagated\n", 
srec->uid[M], srec->uid[S] );
+   debug( "  message %d unpropagated\n", tmsg->uid 
);
todel--;
} else {
nflags = (tmsg->flags | srec->aflags[S]) & 
~srec->dflags[S];

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: remove apparently pointless resetting of recent message count

2014-04-12 Thread Oswald Buddenhagen
commit 8844ff30632221490728c89a88572a86caa6a9aa
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 19:00:33 2014 +0200

remove apparently pointless resetting of recent message count

past this point, it's not used for anything anyway.

 src/drv_maildir.c |1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index cb2d268..34c38b6 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -1056,7 +1056,6 @@ maildir_rescan( maildir_store_t *ctx )
 
if (maildir_scan( ctx, &msglist ) != DRV_OK)
return DRV_BOX_BAD;
-   ctx->gen.recent = 0;
for (msgapp = &ctx->gen.msgs, i = 0;
 (msg = (maildir_message_t *)*msgapp) || i < msglist.nents; )
{

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't crash on malformed response code

2014-04-12 Thread Oswald Buddenhagen
commit ae49a37a3e82f3b590b8a95e778b56ff5286311f
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 15:02:40 2014 +0200

don't crash on malformed response code

this would happen in the absurd corner case that the response code is
properly terminated with a closing bracket, but the atom itself is an
unterminated double-quoted string.

NOT found by coverity.

 src/drv_imap.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index 98f23ba..adacc43 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -993,11 +993,13 @@ parse_response_code( imap_store_t *ctx, struct imap_cmd 
*cmd, char *s )
return RESP_OK; /* no response code */
s++;
if (!(p = strchr( s, ']' ))) {
+ bad_resp:
error( "IMAP error: malformed response code\n" );
return RESP_CANCEL;
}
*p++ = 0;
-   arg = next_arg( &s );
+   if (!(arg = next_arg( &s )))
+   goto bad_resp;
if (!strcmp( "UIDVALIDITY", arg )) {
if (!(arg = next_arg( &s )) ||
(ctx->gen.uidvalidity = strtoll( arg, &earg, 10 ), *earg))

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: remove pointless/counterproductive "Disk full?" error message suffixes

2014-04-12 Thread Oswald Buddenhagen
commit c6ddad6ac4fd5bfced98434df4bd50802426daa2
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 18:28:21 2014 +0200

remove pointless/counterproductive "Disk full?" error message suffixes

the affected functions will set errno to ENOSPC when necessary.

 src/sync.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index cdd6c3d..353d1ac 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -49,7 +49,7 @@ void
 Fclose( FILE *f, int safe )
 {
if ((safe && (fflush( f ) || (UseFSync && fdatasync( fileno( f )  
|| fclose( f ) == EOF) {
-   sys_error( "Error: cannot close file. Disk full?" );
+   sys_error( "Error: cannot close file" );
exit( 1 );
}
 }
@@ -64,7 +64,7 @@ Fprintf( FILE *f, const char *msg, ... )
r = vfprintf( f, msg, va );
va_end( va );
if (r < 0) {
-   sys_error( "Error: cannot write file. Disk full?" );
+   sys_error( "Error: cannot write file" );
exit( 1 );
}
 }

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't forget to reset message counts when skipping scan

2014-04-12 Thread Oswald Buddenhagen
commit 4d8575100d208129bc5d45e3968262415602ac04
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 19:02:06 2014 +0200

don't forget to reset message counts when skipping scan

amends b6949c64d2.

CCMAIL: 744...@bugs.debian.org

 src/drv_maildir.c |4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 34c38b6..0f58318 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -1030,8 +1030,10 @@ maildir_load( store_t *gctx, int minuid, int maxuid, int 
newuid, int *excs, int
ctx->excs = nfrealloc( excs, nexcs * sizeof(int) );
ctx->nexcs = nexcs;
 
-   if (ctx->fresh)
+   if (ctx->fresh) {
+   ctx->gen.count = ctx->gen.recent = 0;
goto dontscan;
+   }
 
if (maildir_scan( ctx, &msglist ) != DRV_OK) {
cb( DRV_BOX_BAD, aux );

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: assert !where implying !pseudo

2014-04-12 Thread Oswald Buddenhagen
commit 9932352df02a328abd8dd229932babe892087050
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 16:06:33 2014 +0200

assert !where implying !pseudo

to help poor coverity.

 src/config.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/config.c b/src/config.c
index c8d9d61..8fc0949 100644
--- a/src/config.c
+++ b/src/config.c
@@ -326,6 +326,7 @@ load_config( const char *where, int pseudo )
char buf[1024];
 
if (!where) {
+   assert( !pseudo );
nfsnprintf( path, sizeof(path), "%s/." EXE "rc", Home );
cfile.file = path;
} else

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: error-check committing of sync state

2014-04-12 Thread Oswald Buddenhagen
commit 2d4bc1e6138f81bcf160154017f19725cdc21051
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 18:31:18 2014 +0200

error-check committing of sync state

a failure here is rather unlikely, but let's be pedantic.
a failure is not fatal (we'll just enter the journal replay path next
time), so only print warnings.

found by coverity.

 src/sync.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index e97efe8..ec7efa0 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -1875,8 +1875,10 @@ box_closed_p2( sync_vars_t *svars, int t )
Fclose( svars->jfp, 0 );
if (!(DFlags & KEEPJOURNAL)) {
/* order is important! */
-   rename( svars->nname, svars->dname );
-   unlink( svars->jname );
+   if (rename( svars->nname, svars->dname ))
+   warn( "Warning: cannot commit sync state %s\n", 
svars->dname );
+   else if (unlink( svars->jname ))
+   warn( "Warning: cannot delete journal %s\n", 
svars->jname );
}
 
sync_bail( svars );

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: close a bunch of fd leaks in error paths

2014-04-12 Thread Oswald Buddenhagen
commit df29c592d1249b5f1c6eb69dca6684100f1f098b
Author: Oswald Buddenhagen 
Date:   Sat Apr 12 12:46:36 2014 +0200

close a bunch of fd leaks in error paths

found by coverity.

 src/drv_maildir.c |9 +++--
 src/mdconvert.c   |5 -
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 46b4cb1..e751f4b 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -219,8 +219,10 @@ maildir_list_recurse( store_t *gctx, int isBox, int 
*flags, const char *inbox,
const char *ent = de->d_name;
pl = pathLen + nfsnprintf( path + pathLen, _POSIX_PATH_MAX - 
pathLen, "%s", ent );
if (inbox && !memcmp( path, inbox, pl ) && !inbox[pl]) {
-   if (maildir_list_inbox( gctx, flags ) < 0)
+   if (maildir_list_inbox( gctx, flags ) < 0) {
+   closedir( dir );
return -1;
+   }
} else {
if (*ent == '.') {
if (!isBox)
@@ -238,8 +240,10 @@ maildir_list_recurse( store_t *gctx, int isBox, int 
*flags, const char *inbox,
}
}
nl = nameLen + nfsnprintf( name + nameLen, 
_POSIX_PATH_MAX - nameLen, "%s", ent );
-   if (maildir_list_recurse( gctx, 1, flags, inbox, path, 
pl, name, nl ) < 0)
+   if (maildir_list_recurse( gctx, 1, flags, inbox, path, 
pl, name, nl ) < 0) {
+   closedir( dir );
return -1;
+   }
}
}
closedir (dir);
@@ -677,6 +681,7 @@ maildir_scan( maildir_store_t *ctx, msglist_t *msglist )
ctx->db->err( ctx->db, 
ret, "Maildir error: db->get()" );
  mbork:
maildir_free_scan( 
msglist );
+   closedir( d );
goto bork;
}
uid = INT_MAX;
diff --git a/src/mdconvert.c b/src/mdconvert.c
index 7f6366f..da9970f 100644
--- a/src/mdconvert.c
+++ b/src/mdconvert.c
@@ -208,8 +208,10 @@ convert( const char *box, int altmap )
nfsnprintf( buf2 + bl, sizeof(buf2) - bl, 
"%.*s,U=%d%s", ml, e->d_name, uid, ru );
}
if (rename( buf, buf2 )) {
-   if (errno == ENOENT)
+   if (errno == ENOENT) {
+   closedir( d );
goto again;
+   }
sys_error( "Cannot rename %s to %s", buf, buf2 
);
  ebork:
closedir( d );
@@ -224,6 +226,7 @@ convert( const char *box, int altmap )
close( dfd );
if (rename( tdpath, dpath )) {
sys_error( "Cannot rename %s to %s", tdpath, dpath );
+   close( sfd );
return 1;
}
if (unlink( spath ))

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't lie about the default of User

2014-04-13 Thread Oswald Buddenhagen
commit 4ab12ae76e8a266ba3660b5cc2042946c7bfa653
Author: Oswald Buddenhagen 
Date:   Sun Apr 13 17:07:53 2014 +0200

don't lie about the default of User

unlike the isync wrapper, mbsync does not have a default for the IMAP
user. the remote user seldomly matches the local one, so "forwarding" it
is more confusing than helpful.

CCMAIL: 744...@bugs.debian.org

 src/mbsync.1 |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/mbsync.1 b/src/mbsync.1
index e2fe2b3..a2335d9 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -245,7 +245,7 @@ Specify the TCP port number of the IMAP server.  (Default: 
143 for IMAP,
 ..
 .TP
 \fBUser\fR \fIusername\fR
-Specify the login name on the IMAP server.  (Default: current local user)
+Specify the login name on the IMAP server.
 ..
 .TP
 \fBPass\fR \fIpassword\fR

--
Put Bad Developers to Shame
Dominate Development with Jenkins Continuous Integration
Continuously Automate Build, Test & Deployment 
Start a new project now. Try Jenkins in the cloud.
http://p.sf.net/sfu/13600_Cloudbees
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: not syncing all messages from master to slave after mailbox migration from exchange 2007->2013

2014-04-16 Thread Oswald Buddenhagen
On Tue, Apr 15, 2014 at 11:40:23AM -0400, Brian Whigham wrote:
> Any idea why mbsync won't grab all messages?  It only grabs those that have 
> come in since the migration.
>
migration from what? you mean since you started using mbsync at all?

> I see all of 49k messages in the OWA (webmail) and if I have mutt
> connect to exchange with IMAP directly.  mbsync even enumerates them,
> but doesn't pull them down.
> 
dunno. please send me (in private) the output of mbsync -D -V INBOX.

--
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: How to avoid colons in file names?

2014-04-23 Thread Oswald Buddenhagen
On Tue, Apr 22, 2014 at 11:09:57PM +0200, Felix E. Klee wrote:
> I set up mbsync on a Linux system. The Maildir store would be synced to
> Windows. However, Windows doesn’t like colons in file names. So I tried
> enabling *alternative scheme*, hoping that this would lead to simpler
> file names.
> 
> However, file names still contain colons:
> 
the home page states right away that windows is not supported because of
file system limitations.

btw, once upon a time, i installed a linux distro on a FAT file system -
it built some meta layer on top of FAT to support unixy features. the
same would certainly work with NTFS.
i would almost bet that there is a FUSE-based FS driver to do exactly
that.


--
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: MaxMessages

2014-05-17 Thread Oswald Buddenhagen
On Sat, May 17, 2014 at 11:54:56AM -0500, Luis Mochan wrote:
> If I delete and expunge in the slave some few messages and sync again,
> I would like the corresponding messages to be deleted in the master
>
yes

> and then enough messages to be fetched from the master to fill again
> the quota of the most recent 100 messages in the slave.
>
mbsync won't do that. it will only fetch new messages later on.
why would you want to "work your way back"?

> From what I read, it seems to me that only using MaxMessages 100 would
> fetch all of my unread messages which are >>100,
>
yes

> while using 'MaxMessage 100' and 'ExpireUnread yes' might remove
> unread messages leaving me with less than 100.
> 
i don't understand what you mean by that.

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: MaxMessages

2014-05-18 Thread Oswald Buddenhagen
On Sat, May 17, 2014 at 01:33:25PM -0500, Luis Mochan wrote:
> I usually scan my mail in FILO order, acting on the most urgent
> messages. Later on, I look at them again, processing and archiving them at my
> leisure. Thus, when I finish with all the recent messages, I would
> like to see older ones, but I don't want to saturate my portable
> device with all my unread ones.
>
i see.
this is technically tricky, as mbsync would have to reach back (list) an
upfront unknown number of messages (we don't know how many messages will
qualify for (re-)downloading, and we don't know where the range would
start even if all messages would qualify (because there may be holes in
the numbering due to deleting messages ... though it would be a
possibility to use always-contiguous IMAP sequence numbers instead of
UIDs in this case ...).

as a workaround i can only suggest setting MaxMessages to the highest
realistic number of messages you would be able to go backwards. of
course that's not helpful if you need to work in very small increments.

alternatively, you could simply delete the slave mailbox including the
sync state after you sync all the deletions. then mbsync would start
listing from scratch. of course that is highly inefficient with big
mailboxes, which is why it's not done during incremental operation.

> > > while using 'MaxMessage 100' and 'ExpireUnread yes' might remove
> > > unread messages leaving me with less than 100.
> > > 
> > i don't understand what you mean by that.
> 
> Well, I had made one test. Running mbsync brought in 100 messages when
> I first ran it. I opened my mail with mutt, saw a few messages and
> closed mutt. Later I ran mbsync again and it fetched 20 messages, but
> when I opened my mail, the original 100 messages were gone.
>
that doesn't sound right at all. 80 of the old messages should have
remained.
can you reproduce the situation from scratch? if so, i'd need a log of
mbsync -D -V of the whole procedure to understand what has happend.

> I then changed 'ExpireUnread' to 'no' and ran mbsync for the third
> time, expecting mbsync to fetch again those 100 messages, but it
> didn't.
>
yeah, that's expected.


--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: MaxMessages

2014-05-18 Thread Oswald Buddenhagen
On Sun, May 18, 2014 at 10:02:25AM -0500, Luis Mochan wrote:
> I did get 100 messages, but they were not the latest nor the earliest
> but rather scattered throughout the maildir.  When fetching messages
> from an actual maildir (containing actual messages instead of symbolic
> links) I did get the latest ones as I expected. Is there a reason why
> symbolic links could confuse mbsync?
> 
mbsync relies on the monotoneously incrementing UIDs.
when there are no UIDs encoded in the file names, it tries to deduce
the arrival order from the semi-standardized naming convention. if the
symlinks don't follow that convention or were assigned more or less
randomly to files, the result will reflect that.

--
"Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE
Instantly run your Selenium tests across 300+ browser/OS combos.
Get unparalleled scalability from the best Selenium testing platform available
Simple to use. Nothing to install. Get started now for free."
http://p.sf.net/sfu/SauceLabs
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] tag 'isync_1_1_1' created

2014-06-01 Thread Oswald Buddenhagen
The tag 'isync_1_1_1' has been created at 4ab12ae.

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] branch 'master' fast-forwarded

2014-06-01 Thread Oswald Buddenhagen
The branch 'master', previously at 3161540, has been fast-forwarded by
24 revision(s) to 4ab12ae.

--
Time is money. Stop wasting it! Get your web API in 5 minutes.
www.restlet.com/download
http://p.sf.net/sfu/restlet
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: [PATCH] implement gssapi support

2014-06-14 Thread Oswald Buddenhagen
On Fri, Jun 13, 2014 at 09:47:49AM +0200, Jan Synacek wrote:
> I've implemented GSSAPI support for isync. I was a bit unsure about the
> ifdefs and how to structure them, since I use EVP_DecodeBlock() to
> decode base64, which means dependency on OpenSSL. Consider this patch
> version 1.
> 
just a partial review for now.

note that there is also a sasl branch in git. you can take a lot from
the commit and also the review in the commit message.
ideally, revive it as well.

> From 6677e6f4b7ab436362b2a0b2ff623d516d15c3ab Mon Sep 17 00:00:00 2001
> From: Jan Synacek 
> Date: Fri, 13 Jun 2014 09:22:05 +0200
> Subject: [PATCH] implement gssapi support
> 
> ---
>  configure.ac   |  14 
>  src/common.h   |   4 ++
>  src/drv_imap.c | 201 
> +
>  src/socket.h   |   3 +
>  src/util.c |  20 ++
>  5 files changed, 242 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 3a9927d..bf68daf 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -100,6 +100,20 @@ if test "x$ob_cv_with_ssl" != xno; then
>  fi
>  AC_SUBST(SSL_LIBS)
>  
> +AC_ARG_ENABLE([gssapi],
> +  [AC_HELP_STRING([--enable-gssapi],
> +  [enable gssapi support [no]]
> +  )],
> +  [gssapi=${enableval}],
> +  [gssapi=no])
> +if test "${gssapi}" = yes; then
> +   AC_CHECK_LIB(gssapi_krb5, gss_init_sec_context, [gssapi_krb5=yes])
> +   if test "${gssapi_krb5}" = yes; then
> +  AC_DEFINE(HAVE_LIBGSSAPI, 1, [if you have the gssapi_krb5 library])
> +  LDFLAGS="$LDFLAGS -lgssapi_krb5"
>
you need to assign (and later use) GSSAPI_LIBS instead.

> +   fi
> +fi
> +
>  AC_CACHE_CHECK([for Berkley DB >= 4.2], ac_cv_berkdb4,
>[ac_cv_berkdb4=no
> AC_TRY_LINK([#include ],
> diff --git a/src/common.h b/src/common.h
> index fb868b3..6afcc9f 100644
> --- a/src/common.h
> +++ b/src/common.h
> @@ -133,4 +133,8 @@ void fake_fd( int fd, int events );
>  void del_fd( int fd );
>  void main_loop( void );
>  
> +#if HAVE_LIBSSL && HAVE_LIBGSSAPI
> +int from_base64( char *, const char *, const int );
> +#endif
> +
>  #endif
> diff --git a/src/drv_imap.c b/src/drv_imap.c
> index adacc43..9c08934 100644
> --- a/src/drv_imap.c
> +++ b/src/drv_imap.c
> @@ -35,6 +35,11 @@
>  #include 
>  #include 
>  #include 
> +#if HAVE_LIBSSL && HAVE_LIBGSSAPI
> +# include 
> +# include 
> +#endif
> +
>  
>  typedef struct imap_server_conf {
>   struct imap_server_conf *next;
> @@ -180,6 +185,9 @@ enum CAPABILITY {
>  static const char *cap_list[] = {
>   "LOGINDISABLED",
>  #ifdef HAVE_LIBSSL
> +# ifdef HAVE_LIBGSSAPI
> + "AUTH=GSSAPI",
> +# endif
>   "AUTH=CRAM-MD5",
>   "STARTTLS",
>  #endif
> @@ -1442,6 +1450,182 @@ do_cram_auth( imap_store_t *ctx, struct imap_cmd 
> *cmdp, const char *prompt )
>  }
>  #endif
>  
> +#ifdef HAVE_LIBGSSAPI
> +static gss_ctx_id_t Gss_ctx;
> +static gss_name_t Gss_name;
> +
> +#define GSS_BUFSIZE 16384
> +
> +static int do_gssapi_auth_p2 ( imap_store_t *, struct imap_cmd *, const char 
> * );
> +static int do_gssapi_auth_p3 ( imap_store_t *, struct imap_cmd *, const char 
> * );
> +
> +static int
> +send_gss_buffer( imap_store_t *ctx, gss_buffer_t buffer )
> +{
> + char *buf;
> + int len;
> +
> + buf = nfcalloc( GSS_BUFSIZE );
> + len = EVP_EncodeBlock( (unsigned char *)buf, (unsigned char 
> *)buffer->value, buffer->length );
> +
> + if (socket_write( &ctx->conn, buf, len, GiveOwn ) < 0)
> + return -1;
> + return socket_write( &ctx->conn, "\r\n", 2, KeepOwn );
> +}
> +
> +static int
> +do_gssapi_auth( imap_store_t *ctx, struct imap_cmd *cmdp, const char *prompt 
> ATTR_UNUSED )
> +{
> + imap_server_conf_t *srvc = ((imap_store_conf_t *)ctx->gen.conf)->server;
> +
> + gss_buffer_desc input;
> + gss_buffer_desc output;
> + OM_uint32 maj, min;
> + char buf[GSS_BUFSIZE];
> +
> + cmdp->param.cont = do_gssapi_auth_p2;
> +
> + snprintf( buf, sizeof( buf ), "imap@%s", srvc->sconf.host );
>
nfsnprintf(), no?

> + input.value = buf;
> + input.length = strlen( buf ) + 1;
> +
*printf*() returns the length.

> + maj = gss_import_name( &min, &input, GSS_C_NT_HOSTBASED_SERVICE, 
> &Gss_name );
> + if (maj != GSS_S_COMPLETE) {
> + error( "Couldn't get service name for [%s]\n", buf );
> + return -1;
> + }
> +
> + if (DFlags & VERBOSE) {
> + gss_OID mech_name;
> + maj = gss_display_name( &min, Gss_name, &input, &mech_name );
> + printf( "Using service name [%s]\n", (char *)input.value );
> + fflush( stdout );
>
info()

> + }
> +
> + input.value = NULL; input.length = 0;
> +
> + maj = gss_init_sec_context(
> + &min,
> + GSS_C_NO_CREDENTIAL,
> + &Gss_ctx,
> + Gss_name,
> + GSS_C_NO_OID,
> + GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG,
> + 0,
> +  

Re: Troubles syncing 'INBOX' directory

2014-06-17 Thread Oswald Buddenhagen
On Mon, Jun 16, 2014 at 10:46:16PM +0200, Bruno Gonzalez wrote:
> However, my personal email, running on a shared hosting server, is not 
> getting fully synchronized. The failing account has the following IMAP 
> directory tree:
> INBOX
> INBOX/Trash
> INBOX/Drafts
> INBOX/Archive
> (etc.)
> 
> All the INBOX/* directories are synced without problems.
>
that's actually weird. i'd have expected this to be broken as well.

> But the INBOX   directory is always empty in my slave directory.
> 
> I've noticed that, during the very first sync (when starting from scratch), 
> mbsync -V will output a line that says: "Maildir warning: ignoring INBOX"
> 
this is the cause of your problem.
ignoring INBOX is a measure to avoid that the mailbox name is
misinterpreted after stripping off the path. obviously, that's
counterproductive in the case when INBOX is explicitly mapped into the
maildir, so i'll need to fix that.

> The relevant part of my .mbsyncrc file is this:
> 
> IMAPAccount stenyakc
> Host imap.bar.com
> User f...@bar.com
> Pass baz-qux
> UseIMAPS no
> RequireSSL no
> UseTLSv1 no
> 
> IMAPStore stenyakc-remote
> Account stenyakc
> 
> MaildirStore stenyakc-local
> Path ~/mail/f...@bar.com/
> Inbox ~/mail/f...@bar.com/INBOX
> 
> Channel stenyakc
> Master :stenyakc-remote:
> Slave :stenyakc-local:
> Patterns *
>
try simply appending INBOX to the list.

> Create Slave
> SyncState *
> Sync All
> 

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Troubles syncing 'INBOX' directory

2014-06-17 Thread Oswald Buddenhagen
On Tue, Jun 17, 2014 at 11:54:33AM +0200, Bruno Gonzalez wrote:
> On 14-06-17 09:44:12, Oswald Buddenhagen wrote:
> > > Channel stenyakc
> > > Master :stenyakc-remote:
> > > Slave :stenyakc-local:
> > > Patterns *
> > >
> > try simply appending INBOX to the list.
> 
> I've tried all of the following lines (some were just random tests), 
> unfortunately none of them worked:
> Patterns *
> Patterns INBOX
> Patterns INBOX.
> Patterns INBOX/
> Patterns INBOX/*
> Patterns INBOX/INBOX
> Patterns INBOX.INBOX
> Patterns INBOX/.INBOX
> Patterns *INBOX
> Patterns ./INBOX
> Patterns ./.INBOX
> Patterns ./*INBOX
> 
i meant
Patterns * INBOX

--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: IMAP COMPRESS support

2014-06-21 Thread Oswald Buddenhagen
On Sat, Jun 21, 2014 at 12:51:25AM +0200, Vincent Bernat wrote:
> If COMPRESS=DEFLATE is present as a capability, the command "a COMPRESS
> DEFLATE" will enable it. Once the server answers with OK any remaining
> flow should be handled through zlib.
> 
> It would convenient to implement that in mbsync for people using
> slow/expensive links to sync with IMAP.
> 
noted. ;)


--
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: [PATCH] implement gssapi support

2014-06-25 Thread Oswald Buddenhagen
On Wed, Jun 25, 2014 at 02:28:42PM +0200, Jan Synacek wrote:
> Oswald Buddenhagen  writes:
> > note that there is also a sasl branch in git. you can take a lot from
> > the commit and also the review in the commit message.
> > ideally, revive it as well.
> 
> It looks like the sasl code does slightly more than mine, and is
> simpler. Reviving the branch makes sense to me.
> 
> Just to be sure. Do you prefer the sasl implementation, or pure GSSAPI?
> 
if i read it right, SASL is basically a PAM equivalent for network auth,
so it's more generic than interfacing directly with gssapi, and thus
lowers the overall cost.
unless you think it would come with some significant downsides over
gssapi (depedencies?), it probably makes sense to go a sasl-only route.
failing that, it may make sense to have sasl ifdefs, and specific other
ifdefs (gssapi and cram-md5 so far) in the else branches.
convince me either way. :)

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Isync 1.1.1 client->server update failure

2014-06-26 Thread Oswald Buddenhagen
On Fri, Jun 27, 2014 at 01:18:31AM +0400, Evgeniy Berdnikov wrote:
>  The problem is that when I add some mail(s) to local main box,
>  the INBOX on the server side is not updated, but the same operation
>  on other mailbox results in normal mail propagation to server.
> 
i can't see anything obviously wrong, so we need to dig deeper.

>  ~/.isyncrc 
>
just to make sure there isn't still a problem with the wrapper:
- run isync -w
- check that the .mbsyncrc makes sense (post it)
- use mbsync -a to verify that the problem persists

>  I copy this mail to both local folders with Mutt, files are:
> 
> % fgrep -rl 'test.20140...@sie.protva.ru' /var/mail/berd ~/Mail/is_spam
> /var/mail/berd/new/1403799136.4604_1.sie,U=399972
> /home/berd/Mail/is_spam/new/1403799146.4604_3.sie,U=11
> 
just to be sure, the ,U= suffix was not there before you ran isync,
right?

>  Then I run "isync -a -V":
>
please also add -D to the command line.


--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Isync 1.1.1 client->server update failure

2014-06-28 Thread Oswald Buddenhagen
On Fri, Jun 27, 2014 at 12:41:49PM +0400, Evgeniy Berdnikov wrote:
> --- /var/mail/berd/.uidvalidity 
> 1245525174
> 400048
> 
> 
> --- /var/mail/berd/.mbsyncstate 
> MasterUidValidity 1185439805
> SlaveUidValidity 1245525174
> MaxPulledUid 454606
> MaxPushedUid 401558
> 
got it:
for some reason, your MaxPushedUid is higher than the highest UID in
your mailbox (second line in .uidvalidity), so whatever new messages
appear in the mailbox, mbsync thinks it already dealt with them.
judging by the contents of the sync state, the UIDs in the mailbox
actually do reach that high, so for some unholy reason the highest UID
got rewound (and after adding a few more new messages you are going to
get complaints about duplicate UIDs). any idea how that happened?
anyway, you can fix it by setting the highest UID to 402000 for example.

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: zero-terminate imap literals

2014-06-28 Thread Oswald Buddenhagen
commit 8513358e0a3f3d720b394251a018e46ed87ef262
Author: Oswald Buddenhagen 
Date:   Sat Jun 28 11:04:41 2014 +0200

zero-terminate imap literals

now that we properly support literals for strings, we must expect that
the consumer code will use them as strings.

amends fc77feacc.

discovered by Armands Liepins 

REFMAIL: CAF_KswXoxdm7KXnWW4b_1odf=xse4qrqrn4asecwcpf1d+d...@mail.gmail.com

 src/drv_imap.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index adacc43..b1f9de6 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -687,7 +687,8 @@ parse_imap_list( imap_store_t *ctx, char **sp, 
parse_list_state_t *sts )
if (*s != '}' || *++s)
goto bail;
 
-   s = cur->val = nfmalloc( cur->len );
+   s = cur->val = nfmalloc( cur->len + 1 );
+   s[cur->len] = 0;
 
  getbytes:
bytes -= socket_read( &ctx->conn, s, bytes );

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: detect inconsistent state of highest assigned UID

2014-06-28 Thread Oswald Buddenhagen
commit 3d5539bb63b7f494f20357d7491d96228a432600
Author: Oswald Buddenhagen 
Date:   Sat Jun 28 11:58:26 2014 +0200

detect inconsistent state of highest assigned UID

the highest assigned UID must always be at least as high as the highest
actually found UID, as otherwise we'd hand out duplicate UIDs at some
point. also, getting into such a state in the first place indicates some
potentially serious trouble, or at least external interference (e.g.,
moving/copying a message from another folder without giving it a
pristine filename).

REFMAIL: 20140626211831.ga11...@sie.protva.ru

 src/drv_maildir.c |7 +++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/drv_maildir.c b/src/drv_maildir.c
index 0f58318..0142631 100644
--- a/src/drv_maildir.c
+++ b/src/drv_maildir.c
@@ -787,6 +787,13 @@ maildir_scan( maildir_store_t *ctx, msglist_t *msglist )
 #endif
}
uid = entry->uid;
+   if (uid > ctx->nuid) {
+   /* In principle, we could just warn and 
top up nuid. However, getting into this
+* situation might indicate some 
serious trouble, so let's not make it worse. */
+   error( "Maildir error: UID %d is beyond 
highest assigned UID %d.\n", uid, ctx->nuid );
+   maildir_free_scan( msglist );
+   return DRV_BOX_BAD;
+   }
if ((ctx->gen.opts & OPEN_SIZE) || 
((ctx->gen.opts & OPEN_FIND) && uid >= ctx->newuid))
nfsnprintf( buf + bl, sizeof(buf) - bl, 
"%s/%s", subdirs[entry->recent], entry->base );
 #ifdef USE_DB

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: bump version

2014-06-28 Thread Oswald Buddenhagen
commit 060430b23359d3cd8ad7b1531609c329ef22e9c4
Author: Oswald Buddenhagen 
Date:   Sat Jun 28 14:27:04 2014 +0200

bump version

 configure.ac |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure.ac b/configure.ac
index 3a9927d..5bccacf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([isync], [1.1.1])
+AC_INIT([isync], [1.1.2])
 AC_CONFIG_HEADERS([autodefs.h])
 AM_INIT_AUTOMAKE
 

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Troubles syncing 'INBOX' directory

2014-06-28 Thread Oswald Buddenhagen
On Tue, Jun 17, 2014 at 05:55:18PM +0200, Bruno Gonzalez wrote:
> On 14-06-17 17:40:14, Oswald Buddenhagen wrote:
> > i meant
> > Patterns * INBOX
> 
> Not working either.
> 
actually,

  Patterns INBOX* 

would be the correct config for you.
but i don't think that would change anything.

maybe you ran into the same problem that armands discovered. please pull
isync_1_1_branch and see whether it works.
if not, let's start with the output of "mbsync -a -l".

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


Re: Custom IMAP flags

2014-06-29 Thread Oswald Buddenhagen
On Sun, Jun 29, 2014 at 02:09:15PM +0200, Vincent Bernat wrote:
> How could we support them in mbsync?
> 
> If I would like to support them with an ad hoc modification, I think
> this would be easy:
> 
hacking in support for a few fixed flags would be reasonably easy.

>  1. Would the above steps work correctly?
> 
you need to adjust the imap flag parser as well.

>  2. Do I really need to keep the sort order in maildir's Flags array?
>
it's a requirement of maildir.

> It would be easier to add flags from configuration file if I didn't
> have to.
> 
too bad. :P

so far, i thought of a fully dynamic system somewhat inspired by
http://wiki2.dovecot.org/MailboxFormat/Maildir (it might make sense to
store the mapping directly in .uidvalidity).
of course, the downside of such a system would be that it wouldn't be
supported by anything else. i have some vague ideas how to make it
useful with mutt, but that's about it.

a configuration file based system would be easier to implement and would
be indeed more useful in the cases where the MUA already has some
defined meaning for particular flags in maildir.
it would be somewhat higher-maintenance configuration-wise, but i guess
it's acceptable.

it's probably sufficient to support 32 flags total, so 27 custom ones.
the config could look like that:

  Keywords J:$Junk N:$NoJunk a:Green b:Red c:Blue

maybe it should be per-Channel, but i guess we can start with only a
global config.

simply build an array of letter-word pairs from the predefined flags and
the config. then sort it and complain about duplicates. change the
drivers and sync.c to use that instead of its own tables. done.
caveat: the journal replay must refuse to proceed when the mapping
changes (it uses numerical flag values. though it may be a good idea to
change that anyway).

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: actually print the faulty mailbox name, not some garbage

2014-07-01 Thread Oswald Buddenhagen
commit 29b07ca7a6ade43fe47667045fc1e24353dc0ea7
Author: Oswald Buddenhagen 
Date:   Wed Jul 2 08:40:41 2014 +0200

actually print the faulty mailbox name, not some garbage

REFMAIL: CAF_KswU7aBS7unnK+rdZy1PG_8SZUAW=tcg75hixdlle0w3...@mail.gmail.com

 src/sync.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index ec7efa0..463b5f4 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -605,7 +605,7 @@ sync_boxes( store_t *ctx[], const char *names[], 
channel_conf_t *chan,
if (!ctx[t]->conf->flat_delim) {
ctx[t]->name = nfstrdup( ctx[t]->orig_name );
} else if (map_name( ctx[t]->orig_name, &ctx[t]->name, 0, "/", 
ctx[t]->conf->flat_delim ) < 0) {
-   error( "Error: canonical mailbox name '%s' contains 
flattened hierarchy delimiter\n", ctx[t]->name );
+   error( "Error: canonical mailbox name '%s' contains 
flattened hierarchy delimiter\n", ctx[t]->orig_name );
svars->ret = SYNC_FAIL;
sync_bail3( svars );
return;

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: initialize store_t::name

2014-07-01 Thread Oswald Buddenhagen
commit 526231bc223e81978f332e884357049442b380b9
Author: Oswald Buddenhagen 
Date:   Wed Jul 2 08:47:36 2014 +0200

initialize store_t::name

the field is marked foreign (for the drivers), so a recycled store may
contain an old pointer in it. that would make our error path crash.

REFMAIL: CAF_KswU7aBS7unnK+rdZy1PG_8SZUAW=tcg75hixdlle0w3...@mail.gmail.com

 src/sync.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/sync.c b/src/sync.c
index 463b5f4..51c64a9 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -598,6 +598,7 @@ sync_boxes( store_t *ctx[], const char *names[], 
channel_conf_t *chan,
svars->uidval[0] = svars->uidval[1] = -1;
svars->srecadd = &svars->srecs;
 
+   ctx[0]->name = ctx[1]->name = 0;
for (t = 0; t < 2; t++) {
ctx[t]->orig_name =
(!names[t] || (ctx[t]->conf->map_inbox && !strcmp( 
ctx[t]->conf->map_inbox, names[t] ))) ?

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] branch 'master' fast-forwarded

2014-07-05 Thread Oswald Buddenhagen
The branch 'master', previously at 4ab12ae, has been fast-forwarded by
5 revision(s) to 526231b.

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
___
isync-devel mailing list
isync-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/isync-devel


[commit] isync_1_1_branch: don't ignore RequireSSL for PREAUTHenticated connections

2014-07-06 Thread Oswald Buddenhagen
commit 639c84ea28004ea7e28e9a1e1a4f03a9575c84c9
Author: Oswald Buddenhagen 
Date:   Sat Jul 5 22:52:40 2014 +0200

don't ignore RequireSSL for PREAUTHenticated connections

such connections don't support STARTTLS. that is reasonable, as whatever
makes the connection preauthenticated (typically a Tunnel used to launch
imapd via a shell login) must already rely on the connection's security.
consequently, we would not try to use STARTTLS with such connections.
unfortunately, we'd also skip the RequireSSL check as a side effect.

this means that a rogue server (via a MITM attack) could simply offer a
preauthenticated connection to make us not use SSL, and thus bypass
server authentication. as a result, we could send potentially sensitive
data to the attacker:
- with Patterns used, we would send a LIST command which reveals the
  remote Path setting. this isn't very useful to an attacker. also, IMAP
  Accounts usually rely on the server-provided NAMESPACE to start with.
- with Create enabled for the remote Store, we would upload messages
  from newly appeared local folders. this isn't a very likely situation,
  unless the attacker manages to convince the victim to move/copy
  interesting mails to a new folder right before the attack.
- with Expunge enabled for the local Store, previously synchronized
  folders would be wiped. however, this would require the attacker to
  know the correct UIDVALIDITY of each remote folder, which would
  require incredible luck or convincing the victim to disclose them.
  the first mismatch would likely tip off the victim.

in practice, someone with the level of technical and social engineering
skills required for this attack would very likely find more attractive
attack vectors. therefore, i don't consider this a particularly serious
issue.

configurations with UseIMAPS enabled or using a secure Tunnel were not
affected to start with.

a side effect of this fix is that most users of Tunnel will now need to
explicitly set RequireSSL to false.
an alternative approach would be defaulting all SSL-related settings to
off when Tunnel is used. this would be too invasive for a patch release,
but i'll consider it for 1.2.

see also CVE-2014-2567 for the Trojita MUA.

 src/drv_imap.c |   15 ---
 src/mbsync.1   |5 +
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/drv_imap.c b/src/drv_imap.c
index b1f9de6..ebd8bf0 100644
--- a/src/drv_imap.c
+++ b/src/drv_imap.c
@@ -1571,11 +1571,13 @@ imap_open_store_p2( imap_store_t *ctx, struct imap_cmd 
*cmd ATTR_UNUSED, int res
 static void
 imap_open_store_authenticate( imap_store_t *ctx )
 {
-   if (ctx->greeting != GreetingPreauth) {
 #ifdef HAVE_LIBSSL
-   imap_store_conf_t *cfg = (imap_store_conf_t *)ctx->gen.conf;
-   imap_server_conf_t *srvc = cfg->server;
+   imap_store_conf_t *cfg = (imap_store_conf_t *)ctx->gen.conf;
+   imap_server_conf_t *srvc = cfg->server;
+#endif
 
+   if (ctx->greeting != GreetingPreauth) {
+#ifdef HAVE_LIBSSL
if (!srvc->sconf.use_imaps &&
(srvc->sconf.use_sslv2 || srvc->sconf.use_sslv3 || 
srvc->sconf.use_tlsv1)) {
/* always try to select SSL support if available */
@@ -1595,6 +1597,13 @@ imap_open_store_authenticate( imap_store_t *ctx )
 #endif
imap_open_store_authenticate2( ctx );
} else {
+#ifdef HAVE_LIBSSL
+   if (!srvc->sconf.use_imaps && srvc->require_ssl) {
+   error( "IMAP error: SSL support not available\n" );
+   imap_open_store_bail( ctx );
+   return;
+   }
+#endif
imap_open_store_namespace( ctx );
}
 }
diff --git a/src/mbsync.1 b/src/mbsync.1
index a2335d9..d932a36 100644
--- a/src/mbsync.1
+++ b/src/mbsync.1
@@ -267,6 +267,11 @@ Specify a command to run to establish a connection rather 
than opening a TCP
 socket.  This allows you to run an IMAP session over an SSH tunnel, for
 example.
 \fBHost\fR and \fBPort\fR are ignored when \fBTunnel\fR is set.
+.br
+If \fBUseIMAPS\fR is disabled and the tunnel opens a preauthenticated
+connection, \fBRequireSSL\fR also needs to be disabled.
+If the connection is not preauthenticated, but the tunnel is secure,
+disabling \fBRequireSSL\fR and \fBUseTLSv1\fR is recommended.
 ..
 .TP
 \fBRequireCRAM\fR \fIyes\fR|\fIno\fR

--
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 a

<    3   4   5   6   7   8   9   10   11   12   >