RSPAMD_CL_EMIT_CONFIG
};
+enum rspamd_cl_flags {
+ RSPAMD_CL_FLAG_KEY_LOWERCASE = 0x1
+};
+
typedef struct rspamd_cl_object_s {
gchar *key; /**< the key of an object */
union {
* @param pool pool to allocate memory from
* @return new parser object
*/
-struct rspamd_cl_parser* rspamd_cl_parser_new (void);
+struct rspamd_cl_parser* rspamd_cl_parser_new (gint flags);
/**
* Register new handler for a macro
struct rspamd_cl_parser {
enum rspamd_cl_parser_state state;
enum rspamd_cl_parser_state prev_state;
+ guint recursion;
+ gint flags;
rspamd_cl_object_t *top_obj;
rspamd_cl_object_t *cur_obj;
struct rspamd_cl_macro *macroes;
struct rspamd_cl_stack *stack;
struct rspamd_cl_chunk *chunks;
- guint recursion;
struct rspamd_cl_pubkey *keys;
};
/* Create a new object */
nobj = rspamd_cl_object_new ();
nobj->key = g_malloc (end - c + 1);
- rspamd_strlcpy (nobj->key, c, end - c + 1);
+ if (parser->flags & RSPAMD_CL_FLAG_KEY_LOWERCASE) {
+ rspamd_strlcpy_tolower (nobj->key, c, end - c + 1);
+ }
+ else {
+ rspamd_strlcpy (nobj->key, c, end - c + 1);
+ }
if (got_quote) {
rspamd_cl_unescape_json_string (nobj->key);
}
struct rspamd_cl_parser*
-rspamd_cl_parser_new (void)
+rspamd_cl_parser_new (gint flags)
{
struct rspamd_cl_parser *new;
rspamd_cl_parser_register_macro (new, "include", rspamd_cl_include_handler, new);
rspamd_cl_parser_register_macro (new, "includes", rspamd_cl_includes_handler, new);
+ new->flags = flags;
+
return new;
}