From 21c3870584e5c67dbbdaaebc551bfeef5c601951 Mon Sep 17 00:00:00 2001
From: Timo Sirainen <timo.sirainen@open-xchange.com>
Date: Wed, 21 Jul 2021 17:34:11 +0300
Subject: [PATCH] managesieve-login: Adjust to auth proxy API changes

---
 src/managesieve-login/client-authenticate.c | 7 ++++---
 src/managesieve-login/managesieve-proxy.c   | 5 +++--
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/managesieve-login/client-authenticate.c b/src/managesieve-login/client-authenticate.c
index b186f8440..fe68ca4d1 100644
--- a/src/managesieve-login/client-authenticate.c
+++ b/src/managesieve-login/client-authenticate.c
@@ -64,9 +64,10 @@ void managesieve_client_auth_result(struct client *client,
 		*/
 		referral = t_str_new(128);
 		str_printfa(referral, "REFERRAL sieve://%s;AUTH=%s@%s",
-			    reply->destuser, client->auth_mech_name, reply->host);
-		if ( reply->port != 4190 )
-			str_printfa(referral, ":%u", reply->port);
+			    reply->proxy.username, client->auth_mech_name,
+			    reply->proxy.host);
+		if (reply->proxy.port != 4190)
+			str_printfa(referral, ":%u", reply->proxy.port);
 
 		if ( result == CLIENT_AUTH_RESULT_REFERRAL_SUCCESS ) {
 			client_send_okresp(client, str_c(referral), text);;
diff --git a/src/managesieve-login/managesieve-proxy.c b/src/managesieve-login/managesieve-proxy.c
index 4e7898021..bd95a1f90 100644
--- a/src/managesieve-login/managesieve-proxy.c
+++ b/src/managesieve-login/managesieve-proxy.c
@@ -448,7 +448,7 @@ int managesieve_proxy_parse_line(struct client *client, const char *line)
 	struct managesieve_client *msieve_client =
 		(struct managesieve_client *)client;
 	struct ostream *output;
-	enum login_proxy_ssl_flags ssl_flags;
+	enum auth_proxy_ssl_flags ssl_flags;
 	managesieve_response_t response = MANAGESIEVE_RESPONSE_NONE;
 	string_t *command;
 	int ret = 0;
@@ -473,7 +473,7 @@ int managesieve_proxy_parse_line(struct client *client, const char *line)
 			command = t_str_new(128);
 
 			ssl_flags = login_proxy_get_ssl_flags(client->login_proxy);
-			if ((ssl_flags & PROXY_SSL_FLAG_STARTTLS) != 0) {
+			if ((ssl_flags & AUTH_PROXY_SSL_FLAG_STARTTLS) != 0) {
 				if (!msieve_client->proxy_starttls) {
 					login_proxy_failed(client->login_proxy,
 						login_proxy_get_event(client->login_proxy),
@@ -649,6 +649,7 @@ managesieve_proxy_send_failure_reply(struct client *client,
 	case LOGIN_PROXY_FAILURE_TYPE_INTERNAL:
 	case LOGIN_PROXY_FAILURE_TYPE_REMOTE:
 	case LOGIN_PROXY_FAILURE_TYPE_PROTOCOL:
+	case LOGIN_PROXY_FAILURE_TYPE_AUTH_REDIRECT:
 		client_send_reply_code(client, MANAGESIEVE_CMD_REPLY_NO,
 				       "TRYLATER", LOGIN_PROXY_FAILURE_MSG);
 		break;
-- 
GitLab