dovecot-2.2: imap proxy: Added proxy_nopipelining passdb setting...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Dec 23 15:30:49 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/6b8ae0ba5959
changeset: 17088:6b8ae0ba5959
user: Timo Sirainen <tss at iki.fi>
date: Mon Dec 23 15:30:31 2013 +0200
description:
imap proxy: Added proxy_nopipelining passdb setting to work around other servers' bugs.
diffstat:
src/imap-login/imap-proxy.c | 15 ++++++++++++++-
src/login-common/client-common-auth.c | 3 +++
src/login-common/client-common.h | 2 ++
3 files changed, 19 insertions(+), 1 deletions(-)
diffs (72 lines):
diff -r e322c40a82a9 -r 6b8ae0ba5959 src/imap-login/imap-proxy.c
--- a/src/imap-login/imap-proxy.c Fri Dec 20 19:59:22 2013 +0200
+++ b/src/imap-login/imap-proxy.c Mon Dec 23 15:30:31 2013 +0200
@@ -63,8 +63,13 @@
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 */
@@ -271,6 +276,14 @@
}
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;
diff -r e322c40a82a9 -r 6b8ae0ba5959 src/login-common/client-common-auth.c
--- a/src/login-common/client-common-auth.c Fri Dec 20 19:59:22 2013 +0200
+++ b/src/login-common/client-common-auth.c Mon Dec 23 15:30:31 2013 +0200
@@ -107,6 +107,8 @@
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) {
@@ -350,6 +352,7 @@
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)
diff -r e322c40a82a9 -r 6b8ae0ba5959 src/login-common/client-common.h
--- a/src/login-common/client-common.h Fri Dec 20 19:59:22 2013 +0200
+++ b/src/login-common/client-common.h Mon Dec 23 15:30:31 2013 +0200
@@ -62,6 +62,7 @@
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;
@@ -157,6 +158,7 @@
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;
More information about the dovecot-cvs
mailing list