dovecot-2.2: imap-urlauth: Fatal failure error handling wasn't d...

dovecot at dovecot.org dovecot at dovecot.org
Thu Jun 12 23:20:42 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/da3a8fcd91db
changeset: 17472:da3a8fcd91db
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Jun 13 01:26:14 2014 +0300
description:
imap-urlauth: Fatal failure error handling wasn't done correctly.
Found by Coverity

diffstat:

 src/imap-urlauth/imap-urlauth-worker.c |  17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diffs (41 lines):

diff -r f5cb6a0d615b -r da3a8fcd91db src/imap-urlauth/imap-urlauth-worker.c
--- a/src/imap-urlauth/imap-urlauth-worker.c	Fri Jun 13 01:22:23 2014 +0300
+++ b/src/imap-urlauth/imap-urlauth-worker.c	Fri Jun 13 01:26:14 2014 +0300
@@ -373,30 +373,27 @@
 	if ((url_flags & IMAP_URLAUTH_FETCH_FLAG_BINARY) != 0)
 		imap_msgpart_url_set_decode_to_binary(client->url);
 	if ((url_flags & IMAP_URLAUTH_FETCH_FLAG_BODYPARTSTRUCTURE) != 0) {
-		if (imap_msgpart_url_get_bodypartstructure(client->url,
-							   bpstruct_r,
-							   &error) <= 0) {
-			if (ret < 0)
-				return -1;
+		ret = imap_msgpart_url_get_bodypartstructure(client->url,
+							     bpstruct_r, &error);
+		if (ret <= 0) {
 			*errormsg_r = t_strdup_printf(
 				"Failed to read URLAUTH \"%s\": %s", url, error);
 			if (client->debug)
 				i_debug("%s", *errormsg_r);
-			return 0;
+			return ret;
 		}
 	}
 
 	/* if requested, read the message part the URL points to */
 	if ((url_flags & IMAP_URLAUTH_FETCH_FLAG_BODY) != 0 ||
 	    (url_flags & IMAP_URLAUTH_FETCH_FLAG_BINARY) != 0) {
-		if (imap_msgpart_url_read_part(client->url, &mpresult, &error) <= 0) {
-			if (ret < 0)
-				return -1;
+		ret = imap_msgpart_url_read_part(client->url, &mpresult, &error);
+		if (ret <= 0) {
 			*errormsg_r = t_strdup_printf(
 				"Failed to read URLAUTH \"%s\": %s", url, error);
 			if (client->debug)
 				i_debug("%s", *errormsg_r);
-			return 0;
+			return ret;
 		}
 		client->msg_part_size = mpresult.size;
 		client->msg_part_input = mpresult.input;


More information about the dovecot-cvs mailing list