From a552fc8377668e2d94cf77fd60995626fc30db01 Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan.bosch@open-xchange.com> Date: Sun, 10 Oct 2021 22:39:43 +0200 Subject: [PATCH] managesieve-login: client-authenticate - Use the new Sieve URL API. --- src/managesieve-login/client-authenticate.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/managesieve-login/client-authenticate.c b/src/managesieve-login/client-authenticate.c index 0e9111fdd..0b8a08229 100644 --- a/src/managesieve-login/client-authenticate.c +++ b/src/managesieve-login/client-authenticate.c @@ -15,6 +15,7 @@ #include "managesieve-parser.h" #include "managesieve-protocol.h" #include "managesieve-quote.h" +#include "managesieve-url.h" #include "client.h" #include "client-authenticate.h" @@ -45,6 +46,7 @@ void managesieve_client_auth_result(struct client *client, { struct managesieve_client *msieve_client = (struct managesieve_client *)client; + struct managesieve_url url; string_t *referral; switch (result) { @@ -63,11 +65,13 @@ void managesieve_client_auth_result(struct client *client, .. [REFERRAL ..] Reason from auth server */ referral = t_str_new(128); - str_printfa(referral, "REFERRAL sieve://%s;AUTH=%s@%s", - reply->proxy.username, client->auth_mech_name, - reply->proxy.host); - if (reply->proxy.port != MANAGESIEVE_DEFAULT_PORT) - str_printfa(referral, ":%u", reply->proxy.port); + + i_zero(&url); + url.user = reply->proxy.username; + url.host.name = reply->proxy.host; + url.port = reply->proxy.port; + str_append(referral, "REFERRAL "); + str_append(referral, managesieve_url_create(&url)); if (result == CLIENT_AUTH_RESULT_REFERRAL_SUCCESS) client_send_okresp(client, str_c(referral), text); -- GitLab