]> source.dussan.org Git - rspamd.git/commitdiff
Allow parsing uint32 as time values.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Sep 2013 16:06:24 +0000 (17:06 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 30 Sep 2013 16:06:24 +0000 (17:06 +0100)
src/cfg_rcl.c
src/cfg_rcl.h

index 15f5b7e9adc43d7f172449ad1066e05cb8bc0e91..bf1b8ad700a037b399398ffb4cd6edd980e32869 100644 (file)
@@ -809,6 +809,7 @@ rspamd_rcl_parse_struct_time (struct config_file *cfg, rspamd_cl_object_t *obj,
        struct rspamd_rcl_struct_parser *pd = ud;
        union {
                gint *psec;
+               guint32 *pu32;
                gdouble *pdv;
                struct timeval *ptv;
                struct timespec *pts;
@@ -838,6 +839,10 @@ rspamd_rcl_parse_struct_time (struct config_file *cfg, rspamd_cl_object_t *obj,
                target.psec = (gint *)(((gchar *)pd->user_struct) + pd->offset);
                *target.psec = val * 1000;
        }
+       else if (pd->flags == RSPAMD_CL_FLAG_TIME_UINT_32) {
+               target.pu32 = (guint32 *)(((gchar *)pd->user_struct) + pd->offset);
+               *target.pu32 = val * 1000;
+       }
        else {
                g_set_error (err, CFG_RCL_ERROR, EINVAL, "invalid flags to parse time value");
                return FALSE;
index 1b19783cf6ded8e20bc25906483b5fa35e8bfc6d..fb0fea7e3a9c8c358d5fe1d8f5cd9a36cd864ddc 100644 (file)
@@ -45,10 +45,11 @@ struct rspamd_rcl_struct_parser {
                RSPAMD_CL_FLAG_TIME_TIMEVAL = 0x1 << 1,
                RSPAMD_CL_FLAG_TIME_TIMESPEC = 0x1 << 2,
                RSPAMD_CL_FLAG_TIME_INTEGER = 0x1 << 3,
-               RSPAMD_CL_FLAG_INT_16 = 0x1 << 4,
-               RSPAMD_CL_FLAG_INT_32 = 0x1 << 5,
-               RSPAMD_CL_FLAG_INT_64 = 0x1 << 6,
-               RSPAMD_CL_FLAG_INT_SIZE = 0x1 << 7
+               RSPAMD_CL_FLAG_TIME_UINT_32 = 0x1 << 4,
+               RSPAMD_CL_FLAG_INT_16 = 0x1 << 5,
+               RSPAMD_CL_FLAG_INT_32 = 0x1 << 6,
+               RSPAMD_CL_FLAG_INT_64 = 0x1 << 7,
+               RSPAMD_CL_FLAG_INT_SIZE = 0x1 << 8
        } flags;
 };