unsigned int len;
const char *mech_name, *error;
- if (client->proxy_backend_capability == NULL)
+ if (client->proxy_backend_capability == NULL) {
str_append(str, "C CAPABILITY\r\n");
+ if (client->common.proxy_nopipelining) {
+ /* authenticate only after receiving C OK reply. */
+ return 0;
+ }
+ }
if (client->common.proxy_mech == NULL) {
/* logging in normally - use LOGIN command */
}
o_stream_nsend(output, str_data(str), str_len(str));
return 1;
+ } else if (strncmp(line, "C OK ", 5) == 0 &&
+ client->proxy_password != NULL) {
+ /* pipelining was disabled, send the login now. */
+ str = t_str_new(128);
+ if (proxy_write_login(imap_client, str) < 0)
+ return -1;
+ o_stream_nsend(output, str_data(str), str_len(str));
+ return 1;
} else if (strncmp(line, "L OK ", 5) == 0) {
/* Login successful. Send this line to client. */
client->proxy_state = IMAP_PROXY_STATE_LOGIN;
reply_r->proxy_refresh_secs = atoi(value);
else if (strcmp(key, "proxy_mech") == 0)
reply_r->proxy_mech = value;
+ else if (strcmp(key, "proxy_nopipelining") == 0)
+ reply_r->proxy_nopipelining = TRUE;
else if (strcmp(key, "master") == 0)
reply_r->master_user = value;
else if (strcmp(key, "ssl") == 0) {
client->proxy_user = i_strdup(reply->destuser);
client->proxy_master_user = i_strdup(reply->master_user);
client->proxy_password = i_strdup(reply->password);
+ client->proxy_nopipelining = reply->proxy_nopipelining;
/* disable input until authentication is finished */
if (client->io != NULL)
enum login_proxy_ssl_flags ssl_flags;
unsigned int proxy:1;
+ unsigned int proxy_nopipelining:1;
unsigned int temp:1;
unsigned int nologin:1;
unsigned int authz_failure:1;
unsigned int auth_initializing:1;
unsigned int auth_process_comm_fail:1;
unsigned int proxy_auth_failed:1;
+ unsigned int proxy_nopipelining:1;
unsigned int auth_waiting:1;
unsigned int auth_user_disabled:1;
unsigned int auth_pass_expired:1;