Merge branch '1.3'
Conflicts: configure.ac
This commit is contained in:
commit
904858365d
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -21,6 +21,7 @@
|
||||||
/install-sh
|
/install-sh
|
||||||
/isync.spec
|
/isync.spec
|
||||||
/isync-*.tar.gz
|
/isync-*.tar.gz
|
||||||
|
/isync-*.tar.gz.asc
|
||||||
/missing
|
/missing
|
||||||
/patch-stamp
|
/patch-stamp
|
||||||
/stamp-h
|
/stamp-h
|
||||||
|
|
17
configure.ac
17
configure.ac
|
@ -11,6 +11,23 @@ fi
|
||||||
|
|
||||||
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
|
||||||
|
|
||||||
|
AC_CHECK_PROG(PERL, perl, perl)
|
||||||
|
if test "x$PERL" = "x"; then
|
||||||
|
AC_MSG_ERROR([perl not found])
|
||||||
|
fi
|
||||||
|
|
||||||
|
need_perl=5.14
|
||||||
|
AC_CACHE_CHECK([whether perl is recent enough], ob_cv_perl_ver, [
|
||||||
|
if $PERL -e "use v$need_perl;"; then
|
||||||
|
ob_cv_perl_ver=yes
|
||||||
|
else
|
||||||
|
ob_cv_perl_ver=no
|
||||||
|
fi
|
||||||
|
])
|
||||||
|
if test "x$ob_cv_perl_ver" = "xno"; then
|
||||||
|
AC_MSG_ERROR([perl is too old])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_CACHE_CHECK([whether strftime supports %z], ob_cv_strftime_z,
|
AC_CACHE_CHECK([whether strftime supports %z], ob_cv_strftime_z,
|
||||||
[AC_TRY_RUN(
|
[AC_TRY_RUN(
|
||||||
[#include <time.h>
|
[#include <time.h>
|
||||||
|
|
|
@ -355,6 +355,8 @@ load_config( const char *where, int pseudo )
|
||||||
if (store) {
|
if (store) {
|
||||||
if (!store->max_size)
|
if (!store->max_size)
|
||||||
store->max_size = INT_MAX;
|
store->max_size = INT_MAX;
|
||||||
|
if (!store->flat_delim)
|
||||||
|
store->flat_delim = "";
|
||||||
*storeapp = store;
|
*storeapp = store;
|
||||||
storeapp = &store->next;
|
storeapp = &store->next;
|
||||||
*storeapp = 0;
|
*storeapp = 0;
|
||||||
|
|
|
@ -2250,7 +2250,7 @@ imap_open_store_namespace( imap_store_t *ctx )
|
||||||
|
|
||||||
ctx->state = SST_HALF;
|
ctx->state = SST_HALF;
|
||||||
ctx->prefix = cfg->gen.path;
|
ctx->prefix = cfg->gen.path;
|
||||||
ctx->delimiter[0] = cfg->delimiter ? cfg->delimiter : 0;
|
ctx->delimiter[0] = cfg->delimiter;
|
||||||
if (((!ctx->prefix && cfg->use_namespace) || !cfg->delimiter) && CAP(NAMESPACE)) {
|
if (((!ctx->prefix && cfg->use_namespace) || !cfg->delimiter) && CAP(NAMESPACE)) {
|
||||||
/* get NAMESPACE info */
|
/* get NAMESPACE info */
|
||||||
if (!ctx->got_namespace)
|
if (!ctx->got_namespace)
|
||||||
|
@ -2388,7 +2388,7 @@ imap_open_box_p2( imap_store_t *ctx, imap_cmd_t *gcmd, int response )
|
||||||
INIT_IMAP_CMD(imap_cmd_open_box_t, cmd, cmdp->callback, cmdp->callback_aux)
|
INIT_IMAP_CMD(imap_cmd_open_box_t, cmd, cmdp->callback, cmdp->callback_aux)
|
||||||
cmd->gen.param.lastuid = 1;
|
cmd->gen.param.lastuid = 1;
|
||||||
imap_exec( ctx, &cmd->gen, imap_open_box_p3,
|
imap_exec( ctx, &cmd->gen, imap_open_box_p3,
|
||||||
"UID FETCH *:* (UID)" );
|
"UID FETCH * (UID)" );
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1153,28 +1153,29 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
int off, in_msgid = 0;
|
int off, in_msgid = 0;
|
||||||
while ((want_tuid || want_msgid) && fgets( nbuf, sizeof(nbuf), f )) {
|
char lnbuf[1000]; // Says RFC2822
|
||||||
int bufl = strlen( nbuf );
|
while ((want_tuid || want_msgid) && fgets( lnbuf, sizeof(lnbuf), f )) {
|
||||||
if (bufl && nbuf[bufl - 1] == '\n')
|
int bufl = strlen( lnbuf );
|
||||||
|
if (bufl && lnbuf[bufl - 1] == '\n')
|
||||||
--bufl;
|
--bufl;
|
||||||
if (bufl && nbuf[bufl - 1] == '\r')
|
if (bufl && lnbuf[bufl - 1] == '\r')
|
||||||
--bufl;
|
--bufl;
|
||||||
if (!bufl)
|
if (!bufl)
|
||||||
break;
|
break;
|
||||||
if (want_tuid && starts_with( nbuf, bufl, "X-TUID: ", 8 )) {
|
if (want_tuid && starts_with( lnbuf, bufl, "X-TUID: ", 8 )) {
|
||||||
if (bufl < 8 + TUIDL) {
|
if (bufl < 8 + TUIDL) {
|
||||||
error( "Maildir error: malformed X-TUID header (UID %u)\n", uid );
|
error( "Maildir error: malformed X-TUID header (UID %u)\n", uid );
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
memcpy( entry->tuid, nbuf + 8, TUIDL );
|
memcpy( entry->tuid, lnbuf + 8, TUIDL );
|
||||||
want_tuid = 0;
|
want_tuid = 0;
|
||||||
in_msgid = 0;
|
in_msgid = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (want_msgid && starts_with_upper( nbuf, bufl, "MESSAGE-ID:", 11 )) {
|
if (want_msgid && starts_with_upper( lnbuf, bufl, "MESSAGE-ID:", 11 )) {
|
||||||
off = 11;
|
off = 11;
|
||||||
} else if (in_msgid) {
|
} else if (in_msgid) {
|
||||||
if (!isspace( nbuf[0] )) {
|
if (!isspace( lnbuf[0] )) {
|
||||||
in_msgid = 0;
|
in_msgid = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1182,13 +1183,13 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
while (off < bufl && isspace( nbuf[off] ))
|
while (off < bufl && isspace( lnbuf[off] ))
|
||||||
off++;
|
off++;
|
||||||
if (off == bufl) {
|
if (off == bufl) {
|
||||||
in_msgid = 1;
|
in_msgid = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
entry->msgid = nfstrndup( nbuf + off, bufl - off );
|
entry->msgid = nfstrndup( lnbuf + off, bufl - off );
|
||||||
want_msgid = 0;
|
want_msgid = 0;
|
||||||
in_msgid = 0;
|
in_msgid = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -983,7 +983,7 @@ store_connected( int sts, void *aux )
|
||||||
flags |= LIST_INBOX;
|
flags |= LIST_INBOX;
|
||||||
} else if (c == '/') {
|
} else if (c == '/') {
|
||||||
/* Flattened sub-folders of INBOX actually end up in Path. */
|
/* Flattened sub-folders of INBOX actually end up in Path. */
|
||||||
if (mvars->ctx[t]->conf->flat_delim)
|
if (mvars->ctx[t]->conf->flat_delim[0])
|
||||||
flags |= LIST_PATH;
|
flags |= LIST_PATH;
|
||||||
else
|
else
|
||||||
flags |= LIST_INBOX;
|
flags |= LIST_INBOX;
|
||||||
|
@ -1027,7 +1027,7 @@ store_listed( int sts, string_list_t *boxes, void *aux )
|
||||||
return;
|
return;
|
||||||
case DRV_OK:
|
case DRV_OK:
|
||||||
for (box = boxes; box; box = box->next) {
|
for (box = boxes; box; box = box->next) {
|
||||||
if (mvars->ctx[t]->conf->flat_delim) {
|
if (mvars->ctx[t]->conf->flat_delim[0]) {
|
||||||
string_list_t *nbox;
|
string_list_t *nbox;
|
||||||
if (map_name( box->string, (char **)&nbox, offsetof(string_list_t, string), mvars->ctx[t]->conf->flat_delim, "/" ) < 0) {
|
if (map_name( box->string, (char **)&nbox, offsetof(string_list_t, string), mvars->ctx[t]->conf->flat_delim, "/" ) < 0) {
|
||||||
error( "Error: flattened mailbox name '%s' contains canonical hierarchy delimiter\n", box->string );
|
error( "Error: flattened mailbox name '%s' contains canonical hierarchy delimiter\n", box->string );
|
||||||
|
|
|
@ -30,9 +30,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LIBSSL
|
#ifdef HAVE_LIBSSL
|
||||||
typedef struct ssl_st SSL;
|
# include <openssl/ssl.h>
|
||||||
typedef struct ssl_ctx_st SSL_CTX;
|
|
||||||
typedef struct stack_st _STACK;
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SSLv3 = 2,
|
SSLv3 = 2,
|
||||||
|
|
|
@ -1014,7 +1014,7 @@ sync_boxes( store_t *ctx[], const char *names[], int present[], channel_conf_t *
|
||||||
svars->orig_name[t] =
|
svars->orig_name[t] =
|
||||||
(!names[t] || (ctx[t]->conf->map_inbox && !strcmp( ctx[t]->conf->map_inbox, names[t] ))) ?
|
(!names[t] || (ctx[t]->conf->map_inbox && !strcmp( ctx[t]->conf->map_inbox, names[t] ))) ?
|
||||||
"INBOX" : names[t];
|
"INBOX" : names[t];
|
||||||
if (!ctx[t]->conf->flat_delim) {
|
if (!ctx[t]->conf->flat_delim[0]) {
|
||||||
svars->box_name[t] = nfstrdup( svars->orig_name[t] );
|
svars->box_name[t] = nfstrdup( svars->orig_name[t] );
|
||||||
} else if (map_name( svars->orig_name[t], &svars->box_name[t], 0, "/", ctx[t]->conf->flat_delim ) < 0) {
|
} else if (map_name( svars->orig_name[t], &svars->box_name[t], 0, "/", ctx[t]->conf->flat_delim ) < 0) {
|
||||||
error( "Error: canonical mailbox name '%s' contains flattened hierarchy delimiter\n", svars->orig_name[t] );
|
error( "Error: canonical mailbox name '%s' contains flattened hierarchy delimiter\n", svars->orig_name[t] );
|
||||||
|
|
27
src/util.c
27
src/util.c
|
@ -479,19 +479,20 @@ map_name( const char *arg, char **result, int reserve, const char *in, const cha
|
||||||
char *p;
|
char *p;
|
||||||
int i, l, ll, num, inl, outl;
|
int i, l, ll, num, inl, outl;
|
||||||
|
|
||||||
|
assert( arg );
|
||||||
l = strlen( arg );
|
l = strlen( arg );
|
||||||
if (!in) {
|
assert( in );
|
||||||
|
inl = strlen( in );
|
||||||
|
if (!inl) {
|
||||||
copy:
|
copy:
|
||||||
*result = nfmalloc( reserve + l + 1 );
|
*result = nfmalloc( reserve + l + 1 );
|
||||||
memcpy( *result + reserve, arg, l + 1 );
|
memcpy( *result + reserve, arg, l + 1 );
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
inl = strlen( in );
|
assert( out );
|
||||||
if (out) {
|
outl = strlen( out );
|
||||||
outl = strlen( out );
|
if (equals( in, inl, out, outl ))
|
||||||
if (inl == outl && !memcmp( in, out, inl ))
|
goto copy;
|
||||||
goto copy;
|
|
||||||
}
|
|
||||||
for (num = 0, i = 0; i < l; ) {
|
for (num = 0, i = 0; i < l; ) {
|
||||||
for (ll = 0; ll < inl; ll++)
|
for (ll = 0; ll < inl; ll++)
|
||||||
if (arg[i + ll] != in[ll])
|
if (arg[i + ll] != in[ll])
|
||||||
|
@ -500,7 +501,7 @@ map_name( const char *arg, char **result, int reserve, const char *in, const cha
|
||||||
i += inl;
|
i += inl;
|
||||||
continue;
|
continue;
|
||||||
fout:
|
fout:
|
||||||
if (out) {
|
if (outl) {
|
||||||
for (ll = 0; ll < outl; ll++)
|
for (ll = 0; ll < outl; ll++)
|
||||||
if (arg[i + ll] != out[ll])
|
if (arg[i + ll] != out[ll])
|
||||||
goto fnexti;
|
goto fnexti;
|
||||||
|
@ -511,7 +512,7 @@ map_name( const char *arg, char **result, int reserve, const char *in, const cha
|
||||||
}
|
}
|
||||||
if (!num)
|
if (!num)
|
||||||
goto copy;
|
goto copy;
|
||||||
if (!out)
|
if (!outl)
|
||||||
return -2;
|
return -2;
|
||||||
*result = nfmalloc( reserve + l + num * (outl - inl) + 1 );
|
*result = nfmalloc( reserve + l + num * (outl - inl) + 1 );
|
||||||
p = *result + reserve;
|
p = *result + reserve;
|
||||||
|
@ -519,15 +520,7 @@ map_name( const char *arg, char **result, int reserve, const char *in, const cha
|
||||||
for (ll = 0; ll < inl; ll++)
|
for (ll = 0; ll < inl; ll++)
|
||||||
if (arg[i + ll] != in[ll])
|
if (arg[i + ll] != in[ll])
|
||||||
goto rnexti;
|
goto rnexti;
|
||||||
#ifdef __GNUC__
|
|
||||||
# pragma GCC diagnostic push
|
|
||||||
/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42145 */
|
|
||||||
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
|
||||||
#endif
|
|
||||||
memcpy( p, out, outl );
|
memcpy( p, out, outl );
|
||||||
#ifdef __GNUC__
|
|
||||||
# pragma GCC diagnostic pop
|
|
||||||
#endif
|
|
||||||
p += outl;
|
p += outl;
|
||||||
i += inl;
|
i += inl;
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user