summaryrefslogtreecommitdiffabout
path: root/src/main.c
authorSergey Poznyakoff <gray@gnu.org.ua>2017-10-23 17:50:09 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2017-10-23 17:50:09 (GMT)
commit368a705fe49cc31857c08e357d42314b3d54b2b5 (patch) (side-by-side diff)
treedbe8071907c0908737c42ca0d1566efbbbd21f58 /src/main.c
parent2f77b90a2d1e7a43f7d77f06c953142cb90146f4 (diff)
downloadmailfromd-368a705fe49cc31857c08e357d42314b3d54b2b5.tar.gz
mailfromd-368a705fe49cc31857c08e357d42314b3d54b2b5.tar.bz2
Improve DNS API; rewrite DNS testsuite.
* lib/dns.c (dnsbase_real_init): Take configuration text as argument (can be NULL). Enable adns debugging on trace9 (dnsbase_file_init): New function. (dns_reply_init): New function. (dns_reply_push): New function. (soa_check): New function. Rewrite all functions using dns_reply_init+dns_reply_push, as appropriate. * lib/dns.h (dns_reply) <maxcount, data.ptr>: New members. (dnsbase_real_init, dnsbase_file_init) (dns_reply_init, soa_check): New protos. * src/builtin/dns.bi (resolve_host): Rewrite to return all A records. (dns_replies_intersect): New static function. (primitive_ismx): Rewrite taking into account all A records. * src/main.c: New option --resolv-conf-file (mostly for checking. * tests/resolv.c: Change option handling, implement new options. * tests/atlocal.in (MF_TOPDOMAIN,MF_NAMESERVER): New variables. (at_resolv_conf): New function. * tests/Makefile.am: Add new tests. * tests/testsuite.at: Include new tests. * tests/hasmx.at: Use dedicated MF test domains, * tests/hostname.at: Likewise. * tests/ismx.at: Likewise. * tests/rescname.at: Likewise. * tests/resolve.at: Likewise. * tests/resolv_a.at: New test. * tests/resolv_mx.at: Likewise. * tests/resolv_ptr.at: Likewise. * tests/resolv_ptr_val.at: Likewise. * tests/resolv_spf.at: Likewise. * tests/resolv_txt.at: Likewise.
Diffstat (limited to 'src/main.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/main.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 9873ed0..dcc7d43 100644
--- a/src/main.c
+++ b/src/main.c
@@ -82,6 +82,8 @@ mu_stream_t mf_strecho; /* Output stream for 'echo' statements */
static int trace_option = ARG_UNSET;
static mu_list_t trace_modules;
+
+static char *resolv_conf_file;
/* Preprocessor helper function */
static void
@@ -563,6 +565,9 @@ static struct mu_option mailfromd_options[] = {
{ "relayed-domain-file", 0, N_("FILE"), MU_OPTION_DEFAULT,
N_("read relayed domains from FILE"),
mu_c_string, NULL, opt_relayed_domain_file },
+ { "resolv-conf-file", 0, N_("FILE"), MU_OPTION_DEFAULT,
+ N_("read resolver configuration from FILE"),
+ mu_c_string, &resolv_conf_file },
MU_OPTION_GROUP(N_("Preprocessor options")),
{ "preprocessor", 0, N_("COMMAND"), MU_OPTION_DEFAULT,
@@ -1269,7 +1274,9 @@ main(int argc, char **argv)
exit(EX_USAGE);
init_relayed_domains();
-
+ if (resolv_conf_file)
+ dnsbase_file_init(resolv_conf_file);
+
if (trace_option != ARG_UNSET)
do_trace = trace_option;
if (trace_modules) {

Return to:

Send suggestions and report system problems to the System administrator.