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, '"');
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 */
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)
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;
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);
}