changeset 20642:ba69e914d71a

dsync: Further fixes to received_timestamp and virtual_size parsing (-t and -S parameters)
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Sat, 13 Aug 2016 14:16:55 +0300
parents 5c0470a8b5a7
children 6428c91a9548
files src/doveadm/dsync/dsync-ibc-stream.c
diffstat 1 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-ibc-stream.c	Sat Aug 13 01:00:13 2016 +0300
+++ b/src/doveadm/dsync/dsync-ibc-stream.c	Sat Aug 13 14:16:55 2016 +0300
@@ -1666,6 +1666,7 @@
 	struct dsync_mail_change *change;
 	const char *value;
 	unsigned int uintval;
+	unsigned long long ullongval;
 	enum dsync_ibc_recv_ret ret;
 
 	p_clear(pool);
@@ -1753,15 +1754,19 @@
 			array_append(&change->keyword_changes, &value, 1);
 		}
 	}
-	if (dsync_deserializer_decode_try(decoder, "received_timestamp", &value) &&
-	    str_to_time(value, &change->received_timestamp) < 0) {
-		dsync_ibc_input_error(ibc, decoder, "Invalid received_timestamp");
-		return DSYNC_IBC_RECV_RET_TRYAGAIN;
+	if (dsync_deserializer_decode_try(decoder, "received_timestamp", &value)) {
+		if (str_to_ullong_hex(value, &ullongval) < 0) {
+			dsync_ibc_input_error(ibc, decoder, "Invalid received_timestamp");
+			return DSYNC_IBC_RECV_RET_TRYAGAIN;
+		}
+		change->received_timestamp = ullongval;
 	}
-	if (dsync_deserializer_decode_try(decoder, "virtual_size", &value) &&
-	    str_to_uoff(value, &change->virtual_size) < 0) {
-		dsync_ibc_input_error(ibc, decoder, "Invalid virtual_size");
-		return DSYNC_IBC_RECV_RET_TRYAGAIN;
+	if (dsync_deserializer_decode_try(decoder, "virtual_size", &value)) {
+		if (str_to_ullong_hex(value, &ullongval) < 0) {
+			dsync_ibc_input_error(ibc, decoder, "Invalid virtual_size");
+			return DSYNC_IBC_RECV_RET_TRYAGAIN;
+		}
+		change->virtual_size = ullongval;
 	}
 
 	*change_r = change;