dovecot-2.2: imap: Fixed segfault in URLFETCH command.
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/8d20f3cde49a
changeset: 16424:8d20f3cde49a
user: Stephan Bosch <stephan at rename-it.nl>
date: Thu May 30 18:04:52 2013 +0300
description:
imap: Fixed segfault in URLFETCH command.
Command would be cleaned up while requests were still pending, causing a
segfault once a request finished. Added API determining whether the URLAUTH
fetch interface still has pending requests.
diffstat:
src/imap/cmd-urlfetch.c | 8 +++-----
src/lib-imap-urlauth/imap-urlauth-fetch.c | 4 ++++
src/lib-imap-urlauth/imap-urlauth-fetch.h | 2 ++
3 files changed, 9 insertions(+), 5 deletions(-)
diffs (55 lines):
diff -r b2541217f74b -r 8d20f3cde49a src/imap/cmd-urlfetch.c
--- a/src/imap/cmd-urlfetch.c Thu May 30 18:04:17 2013 +0300
+++ b/src/imap/cmd-urlfetch.c Thu May 30 18:04:52 2013 +0300
@@ -357,7 +357,6 @@
const struct cmd_urlfetch_url *url;
const struct imap_arg *args;
struct cmd_urlfetch_url *ufurl;
- int ret;
if (client->urlauth_ctx == NULL) {
client_send_command_error(cmd, "URLAUTH disabled.");
@@ -387,17 +386,16 @@
ctx->ufetch = imap_urlauth_fetch_init(client->urlauth_ctx,
cmd_urlfetch_url_callback, cmd);
- ret = 1;
array_foreach(&urls, url) {
- ret = imap_urlauth_fetch_url(ctx->ufetch, url->url, url->flags);
- if (ret < 0) {
+ if (imap_urlauth_fetch_url(ctx->ufetch, url->url, url->flags) < 0) {
/* fatal error */
ctx->failed = TRUE;
break;
}
}
- if (ret != 0 && cmd->client->output_cmd_lock != cmd) {
+ if ((ctx->failed || !imap_urlauth_fetch_is_pending(ctx->ufetch))
+ && cmd->client->output_cmd_lock != cmd) {
/* finished */
cmd_urlfetch_finish(cmd);
return TRUE;
diff -r b2541217f74b -r 8d20f3cde49a src/lib-imap-urlauth/imap-urlauth-fetch.c
--- a/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:17 2013 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth-fetch.c Thu May 30 18:04:52 2013 +0300
@@ -516,3 +516,7 @@
return pending;
}
+bool imap_urlauth_fetch_is_pending(struct imap_urlauth_fetch *ufetch)
+{
+ return ufetch->pending_requests > 0;
+}
diff -r b2541217f74b -r 8d20f3cde49a src/lib-imap-urlauth/imap-urlauth-fetch.h
--- a/src/lib-imap-urlauth/imap-urlauth-fetch.h Thu May 30 18:04:17 2013 +0300
+++ b/src/lib-imap-urlauth/imap-urlauth-fetch.h Thu May 30 18:04:52 2013 +0300
@@ -45,6 +45,8 @@
int imap_urlauth_fetch_url(struct imap_urlauth_fetch *ufetch, const char *url,
enum imap_urlauth_fetch_flags url_flags);
+
bool imap_urlauth_fetch_continue(struct imap_urlauth_fetch *ufetch);
+bool imap_urlauth_fetch_is_pending(struct imap_urlauth_fetch *ufetch);
#endif
More information about the dovecot-cvs
mailing list