]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
Parse unsigned integers in the configuration.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 3 Nov 2014 10:23:13 +0000 (10:23 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 3 Nov 2014 10:23:13 +0000 (10:23 +0000)
src/libserver/cfg_rcl.c

index c7ccdccbe7c1dbf3e1d63fa09b670c45586440dc..9bb8fecfcf01492fb83744cbe17ec5c2ba281b6f 100644 (file)
@@ -1672,6 +1672,7 @@ rspamd_rcl_parse_struct_integer (struct rspamd_config *cfg,
                gint32 *i32p;
                gint16 *i16p;
                gint64 *i64p;
+               guint *up;
                gsize *sp;
        } target;
        gint64 val;
@@ -1720,6 +1721,17 @@ rspamd_rcl_parse_struct_integer (struct rspamd_config *cfg,
                }
                *target.i16p = val;
        }
+       else if (pd->flags == RSPAMD_CL_FLAG_UINT) {
+               target.up = (guint *)(((gchar *)pd->user_struct) + pd->offset);
+               if (!ucl_object_toint_safe (obj, &val)) {
+                       g_set_error (err,
+                                       CFG_RCL_ERROR,
+                                       EINVAL,
+                                       "cannot convert param to integer");
+                       return FALSE;
+               }
+               *target.up = val;
+       }
        else {
                target.ip = (gint *)(((gchar *)pd->user_struct) + pd->offset);
                if (!ucl_object_toint_safe (obj, &val)) {