1 /*************************************************
2 * Exim - an Internet mail transport agent *
3 *************************************************/
5 /* Exim - SPF lookup module using libspf2
6 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
8 Copyright (c) The Exim Maintainers 2020 - 2022
9 Copyright (c) 2005 Chris Webb, Arachsys Internet Services Ltd
10 SPDX-License-Identifier: GPL-2.0-or-later
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the GNU General Public License
14 as published by the Free Software Foundation; either version 2
15 of the License, or (at your option) any later version.
21 static void dummy(int x);
22 static void dummy2(int x) { dummy(x-1); }
23 static void dummy(int x) { dummy2(x-1); }
26 #include "lf_functions.h"
27 #if !defined(HAVE_NS_TYPE) && defined(NS_INADDRSZ)
31 #include <spf2/spf_dns_resolv.h>
32 #include <spf2/spf_dns_cache.h>
36 spf_open(const uschar * filename, uschar ** errmsg)
38 misc_module_info * mi = misc_mod_find(US"spf", errmsg);
41 typedef void * (*fn_t)(const uschar *, uschar **);
42 return (((fn_t *) mi->functions)[3]) (filename, errmsg);
49 spf_close(void * handle)
51 misc_module_info * mi = misc_mod_find(US"spf", NULL);
54 typedef void (*fn_t)(void *);
55 return (((fn_t *) mi->functions)[4]) (handle);
61 spf_find(void * handle, const uschar * filename, const uschar * keystring,
62 int key_len, uschar ** result, uschar ** errmsg, uint * do_cache,
65 misc_module_info * mi = misc_mod_find(US"spf", errmsg);
68 typedef int (*fn_t) (void *, const uschar *, const uschar *,
69 int, uschar **, uschar **, uint *, const uschar *);
70 return (((fn_t *) mi->functions)[5]) (handle, filename, keystring, key_len,
71 result, errmsg, do_cache, opts);
77 /*************************************************
78 * Version reporting entry point *
79 *************************************************/
81 /* See local README for interface description. */
83 #include "../version.h"
86 spf_version_report(gstring * g)
89 g = string_fmt_append(g, "Library version: SPF: Exim version %s\n", EXIM_VERSION_STR));
95 static lookup_info spf_lookup_info = {
96 .name = US"spf", /* lookup name */
97 .type = 0, /* not absfile, not query style */
98 .open = spf_open, /* open function */
99 .check = NULL, /* no check function */
100 .find = spf_find, /* find function */
101 .close = spf_close, /* close function */
102 .tidy = NULL, /* no tidy function */
103 .quote = NULL, /* no quoting function */
104 .version_report = spf_version_report /* version reporting */
107 #ifdef notdef_DYNLOOKUP
108 #define spf_lookup_module_info _lookup_module_info
111 static lookup_info *_lookup_list[] = { &spf_lookup_info };
112 lookup_module_info spf_lookup_module_info = { LOOKUP_MODULE_INFO_MAGIC, _lookup_list, 1 };
114 #endif /* SUPPORT_SPF */