dovecot-2.1: auth: Added proxy_always extra field.

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 25 07:08:47 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/4bd9cadae9ea
changeset: 14196:4bd9cadae9ea
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Feb 25 07:08:27 2012 +0200
description:
auth: Added proxy_always extra field.
When used with proxy_maybe, it can be used to redirect "local" users to
local backends via director.

diffstat:

 src/auth/auth-request.c |  11 +++++++++++
 src/auth/auth-request.h |   1 +
 2 files changed, 12 insertions(+), 0 deletions(-)

diffs (39 lines):

diff -r cf713cf9b7c0 -r 4bd9cadae9ea src/auth/auth-request.c
--- a/src/auth/auth-request.c	Sat Feb 25 06:41:59 2012 +0200
+++ b/src/auth/auth-request.c	Sat Feb 25 07:08:27 2012 +0200
@@ -1148,6 +1148,12 @@
 		   password back if using plaintext authentication. */
 		request->proxy = TRUE;
 		value = NULL;
+	} else if (strcmp(name, "proxy_always") == 0) {
+		/* when proxy_maybe=yes and proxying wouldn't normally be done,
+		   with this enabled proxy=y is still returned without host.
+		   this can be used to make director set the host. */
+		request->proxy_always = TRUE;
+		value = NULL;
 	} else if (strcmp(name, "proxy_maybe") == 0) {
 		/* like "proxy", but log in normally if we're proxying to
 		   ourself */
@@ -1466,6 +1472,11 @@
 		/* proxying to ourself - log in without proxying by dropping
 		   all the proxying fields. */
 		auth_request_proxy_finish_failure(request);
+		if (request->proxy_always) {
+			/* director adds the host */
+			auth_stream_reply_add(request->extra_fields,
+					      "proxy", NULL);
+		}
 	}
 }
 
diff -r cf713cf9b7c0 -r 4bd9cadae9ea src/auth/auth-request.h
--- a/src/auth/auth-request.h	Sat Feb 25 06:41:59 2012 +0200
+++ b/src/auth/auth-request.h	Sat Feb 25 07:08:27 2012 +0200
@@ -105,6 +105,7 @@
 	unsigned int prefer_plain_credentials:1;
 	unsigned int proxy:1;
 	unsigned int proxy_maybe:1;
+	unsigned int proxy_always:1;
 	unsigned int proxy_host_is_self:1;
 	unsigned int valid_client_cert:1;
 	unsigned int no_penalty:1;


More information about the dovecot-cvs mailing list