Browse Source

Add method to check if a map looks like a map

tags/1.2.0
Vsevolod Stakhov 8 years ago
parent
commit
df75947ab9
2 changed files with 30 additions and 0 deletions
  1. 23
    0
      src/libutil/map.c
  2. 7
    0
      src/libutil/map.h

+ 23
- 0
src/libutil/map.c View File

@@ -542,6 +542,29 @@ rspamd_map_check_proto (struct rspamd_config *cfg,
return pos;
}

gboolean
rspamd_map_is_map (const gchar *map_line)
{
gboolean ret = FALSE;

g_assert (map_line != NULL);

if (map_line[0] == '/') {
ret = TRUE;
}
else if (g_ascii_strncasecmp (map_line, "sign+", sizeof ("sign+") - 1) == 0) {
ret = TRUE;
}
else if (g_ascii_strncasecmp (map_line, "file://", sizeof ("file://") - 1) == 0) {
ret = TRUE;
}
else if (g_ascii_strncasecmp (map_line, "http://", sizeof ("file://") - 1) == 0) {
ret = TRUE;
}

return ret;
}

gboolean
rspamd_map_add (struct rspamd_config *cfg,
const gchar *map_line,

+ 7
- 0
src/libutil/map.h View File

@@ -37,6 +37,13 @@ struct map_cb_data {
void *cur_data;
};

/**
* Returns TRUE if line looks like a map definition
* @param map_line
* @return
*/
gboolean rspamd_map_is_map (const gchar *map_line);

/**
* Add map from line
*/

Loading…
Cancel
Save