dovecot-2.2: Fixes IMAP LOGIN REFERRAL to properly encode IMAP URL.
dovecot at dovecot.org
dovecot at dovecot.org
Fri Sep 14 21:04:29 EEST 2012
details: http://hg.dovecot.org/dovecot-2.2/rev/584681a1845c
changeset: 15046:584681a1845c
user: Stephan Bosch <stephan at rename-it.nl>
date: Fri Sep 14 21:04:01 2012 +0300
description:
Fixes IMAP LOGIN REFERRAL to properly encode IMAP URL.
diffstat:
src/imap-login/client-authenticate.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diffs (46 lines):
diff -r 345e96ca65a2 -r 584681a1845c src/imap-login/client-authenticate.c
--- a/src/imap-login/client-authenticate.c Fri Sep 14 21:02:23 2012 +0300
+++ b/src/imap-login/client-authenticate.c Fri Sep 14 21:04:01 2012 +0300
@@ -9,8 +9,10 @@
#include "safe-memset.h"
#include "str.h"
#include "str-sanitize.h"
+#include "network.h"
#include "imap-resp-code.h"
#include "imap-parser.h"
+#include "imap-url.h"
#include "auth-client.h"
#include "client.h"
#include "client-authenticate.h"
@@ -36,6 +38,7 @@
const struct client_auth_reply *reply,
const char *text)
{
+ struct imap_url url;
string_t *referral;
switch (result) {
@@ -54,12 +57,17 @@
.. [REFERRAL ..] (Reason from auth server)
*/
referral = t_str_new(128);
- str_printfa(referral, "REFERRAL imap://%s;AUTH=%s@%s",
- reply->destuser, client->auth_mech_name,
- reply->host);
- if (reply->port != 143)
- str_printfa(referral, ":%u", reply->port);
- str_append(referral, "/");
+
+ memset(&url, 0, sizeof(url));
+ url.userid = reply->destuser;
+ url.auth_type = client->auth_mech_name;
+ url.host_name = reply->host;
+ if (reply->port != 143) {
+ url.have_port = TRUE;
+ url.port = reply->port;
+ }
+ str_append(referral, "REFERRAL ");
+ str_append(referral, imap_url_create(&url));
if (result == CLIENT_AUTH_RESULT_REFERRAL_SUCCESS) {
client_send_reply_code(client, IMAP_CMD_REPLY_OK,
More information about the dovecot-cvs
mailing list