]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: Further fixes to received_timestamp and virtual_size parsing (-t and -S parame...
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Sat, 13 Aug 2016 11:16:55 +0000 (14:16 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 15 Aug 2016 13:24:07 +0000 (16:24 +0300)
src/doveadm/dsync/dsync-ibc-stream.c

index ed7ed18f9f5ac295b92b6c9c6c103e60353b9a7b..bff77c07d005108eec2b8d0de9b5aef35bd307d5 100644 (file)
@@ -1666,6 +1666,7 @@ dsync_ibc_stream_recv_change(struct dsync_ibc *_ibc,
        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 @@ dsync_ibc_stream_recv_change(struct dsync_ibc *_ibc,
                        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;