client->set.username = p_strdup(pool, set->username);
client->set.password = p_strdup(pool, set->password);
client->set.sasl_mechanisms = p_strdup(pool, set->sasl_mechanisms);
+ client->set.use_proxyauth = set->use_proxyauth;
client->set.dns_client_socket_path =
p_strdup(pool, set->dns_client_socket_path);
client->set.temp_path_prefix =
/* Space-separated list of SASL mechanisms to try (in the specified
order). The default is to use only LOGIN command or SASL PLAIN. */
const char *sasl_mechanisms;
+ bool use_proxyauth; /* Use Sun/Oracle PROXYAUTH command */
unsigned int max_idle_time;
const char *dns_client_socket_path;
imapc_connection_auth_finish(conn, reply);
}
+static void
+imapc_connection_proxyauth_login_cb(const struct imapc_command_reply *reply,
+ void *context)
+{
+ struct imapc_connection *conn = context;
+ const struct imapc_client_settings *set = &conn->client->set;
+ struct imapc_command *cmd;
+
+ if (reply->state == IMAPC_COMMAND_STATE_OK) {
+ cmd = imapc_connection_cmd(conn, imapc_connection_login_cb,
+ conn);
+ imapc_command_set_flags(cmd, IMAPC_COMMAND_FLAG_PRELOGIN);
+ imapc_command_sendf(cmd, "PROXYAUTH %s", set->username);
+ imapc_command_send_more(conn);
+ } else {
+ imapc_connection_auth_finish(conn, reply);
+ }
+}
+
static void
imapc_connection_authenticate_cb(const struct imapc_command_reply *reply,
void *context)
}
}
+ if (set->use_proxyauth && set->master_user != NULL) {
+ /* We can use LOGIN command */
+ cmd = imapc_connection_cmd(conn, imapc_connection_proxyauth_login_cb,
+ conn);
+ imapc_command_set_flags(cmd, IMAPC_COMMAND_FLAG_PRELOGIN);
+ imapc_command_sendf(cmd, "LOGIN %s %s",
+ set->master_user, set->password);
+ return;
+ }
if (sasl_mech == NULL &&
((set->master_user == NULL &&
!need_literal(set->username) && !need_literal(set->password)) ||
{ "search", IMAPC_FEATURE_SEARCH },
{ "zimbra-workarounds", IMAPC_FEATURE_ZIMBRA_WORKAROUNDS },
{ "no-examine", IMAPC_FEATURE_NO_EXAMINE },
+ { "proxyauth", IMAPC_FEATURE_PROXYAUTH },
{ NULL, 0 }
};
IMAPC_FEATURE_GMAIL_MIGRATION = 0x08,
IMAPC_FEATURE_SEARCH = 0x10,
IMAPC_FEATURE_ZIMBRA_WORKAROUNDS = 0x20,
- IMAPC_FEATURE_NO_EXAMINE = 0x40
+ IMAPC_FEATURE_NO_EXAMINE = 0x40,
+ IMAPC_FEATURE_PROXYAUTH = 0x80
};
/* </settings checks> */
return -1;
}
set.sasl_mechanisms = imapc_set->imapc_sasl_mechanisms;
+ set.use_proxyauth = (imapc_set->parsed_features & IMAPC_FEATURE_PROXYAUTH) != 0;
set.max_idle_time = imapc_set->imapc_max_idle_time;
set.dns_client_socket_path = *ns->user->set->base_dir == '\0' ? "" :
t_strconcat(ns->user->set->base_dir, "/",