From: Timo Sirainen Date: Sat, 13 Aug 2016 11:16:55 +0000 (+0300) Subject: dsync: Further fixes to received_timestamp and virtual_size parsing (-t and -S parame... X-Git-Tag: 2.2.26~359 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=caefe521828e00f6952071809ae9562826727c15;p=thirdparty%2Fdovecot%2Fcore.git dsync: Further fixes to received_timestamp and virtual_size parsing (-t and -S parameters) --- diff --git a/src/doveadm/dsync/dsync-ibc-stream.c b/src/doveadm/dsync/dsync-ibc-stream.c index ed7ed18f9f..bff77c07d0 100644 --- a/src/doveadm/dsync/dsync-ibc-stream.c +++ b/src/doveadm/dsync/dsync-ibc-stream.c @@ -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;