dovecot-2.2: lib-imap-urlauth: Fixed URLAUTH connection resume a...
dovecot at dovecot.org
dovecot at dovecot.org
Thu May 30 18:05:20 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/bb221f236d4f
changeset: 16420:bb221f236d4f
user: Stephan Bosch <stephan at rename-it.nl>
date: Thu May 30 18:03:46 2013 +0300
description:
lib-imap-urlauth: Fixed URLAUTH connection resume after error.
diffstat:
src/lib-imap-urlauth/imap-urlauth-connection.c | 41 ++++++++++++++++---------
1 files changed, 26 insertions(+), 15 deletions(-)
diffs (84 lines):
diff -r 3ee64234a125 -r bb221f236d4f src/lib-imap-urlauth/imap-urlauth-connection.c
--- a/src/lib-imap-urlauth/imap-urlauth-connection.c Thu May 30 18:03:38 2013 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth-connection.c Thu May 30 18:03:46 2013 +0300
@@ -317,6 +317,21 @@
i_free(urlreq);
}
+static void imap_urlauth_request_drop(struct imap_urlauth_connection *conn,
+ struct imap_urlauth_request *urlreq)
+{
+ if ((conn->state == IMAP_URLAUTH_STATE_REQUEST_PENDING ||
+ conn->state == IMAP_URLAUTH_STATE_REQUEST_WAIT) &&
+ conn->targets_head != NULL &&
+ conn->targets_head->requests_head == urlreq) {
+ /* cannot just drop pending request without breaking
+ protocol state */
+ return;
+ }
+ imap_urlauth_request_free(urlreq);
+
+}
+
void imap_urlauth_request_abort(struct imap_urlauth_connection *conn,
struct imap_urlauth_request *urlreq)
{
@@ -330,14 +345,7 @@
} T_END;
}
- if (conn->state == IMAP_URLAUTH_STATE_REQUEST_PENDING &&
- conn->targets_head != NULL &&
- conn->targets_head->requests_head == urlreq) {
- /* cannot just drop pending request without breaking
- protocol state */
- return;
- }
- imap_urlauth_request_free(urlreq);
+ imap_urlauth_request_drop(conn, urlreq);
}
static void
@@ -347,6 +355,7 @@
{
struct imap_urlauth_fetch_reply reply;
imap_urlauth_request_callback_t *callback;
+ int ret = 1;
callback = urlreq->callback;
urlreq->callback = NULL;
@@ -358,18 +367,19 @@
reply.error = error;
T_BEGIN {
- (void)callback(&reply, urlreq->context);
+ ret = callback(&reply, urlreq->context);
} T_END;
}
- if (conn->state == IMAP_URLAUTH_STATE_REQUEST_PENDING &&
- conn->targets_head != NULL &&
- conn->targets_head->requests_head == urlreq) {
- /* cannot just drop pending request without breaking protocol state */
- return;
+ imap_urlauth_request_drop(conn, urlreq);
+
+ if (ret < 0) {
+ /* Drop any related requests upon error */
+ imap_urlauth_request_abort_by_context(conn, urlreq->context);
}
- imap_urlauth_request_free(urlreq);
+ if (ret != 0)
+ imap_urlauth_connection_continue(conn);
}
static void
@@ -714,6 +724,7 @@
param[6] != '\0') {
error = param+6;
}
+ conn->state = IMAP_URLAUTH_STATE_REQUEST_WAIT;
imap_urlauth_request_fail(conn,
conn->targets_head->requests_head, error);
return 1;
More information about the dovecot-cvs
mailing list