]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Merged changes from v2.1 tree.
authorTimo Sirainen <tss@iki.fi>
Thu, 30 Aug 2012 19:05:02 +0000 (22:05 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 30 Aug 2012 19:05:02 +0000 (22:05 +0300)
21 files changed:
1  2 
configure.in
src/auth/auth-client-connection.c
src/auth/auth-master-connection.c
src/auth/auth-request-handler.c
src/auth/mech.c
src/doveadm/Makefile.am
src/doveadm/doveadm-mail-copymove.c
src/doveadm/doveadm-mail.c
src/doveadm/doveadm-mail.h
src/imap/cmd-list.c
src/imap/imap-commands-util.c
src/lib-dict/dict-file.c
src/lib-dict/dict-redis.c
src/lib-imap-client/imapc-client.c
src/lib-imap-client/imapc-connection.c
src/lib-storage/index/imapc/imapc-list.c
src/lib-storage/list/mailbox-list-fs-iter.c
src/lib-storage/mail-storage-settings.c
src/lmtp/commands.c
src/lmtp/lmtp-proxy.c
src/lmtp/lmtp-proxy.h

diff --cc configure.in
Simple merge
Simple merge
index 2d10930a995f5d4d3f423c3b5e5a8d8d1634db2f,5fdfaea890bb4e6b848337aeff83c151fdf36c3b..66cdb2bc1427c989f039b5896f71b72fff9960c3
@@@ -342,10 -342,10 +342,10 @@@ static void pass_callback_finish(struc
        }
  
        if (conn->auth->set->debug)
-               i_debug("master out: %s", str_c(str));
+               i_debug("passdb out: %s", str_c(str));
  
        str_append_c(str, '\n');
 -      (void)o_stream_send(conn->output, str_data(str), str_len(str));
 +      o_stream_nsend(conn->output, str_data(str), str_len(str));
  
        auth_request_unref(&auth_request);
        auth_master_connection_unref(&conn);
Simple merge
diff --cc src/auth/mech.c
Simple merge
Simple merge
index 8705a096660fb20c75ab87c200cdc14bfaf84147,c3fd27405c50d2dd067b1b9790db1dfd5d2e552e..db357f47a84770b1c27937a7d2d23e61204490de
@@@ -40,11 -44,12 +44,12 @@@ cmd_copy_box(struct copy_cmd_context *c
        while (doveadm_mail_iter_next(iter, &mail)) {
                save_ctx = mailbox_save_alloc(desttrans);
                mailbox_save_copy_flags(save_ctx, mail);
-               if (mailbox_copy(&save_ctx, mail) == 0)
-                       mail_expunge(mail);
-               else {
+               if (mailbox_copy(&save_ctx, mail) == 0) {
+                       if (ctx->move)
+                               mail_expunge(mail);
+               } else {
                        i_error("Copying message UID %u from '%s' failed: %s",
 -                              mail->uid, info->name,
 +                              mail->uid, info->vname,
                                mailbox_get_last_error(destbox, NULL));
                        doveadm_mail_failed_mailbox(&ctx->ctx, destbox);
                        ret = -1;
Simple merge
Simple merge
index 48c09fbee76716b9b01d6ea2199bd063fc42da65,29b5108f14eb5a118458c19ef82a105359eeed4f..bf602ed6928d7af30f0b91853aa30aeb9421d803
@@@ -155,6 -181,103 +155,19 @@@ parse_return_flags(struct cmd_list_cont
        return TRUE;
  }
  
 -static enum mailbox_info_flags
 -list_get_inbox_flags(struct cmd_list_context *ctx)
 -{
 -      struct mail_namespace *ns;
 -      struct mailbox_list_iterate_context *list_iter;
 -      const struct mailbox_info *info;
 -      enum mailbox_info_flags flags = MAILBOX_UNMARKED;
 -
 -      if (ctx->seen_inbox_namespace &&
 -          (ctx->ns->flags & NAMESPACE_FLAG_INBOX_USER) == 0) {
 -              /* INBOX doesn't exist. use the default INBOX flags */
 -              return flags;
 -      }
 -
 -      /* find the INBOX flags */
 -      ns = mail_namespace_find_inbox(ctx->cmd->client->user->namespaces);
 -      list_iter = mailbox_list_iter_init(ns->list, "INBOX", 0);
 -      info = mailbox_list_iter_next(list_iter);
 -      if (info != NULL) {
 -              i_assert(strcasecmp(info->name, "INBOX") == 0);
 -              flags = info->flags;
 -      }
 -      (void)mailbox_list_iter_deinit(&list_iter);
 -      return flags;
 -}
 -
 -static bool list_namespace_has_children(struct cmd_list_context *ctx)
 -{
 -      enum mailbox_list_iter_flags list_flags =
 -              MAILBOX_LIST_ITER_RETURN_NO_FLAGS;
 -      struct mailbox_list_iterate_context *list_iter;
 -      const struct mailbox_info *info;
 -      bool ret = FALSE;
 -
 -      if ((ctx->list_flags & MAILBOX_LIST_ITER_SELECT_SUBSCRIBED) != 0)
 -              list_flags |= MAILBOX_LIST_ITER_SELECT_SUBSCRIBED;
 -
 -      list_iter = mailbox_list_iter_init(ctx->ns->list,
 -              t_strconcat(ctx->ns->prefix, "%", NULL), list_flags);
 -      info = mailbox_list_iter_next(list_iter);
 -      if (info != NULL)
 -              ret = TRUE;
 -      if (mailbox_list_iter_deinit(&list_iter) < 0) {
 -              /* safer to answer TRUE in error conditions */
 -              ret = TRUE;
 -      }
 -      return ret;
 -}
 -
+ static const char *ns_prefix_mutf7(struct mail_namespace *ns)
+ {
+       string_t *str;
+       if (*ns->prefix == '\0')
+               return "";
+       str = t_str_new(64);
+       if (imap_utf8_to_utf7(ns->prefix, str) < 0)
+               i_panic("Namespace prefix not UTF-8: %s", ns->prefix);
+       return str_c(str);
+ }
 -static const char *ns_get_listed_prefix(struct cmd_list_context *ctx)
 -{
 -      struct imap_match_glob *glob;
 -      enum imap_match_result match;
 -      const char *ns_prefix, *p;
 -      bool inboxcase;
 -      unsigned int skip_len;
 -
 -      skip_len = strlen(ctx->ref);
 -      if (strncmp(ctx->ns->prefix, ctx->ref, skip_len) != 0)
 -              skip_len = 0;
 -
 -      inboxcase = strncasecmp(ctx->ns->prefix, "INBOX", 5) == 0 &&
 -              ctx->ns->prefix[5] == mail_namespace_get_sep(ctx->ns);
 -      glob = imap_match_init_multiple(pool_datastack_create(),
 -                                      ctx->patterns, inboxcase,
 -                                      mail_namespace_get_sep(ctx->ns));
 -      ns_prefix = ctx->ns->prefix + skip_len;
 -      match = imap_match(glob, ns_prefix);
 -      if (match == IMAP_MATCH_YES) {
 -              return !ctx->cur_ns_skip_trailing_sep ? ctx->ns->prefix :
 -                      t_strndup(ctx->ns->prefix, strlen(ctx->ns->prefix)-1);
 -      }
 -
 -      while ((match & IMAP_MATCH_PARENT) != 0) {
 -              p = strrchr(ns_prefix, mail_namespace_get_sep(ctx->ns));
 -              i_assert(p != NULL);
 -              ns_prefix = t_strdup_until(ns_prefix, p);
 -              match = imap_match(glob, ns_prefix);
 -      }
 -      i_assert(match == IMAP_MATCH_YES);
 -      return t_strconcat(t_strndup(ctx->ns->prefix, skip_len),
 -                         ns_prefix, NULL);
 -}
 -
  static void list_reply_append_ns_sep_param(string_t *str, char sep)
  {
        str_append_c(str, '"');
@@@ -374,6 -955,10 +387,10 @@@ bool cmd_list_full(struct client_comman
                return TRUE;
        }
        str = t_str_new(64);
 -      if (imap_utf7_to_utf8(ctx->ref, str) == 0)
 -              ctx->ref = p_strdup(cmd->pool, str_c(str));
++      if (imap_utf7_to_utf8(ref, str) == 0)
++              ref = p_strdup(cmd->pool, str_c(str));
+       str_truncate(str, 0);
        if (imap_arg_get_list_full(&args[1], &list_args, &arg_count)) {
                ctx->used_listext = TRUE;
                /* convert pattern list to string array */
Simple merge
Simple merge
Simple merge
Simple merge
index 77727c1ca942c9a227d9c97e3eb21bb4f9d32d29,ea97d39682d5267d0846e1f52b96c876e111307b..d904e643a68b3fe73f5eb5a2d349f9789d1a5b05
@@@ -314,16 -302,10 +314,17 @@@ static bool client_proxy_rcpt(struct cl
                return TRUE;
        }
        if (client->proxy == NULL) {
 -              client->proxy = lmtp_proxy_init(client->set->hostname,
 -                                              dns_client_socket_path,
 -                                              client->state.session_id,
 -                                              client->output);
 +              struct lmtp_proxy_settings proxy_set;
 +
 +              memset(&proxy_set, 0, sizeof(proxy_set));
 +              proxy_set.my_hostname = client->set->hostname;
 +              proxy_set.dns_client_socket_path = dns_client_socket_path;
++              proxy_set.session_id = client->state.session_id;
 +              proxy_set.source_ip = client->remote_ip;
 +              proxy_set.source_port = client->remote_port;
 +              proxy_set.proxy_ttl = client->proxy_ttl-1;
 +
 +              client->proxy = lmtp_proxy_init(&proxy_set, client->output);
                if (client->state.mail_body_8bitmime)
                        args = " BODY=8BITMIME";
                else if (client->state.mail_body_7bit)
index 2542a92e64c6d10ca4269a343116eb9ab57c6d5c,2128c2b5cf6cda6434e4c2f2ff4d9a5bb1a2918f..9d898927e353dfe00df3c9797cde2c7988a38042
@@@ -66,13 -66,10 +66,14 @@@ lmtp_proxy_init(const struct lmtp_proxy
        pool = pool_alloconly_create("lmtp proxy", 1024);
        proxy = p_new(pool, struct lmtp_proxy, 1);
        proxy->pool = pool;
 -      proxy->my_hostname = p_strdup(pool, my_hostname);
        proxy->client_output = client_output;
 -      proxy->dns_client_socket_path = p_strdup(pool, dns_client_socket_path);
 -      proxy->session_id = p_strdup(pool, session_id);
 +      proxy->set.my_hostname = p_strdup(pool, set->my_hostname);
 +      proxy->set.dns_client_socket_path =
 +              p_strdup(pool, set->dns_client_socket_path);
++      proxy->set.session_id = p_strdup(pool, set->session_id);
 +      proxy->set.source_ip = set->source_ip;
 +      proxy->set.source_port = set->source_port;
 +      proxy->set.proxy_ttl = set->proxy_ttl;
        i_array_init(&proxy->rcpt_to, 32);
        i_array_init(&proxy->connections, 32);
        return proxy;
@@@ -272,8 -265,9 +273,9 @@@ static void lmtp_proxy_conn_timeout(str
        const char *line;
  
        line = t_strdup_printf(ERRSTR_TEMP_REMOTE_FAILURE
-                              " (timeout while waiting for reply to %s)",
-                              lmtp_client_state_to_string(conn->client));
+                              " (timeout while waiting for reply to %s) <%s>",
+                              lmtp_client_state_to_string(conn->client),
 -                             conn->proxy->session_id);
++                             conn->proxy->set.session_id);
        lmtp_client_fail(conn->client, line);
  }
  
index 3e0f2ffd3b60cd5c7d529a4088ee734073967b8f,923d990a09fca694a25f375914d231b36140d6db..1658a513e80d6d692ae89218f062243592a68852
@@@ -4,19 -4,7 +4,20 @@@
  #include "network.h"
  #include "lmtp-client.h"
  
 +#define LMTP_PROXY_DEFAULT_TTL 5
 +
  struct lmtp_proxy_settings {
 +      const char *my_hostname;
 +      const char *dns_client_socket_path;
++      const char *session_id;
 +
 +      /* the original client's IP/port that connected to the proxy */
 +      struct ip_addr source_ip;
 +      unsigned int source_port;
 +      unsigned int proxy_ttl;
 +};
 +
 +struct lmtp_proxy_rcpt_settings {
        const char *host;
        unsigned int port;
        unsigned int timeout_msecs;