From f7de8573f5521263449fd80a2d5cdf3901b96087 Mon Sep 17 00:00:00 2001 From: John Denker Date: Sat, 24 Nov 2012 19:40:13 -0800 Subject: Now can check to see if hostnames map to observed IP --- tools/libltgrey.c | 5 ++- tools/libskrewt.c | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++----- tools/sepofra.c | 5 +-- 3 files changed, 90 insertions(+), 13 deletions(-) diff --git a/tools/libltgrey.c b/tools/libltgrey.c index eb6d904..0538d5c 100644 --- a/tools/libltgrey.c +++ b/tools/libltgrey.c @@ -306,10 +306,9 @@ int whatsit::check_dns_sub(const char* ipvar, const char* namevar, if (error == EAI_NONAME) return ex_badDNS; if (error) { cerr << progid + << " getaddrinfo for " << ipvar << " error " << error - << " compare " << EAI_NONAME - << " in getaddrinfo for " << ipvar - << " :: " << gai_strerror(error) << endl; + << " i.e. " << gai_strerror(error) << endl; return ex_dns_fail; } diff --git a/tools/libskrewt.c b/tools/libskrewt.c index 3c820f1..d93a9e1 100644 --- a/tools/libskrewt.c +++ b/tools/libskrewt.c @@ -214,12 +214,7 @@ int skrewt::dump_bigbuf(std::ostream& xout){ return 0; } -void check_name(name_tester& fqdn, const string ip) { - if (ip == "") { - cerr << "SPF: should never happen: email with no IP?" <ai_next){ + if (memcmp(res->ai_addr, ipresult->ai_addr, res->ai_addrlen) == 0) { + // match! + goto done; + } + } + // here if no match + fqdn.map2ip = fail; + return; +done: + fqdn.map2ip = pass; + return; +} + +void check_name_ip(name_tester& fqdn, const string ip) { + if (ip == "") { + cerr << "check_nane_ip: should never happen: email with no IP?" <