dovecot-2.2: dict-client: Verify that the correct transaction ID...

dovecot at dovecot.org dovecot at dovecot.org
Thu Sep 24 15:44:21 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/3599f7b9ea09
changeset: 19213:3599f7b9ea09
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Sep 24 18:42:58 2015 +0300
description:
dict-client: Verify that the correct transaction ID is returned for commit reply.

diffstat:

 src/lib-dict/dict-client.c |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (24 lines):

diff -r 168ca81df3fe -r 3599f7b9ea09 src/lib-dict/dict-client.c
--- a/src/lib-dict/dict-client.c	Thu Sep 24 18:41:48 2015 +0300
+++ b/src/lib-dict/dict-client.c	Thu Sep 24 18:42:58 2015 +0300
@@ -758,6 +758,7 @@
 	struct client_dict_transaction_context *ctx =
 		(struct client_dict_transaction_context *)_ctx;
 	struct client_dict *dict = (struct client_dict *)_ctx->dict;
+	unsigned int id;
 	int ret = ctx->failed ? -1 : 1;
 
 	ctx->committed = TRUE;
@@ -799,6 +800,12 @@
 				ret = -1;
 				break;
 			}
+			if (str_to_uint(line+1, &id) < 0 || ctx->id != id) {
+				i_error("dict-client: Invalid commit reply, "
+					"expected id=%u: %s", ctx->id, line);
+				client_dict_disconnect(dict);
+				ret = -1;
+			}
 		}
 	} T_END;
 


More information about the dovecot-cvs mailing list