b66c33aec9100eb8a779f4da0730f969981c9f45
[apps/pfixtools.git] / postlicyd / strlist.c
1 /******************************************************************************/
2 /*          pfixtools: a collection of postfix related tools                  */
3 /*          ~~~~~~~~~                                                         */
4 /*  ________________________________________________________________________  */
5 /*                                                                            */
6 /*  Redistribution and use in source and binary forms, with or without        */
7 /*  modification, are permitted provided that the following conditions        */
8 /*  are met:                                                                  */
9 /*                                                                            */
10 /*  1. Redistributions of source code must retain the above copyright         */
11 /*     notice, this list of conditions and the following disclaimer.          */
12 /*  2. Redistributions in binary form must reproduce the above copyright      */
13 /*     notice, this list of conditions and the following disclaimer in the    */
14 /*     documentation and/or other materials provided with the distribution.   */
15 /*  3. The names of its contributors may not be used to endorse or promote    */
16 /*     products derived from this software without specific prior written     */
17 /*     permission.                                                            */
18 /*                                                                            */
19 /*  THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND   */
20 /*  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE     */
21 /*  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR        */
22 /*  PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS    */
23 /*  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR    */
24 /*  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF      */
25 /*  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS  */
26 /*  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN   */
27 /*  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)   */
28 /*  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF    */
29 /*  THE POSSIBILITY OF SUCH DAMAGE.                                           */
30 /******************************************************************************/
31
32 /*
33  * Copyright © 2008 Florent Bruneau
34  */
35
36 #include "filter.h"
37 #include "trie.h"
38 #include "file.h"
39 #include "str.h"
40 #include "rbl.h"
41 #include "policy_tokens.h"
42
43 typedef struct strlist_config_t {
44     PA(trie_t) tries;
45     A(int)     weights;
46     A(bool)    reverses;
47     A(bool)    partiales;
48
49     A(char)     hosts;
50     A(int)      host_offsets;
51     A(int)      host_weights;
52
53     int soft_threshold;
54     int hard_threshold;
55
56     unsigned is_email         :1;
57     unsigned is_hostname      :1;
58
59     unsigned match_sender     :1;
60     unsigned match_recipient  :1;
61
62     unsigned match_helo       :1;
63     unsigned match_client     :1;
64     unsigned match_reverse    :1;
65 } strlist_config_t;
66
67 typedef struct strlist_async_data_t {
68     A(rbl_result_t) results;
69     int awaited;
70     uint32_t sum;
71     bool error;
72 } strlist_async_data_t;
73
74 static filter_type_t filter_type = FTK_UNKNOWN;
75
76
77 static strlist_config_t *strlist_config_new(void)
78 {
79     return p_new(strlist_config_t, 1);
80 }
81
82 static void strlist_config_delete(strlist_config_t **config)
83 {
84     if (*config) {
85         array_deep_wipe((*config)->tries, trie_delete);
86         array_wipe((*config)->weights);
87         array_wipe((*config)->reverses);
88         array_wipe((*config)->partiales);
89         array_wipe((*config)->hosts);
90         array_wipe((*config)->host_offsets);
91         array_wipe((*config)->host_weights);
92         p_delete(config);
93     }
94 }
95
96 static inline void strlist_copy(char *dest, const char *str, ssize_t str_len,
97                                 bool reverse)
98 {
99     if (str_len > 0) {
100         if (reverse) {
101             for (const char *src = str + str_len - 1 ; src >= str ; --src) {
102                 *dest = ascii_tolower(*src);
103                 ++dest;
104             }
105         } else {
106             for (int i = 0 ; i < str_len ; ++i) {
107                 *dest = ascii_tolower(str[i]);
108                 ++dest;
109             }
110         }
111     }
112     *dest = '\0';
113 }
114
115
116 static trie_t *strlist_create(const char *file, bool reverse, bool lock)
117 {
118     trie_t *db;
119     file_map_t map;
120     const char *p, *end;
121     char line[BUFSIZ];
122
123     if (!file_map_open(&map, file, false)) {
124         return NULL;
125     }
126     p   = map.map;
127     end = map.end;
128     while (end > p && end[-1] != '\n') {
129         --end;
130     }
131     if (end != map.end) {
132         warn("file %s miss a final \\n, ignoring last line",
133              file);
134     }
135
136     db = trie_new();
137     while (p < end && p != NULL) {
138         const char *eol = (char *)memchr(p, '\n', end - p);
139         if (eol == NULL) {
140             eol = end;
141         }
142         if (eol - p >= BUFSIZ) {
143             err("unreasonnable long line");
144             file_map_close(&map);
145             trie_delete(&db);
146             return NULL;
147         }
148         if (*p != '#') {
149             const char *eos = eol;
150             while (p < eos && isspace(*p)) {
151                 ++p;
152             }
153             while (p < eos && isspace(eos[-1])) {
154                 --eos;
155             }
156             if (p < eos) {
157                 strlist_copy(line, p, eos - p, reverse);
158                 trie_insert(db, line);
159             }
160         }
161         p = eol + 1;
162     }
163     file_map_close(&map);
164     trie_compile(db, lock);
165     return db;
166 }
167
168 static bool strlist_create_from_rhbl(const char *file, bool lock,
169                                      trie_t **phosts, trie_t **pdomains)
170 {
171     trie_t *hosts, *domains;
172     uint32_t host_count, domain_count;
173     file_map_t map;
174     const char *p, *end;
175     char line[BUFSIZ];
176
177     if (!file_map_open(&map, file, false)) {
178         return false;
179     }
180     p   = map.map;
181     end = map.end;
182     while (end > p && end[-1] != '\n') {
183         --end;
184     }
185     if (end != map.end) {
186         warn("file %s miss a final \\n, ignoring last line",
187              file);
188     }
189
190     hosts = trie_new();
191     host_count = 0;
192     domains = trie_new();
193     domain_count = 0;
194     while (p < end && p != NULL) {
195         const char *eol = (char *)memchr(p, '\n', end - p);
196         if (eol == NULL) {
197             eol = end;
198         }
199         if (eol - p >= BUFSIZ) {
200             err("unreasonnable long line");
201             file_map_close(&map);
202             trie_delete(&hosts);
203             trie_delete(&domains);
204             return false;
205         }
206         if (*p != '#') {
207             const char *eos = eol;
208             while (p < eos && isspace(*p)) {
209                 ++p;
210             }
211             while (p < eos && isspace(eos[-1])) {
212                 --eos;
213             }
214             if (p < eos) {
215                 if (isalnum(*p)) {
216                     strlist_copy(line, p, eos - p, true);
217                     trie_insert(hosts, line);
218                     ++host_count;
219                 } else if (*p == '*') {
220                     ++p;
221                     strlist_copy(line, p, eos - p, true);
222                     trie_insert(domains, line);
223                     ++domain_count;
224                 }
225             }
226         }
227         p = eol + 1;
228     }
229     file_map_close(&map);
230     if (host_count > 0) {
231         trie_compile(hosts, lock);
232         *phosts = hosts;
233     } else {
234         trie_delete(&hosts);
235         *phosts = NULL;
236     }
237     if (domain_count > 0) {
238         trie_compile(domains, lock);
239         *pdomains = domains;
240     } else {
241         trie_delete(&domains);
242         *pdomains = NULL;
243     }
244     return hosts != NULL || domains != NULL;
245
246 }
247
248
249 static bool strlist_filter_constructor(filter_t *filter)
250 {
251     strlist_config_t *config = strlist_config_new();
252
253 #define PARSE_CHECK(Expr, Str, ...)                                            \
254     if (!(Expr)) {                                                             \
255         err(Str, ##__VA_ARGS__);                                               \
256         strlist_config_delete(&config);                                        \
257         return false;                                                          \
258     }
259
260     config->hard_threshold = 1;
261     config->soft_threshold = 1;
262     foreach (filter_param_t *param, filter->params) {
263         switch (param->type) {
264           /* file parameter is:
265            *  [no]lock:(partial-)(prefix|suffix):weight:filename
266            *  valid options are:
267            *    - lock:   memlock the database in memory.
268            *    - nolock: don't memlock the database in memory.
269            *    - prefix: perform "prefix" compression on storage.
270            *    - suffix  perform "suffix" compression on storage.
271            *    - \d+:    a number describing the weight to give to the match
272            *              the given list [mandatory]
273            *  the file pointed by filename MUST be a valid string list (one string per
274            *  line, empty lines and lines beginning with a '#' are ignored).
275            */
276           case ATK_FILE: {
277             bool lock = false;
278             int  weight = 0;
279             bool reverse = false;
280             bool partial = false;
281             trie_t *trie = NULL;
282             const char *current = param->value;
283             const char *p = m_strchrnul(param->value, ':');
284             char *next = NULL;
285             for (int i = 0 ; i < 4 ; ++i) {
286                 PARSE_CHECK(i == 3 || *p,
287                             "file parameter must contains a locking state "
288                             "and a weight option");
289                 switch (i) {
290                   case 0:
291                     if ((p - current) == 4 && strncmp(current, "lock", 4) == 0) {
292                         lock = true;
293                     } else if ((p - current) == 6 && strncmp(current, "nolock", 6) == 0) {
294                         lock = false;
295                     } else {
296                         PARSE_CHECK(false, "illegal locking state %.*s",
297                                     (int)(p - current), current);
298                     }
299                     break;
300
301                   case 1:
302                     if (p - current > (ssize_t)strlen("partial-") 
303                         && strncmp(current, "partial-", strlen("partial-")) == 0) {
304                         partial = true;
305                         current += strlen("partial-");
306                     }
307                     if ((p - current) == 6 && strncmp(current, "suffix", 6) == 0) {
308                         reverse = true;
309                     } else if ((p - current) == 6 && strncmp(current, "prefix", 6) == 0) {
310                         reverse = false;
311                     } else {
312                         PARSE_CHECK(false, "illegal character order value %.*s",
313                                     (int)(p - current), current);
314                     }
315                     break;
316
317                   case 2:
318                     weight = strtol(current, &next, 10);
319                     PARSE_CHECK(next == p && weight >= 0 && weight <= 1024,
320                                 "illegal weight value %.*s",
321                                 (int)(p - current), current);
322                     break;
323
324                   case 3:
325                     trie = strlist_create(current, reverse, lock);
326                     PARSE_CHECK(trie != NULL,
327                                 "cannot load string list from %s", current);
328                     array_add(config->tries, trie);
329                     array_add(config->weights, weight);
330                     array_add(config->reverses, reverse);
331                     array_add(config->partiales, partial);
332                     break;
333                 }
334                 if (i != 3) {
335                     current = p + 1;
336                     p = m_strchrnul(current, ':');
337                 }
338             }
339           } break;
340
341           /* rbldns parameter is:
342            *  [no]lock::weight:filename
343            *  valid options are:
344            *    - lock:   memlock the database in memory.
345            *    - nolock: don't memlock the database in memory.
346            *    - \d+:    a number describing the weight to give to the match
347            *              the given list [mandatory]
348            *  directly import a file issued from a rhbl in rbldns format.
349            */
350           case ATK_RBLDNS: {
351             bool lock = false;
352             int  weight = 0;
353             trie_t *trie_hosts   = NULL;
354             trie_t *trie_domains = NULL;
355             const char *current = param->value;
356             const char *p = m_strchrnul(param->value, ':');
357             char *next = NULL;
358             for (int i = 0 ; i < 3 ; ++i) {
359                 PARSE_CHECK(i == 2 || *p,
360                             "file parameter must contains a locking state "
361                             "and a weight option");
362                 switch (i) {
363                   case 0:
364                     if ((p - current) == 4 && strncmp(current, "lock", 4) == 0) {
365                         lock = true;
366                     } else if ((p - current) == 6 && strncmp(current, "nolock", 6) == 0) {
367                         lock = false;
368                     } else {
369                         PARSE_CHECK(false, "illegal locking state %.*s",
370                                     (int)(p - current), current);
371                     }
372                     break;
373
374                   case 1:
375                     weight = strtol(current, &next, 10);
376                     PARSE_CHECK(next == p && weight >= 0 && weight <= 1024,
377                                 "illegal weight value %.*s",
378                                 (int)(p - current), current);
379                     break;
380
381                   case 2:
382                     PARSE_CHECK(strlist_create_from_rhbl(current, lock,
383                                                          &trie_hosts, &trie_domains),
384                                 "cannot load string list from rhbl %s", current);
385                     if (trie_hosts != NULL) {
386                         array_add(config->tries, trie_hosts);
387                         array_add(config->weights, weight);
388                         array_add(config->reverses, true);
389                         array_add(config->partiales, false);
390                     }
391                     if (trie_domains != NULL) {
392                         array_add(config->tries, trie_domains);
393                         array_add(config->weights, weight);
394                         array_add(config->reverses, true);
395                         array_add(config->partiales, true);
396                     }
397                     config->is_hostname = true;
398                     break;
399                 }
400                 if (i != 2) {
401                     current = p + 1;
402                     p = m_strchrnul(current, ':');
403                 }
404             }
405           } break;
406
407           /* dns parameter.
408            *  weight:hostname.
409            * define a RBL to use through DNS resolution.
410            */
411           case ATK_DNS: {
412             int  weight = 0;
413             const char *current = param->value;
414             const char *p = m_strchrnul(param->value, ':');
415             char *next = NULL;
416             for (int i = 0 ; i < 2 ; ++i) {
417                 PARSE_CHECK(i == 1 || *p,
418                             "host parameter must contains a weight option");
419                 switch (i) {
420                   case 0:
421                     weight = strtol(current, &next, 10);
422                     PARSE_CHECK(next == p && weight >= 0 && weight <= 1024,
423                                 "illegal weight value %.*s",
424                                 (int)(p - current), current);
425                     break;
426
427                   case 1:
428                     array_add(config->host_offsets, array_len(config->hosts));
429                     array_append(config->hosts, current, strlen(current) + 1);
430                     array_add(config->host_weights, weight);
431                     break;
432                 }
433                 if (i != 1) {
434                     current = p + 1;
435                     p = m_strchrnul(current, ':');
436                 }
437             }
438           } break;
439
440           /* hard_threshold parameter is an integer.
441            *  If the matching score is greater or equal than this threshold,
442            *  the hook "hard_match" is called.
443            * hard_threshold = 1 means, that all matches are hard matches.
444            * default is 1;
445            */
446           FILTER_PARAM_PARSE_INT(HARD_THRESHOLD, config->hard_threshold);
447
448           /* soft_threshold parameter is an integer.
449            *  if the matching score is greater or equal than this threshold
450            *  and smaller or equal than the hard_threshold, the hook "soft_match"
451            *  is called.
452            * default is 1;
453            */
454           FILTER_PARAM_PARSE_INT(SOFT_THRESHOLD, config->soft_threshold);
455
456           /* fields to match againes:
457            *  fields = field_name(,field_name)*
458            *  field_names are
459            *    - hostname: helo_name,client_name,reverse_client_name
460            *    - email: sender,recipient
461            */
462           case ATK_FIELDS: {
463             const char *current = param->value;
464             const char *p = m_strchrnul(param->value, ',');
465             do {
466                 postlicyd_token tok = policy_tokenize(current, p - current);
467                 switch (tok) {
468 #define           CASE(Up, Low, Type)                                          \
469                   case PTK_ ## Up:                                             \
470                     config->match_ ## Low = true;                              \
471                     config->is_ ## Type = true;                                \
472                     break
473                   CASE(HELO_NAME, helo, hostname);
474                   CASE(CLIENT_NAME, client, hostname);
475                   CASE(REVERSE_CLIENT_NAME, reverse, hostname);
476                   CASE(SENDER_DOMAIN, sender, hostname);
477                   CASE(RECIPIENT_DOMAIN, recipient, hostname);
478                   CASE(SENDER, sender, email);
479                   CASE(RECIPIENT, recipient, email);
480 #undef CASE
481                   default:
482                     PARSE_CHECK(false, "unknown field %.*s", (int)(p - current), current);
483                     break;
484                 }
485                 if (!*p) {
486                     break;
487                 }
488                 current = p + 1;
489                 p = m_strchrnul(current, ',');
490             } while (true);
491           } break;
492
493           default: break;
494         }
495     }}
496
497     PARSE_CHECK(config->is_email != config->is_hostname,
498                 "matched field MUST be emails XOR hostnames");
499     PARSE_CHECK(config->tries.len || config->host_offsets.len,
500                 "no file parameter in the filter %s", filter->name);
501     filter->data = config;
502     return true;
503 }
504
505 static void strlist_filter_destructor(filter_t *filter)
506 {
507     strlist_config_t *config = filter->data;
508     strlist_config_delete(&config);
509     filter->data = config;
510 }
511
512 static void strlist_filter_async(rbl_result_t *result, void *arg)
513 {
514     filter_context_t   *context = arg;
515     const filter_t      *filter = context->current_filter;
516     const strlist_config_t *data = filter->data;
517     strlist_async_data_t  *async = context->contexts[filter_type];
518
519     if (*result != RBL_ERROR) {
520         async->error = false;
521     }
522     --async->awaited;
523
524     debug("got asynchronous request result for filter %s, rbl %d, still awaiting %d answers",
525           filter->name, (int)(result - array_ptr(async->results, 0)), async->awaited);
526
527     if (async->awaited == 0) {
528         filter_result_t res = HTK_FAIL;
529         if (async->error) {
530             res = HTK_ERROR;
531         } else {
532             uint32_t j = 0;
533 #define DO_SUM(Field)                                                          \
534         if (data->match_ ## Field) {                                           \
535             for (uint32_t i = 0 ; i < array_len(data->host_offsets) ; ++i) {   \
536                 int weight = array_elt(data->host_weights, i);                 \
537                                                                                \
538                 switch (array_elt(async->results, j)) {                        \
539                   case RBL_ASYNC:                                              \
540                     crit("no more awaited answer but result is ASYNC");        \
541                     abort();                                                   \
542                   case RBL_FOUND:                                              \
543                     async->sum += weight;                                      \
544                     break;                                                     \
545                   default:                                                     \
546                     break;                                                     \
547                 }                                                              \
548                 ++j;                                                           \
549             }                                                                  \
550         }
551             DO_SUM(helo);
552             DO_SUM(client);
553             DO_SUM(reverse);
554             DO_SUM(recipient);
555             DO_SUM(sender);
556 #undef DO_SUM
557             debug("score is %d", async->sum);
558             if (async->sum >= (uint32_t)data->hard_threshold) {
559                 res = HTK_HARD_MATCH;
560             } else if (async->sum >= (uint32_t)data->soft_threshold) {
561                 res = HTK_SOFT_MATCH;
562             }
563         }
564         debug("answering to filter %s", filter->name);
565         filter_post_async_result(context, res);
566     }
567 }
568
569
570 static filter_result_t strlist_filter(const filter_t *filter, const query_t *query,
571                                       filter_context_t *context)
572 {
573     char reverse[BUFSIZ];
574     char normal[BUFSIZ];
575     const strlist_config_t *config = filter->data;
576     strlist_async_data_t *async = context->contexts[filter_type];
577     int result_pos = 0;
578     async->sum = 0;
579     async->error = true;
580     array_ensure_exact_capacity(async->results, (config->match_client
581                                 + config->match_sender + config->match_helo
582                                 + config->match_recipient + config->match_reverse)
583                                 * array_len(config->host_offsets));
584     async->awaited = 0;
585
586
587     if (config->is_email && 
588         ((config->match_sender && query->state < SMTP_MAIL)
589         || (config->match_recipient && query->state != SMTP_RCPT))) {
590         warn("trying to match an email against a field that is not "
591              "available in current protocol state");
592         return HTK_ABORT;
593     } else if (config->is_hostname && config->match_helo && query->state < SMTP_HELO) {
594         warn("trying to match hostname against helo before helo is received");
595         return HTK_ABORT;
596     }
597 #define LOOKUP(Flag, Field)                                                    \
598     if (config->match_ ## Flag) {                                              \
599         const int len = m_strlen(query->Field);                                \
600         strlist_copy(normal, query->Field, len, false);                        \
601         strlist_copy(reverse, query->Field, len, true);                        \
602         for (uint32_t i = 0 ; i < config->tries.len ; ++i) {                   \
603             const int weight   = array_elt(config->weights, i);                \
604             const trie_t *trie = array_elt(config->tries, i);                  \
605             const bool rev     = array_elt(config->reverses, i);               \
606             const bool part    = array_elt(config->partiales, i);              \
607             if ((!part && trie_lookup(trie, rev ? reverse : normal))           \
608                 || (part && trie_prefix(trie, rev ? reverse : normal))) {      \
609                 async->sum += weight;                                          \
610                 if (async->sum >= (uint32_t)config->hard_threshold) {          \
611                     return HTK_HARD_MATCH;                                     \
612                 }                                                              \
613             }                                                                  \
614             async->error = false;                                              \
615         }                                                                      \
616     }
617 #define DNS(Flag, Field)                                                       \
618     if (config->match_ ## Flag) {                                              \
619         const int len = m_strlen(query->Field);                                \
620         strlist_copy(normal, query->Field, len, false);                        \
621         for (uint32_t i = 0 ; len > 0 && i < config->host_offsets.len ; ++i) { \
622             const char *rbl = array_ptr(config->hosts,                         \
623                                         array_elt(config->host_offsets, i));   \
624             debug("running check of field %s (%s) against %s", STR(Field),     \
625                   normal, rbl);                                                \
626             if (rhbl_check(rbl, normal, array_ptr(async->results, result_pos), \
627                            strlist_filter_async, context)) {                   \
628                 async->error = false;                                          \
629                 ++async->awaited;                                              \
630             }                                                                  \
631             ++result_pos;                                                      \
632         }                                                                      \
633     }
634
635     if (config->is_email) {
636         LOOKUP(sender, sender);
637         LOOKUP(recipient, recipient);
638         DNS(sender, sender);
639         DNS(recipient, recipient);
640     } else if (config->is_hostname) {
641         LOOKUP(helo, helo_name);
642         LOOKUP(client, client_name);
643         LOOKUP(reverse, reverse_client_name);
644         LOOKUP(recipient, recipient_domain);
645         LOOKUP(sender, sender_domain);
646         DNS(helo, helo_name);
647         DNS(client, client_name);
648         DNS(reverse, reverse_client_name);
649         DNS(recipient, recipient_domain);
650         DNS(sender, sender_domain);
651     }
652 #undef  DNS
653 #undef  LOOKUP
654     if (async->awaited > 0) {
655         return HTK_ASYNC;
656     }
657     if (async->error) {
658         err("filter %s: all the rbls returned an error", filter->name);
659         return HTK_ERROR;
660     }
661     if (async->sum >= (uint32_t)config->hard_threshold) {
662         return HTK_HARD_MATCH;
663     } else if (async->sum >= (uint32_t)config->soft_threshold) {
664         return HTK_SOFT_MATCH;
665     } else {
666         return HTK_FAIL;
667     }
668 }
669
670 static void *strlist_context_constructor(void)
671 {
672     return p_new(strlist_async_data_t, 1);
673 }
674
675 static void strlist_context_destructor(void *data)
676 {
677     strlist_async_data_t *ctx = data;
678     array_wipe(ctx->results);
679     p_delete(&ctx);
680 }
681
682 static int strlist_init(void)
683 {
684     filter_type =  filter_register("strlist", strlist_filter_constructor,
685                                    strlist_filter_destructor, strlist_filter,
686                                    strlist_context_constructor,
687                                    strlist_context_destructor);
688     /* Hooks.
689      */
690     (void)filter_hook_register(filter_type, "abort");
691     (void)filter_hook_register(filter_type, "error");
692     (void)filter_hook_register(filter_type, "fail");
693     (void)filter_hook_register(filter_type, "hard_match");
694     (void)filter_hook_register(filter_type, "soft_match");
695
696     /* Parameters.
697      */
698     (void)filter_param_register(filter_type, "file");
699     (void)filter_param_register(filter_type, "rbldns");
700     (void)filter_param_register(filter_type, "dns");
701     (void)filter_param_register(filter_type, "hard_threshold");
702     (void)filter_param_register(filter_type, "soft_threshold");
703     (void)filter_param_register(filter_type, "fields");
704     return 0;
705 }
706 module_init(strlist_init);