diff options
Diffstat (limited to 'rfc1035')
| -rw-r--r-- | rfc1035/rfc1035mxlist.c | 28 | ||||
| -rw-r--r-- | rfc1035/rfc1035mxlist.h | 1 | ||||
| -rw-r--r-- | rfc1035/spf.c | 2 | 
3 files changed, 17 insertions, 14 deletions
| diff --git a/rfc1035/rfc1035mxlist.c b/rfc1035/rfc1035mxlist.c index 557210f..527aab4 100644 --- a/rfc1035/rfc1035mxlist.c +++ b/rfc1035/rfc1035mxlist.c @@ -85,9 +85,9 @@ static int harvest_records(struct rfc1035_res *res,  #define	HARVEST_NODUPE		2  static int add_arecords(struct rfc1035_res *res, struct rfc1035_mxlist **list, -	struct rfc1035_reply *mxreply, -	int mxpreference, -	char *mxname, int port) +			struct rfc1035_reply *mxreply, +			int mxpreference, +			char *mxname, int port, int opts)  {  #if	RFC1035_IPV6  struct in6_addr	in; @@ -123,7 +123,7 @@ records, then query for A records.  Query for AAAA records only if A  records weren't found.  */ -	if (mxreply) +	if (mxreply && !(opts & RFC1035_MX_QUERYALL))  	{  		if ((rc=harvest_records(res, list, mxreply, mxpreference,  			mxname, RFC1035_TYPE_AAAA, &found, 0, port)) @@ -133,22 +133,23 @@ records weren't found.  		if ((rc=harvest_records(res, list, mxreply, mxpreference,  			mxname, RFC1035_TYPE_A, &found, HARVEST_NODUPE,  				port)) -						!= RFC1035_MX_OK) +		    != RFC1035_MX_OK)  			return (rc);  		if (found)	return (RFC1035_MX_OK);  	}  	if ((rc=harvest_records(res, list, mxreply, mxpreference, mxname, -		RFC1035_TYPE_A, &found, HARVEST_AUTOQUERY|HARVEST_NODUPE, port)) -						!= RFC1035_MX_OK) +		RFC1035_TYPE_AAAA, &found, HARVEST_AUTOQUERY, port)) +			!= RFC1035_MX_OK)  		return (rc); -	if (found)	return (RFC1035_MX_OK);  	if ((rc=harvest_records(res, list, mxreply, mxpreference, mxname, -		RFC1035_TYPE_AAAA, &found, HARVEST_AUTOQUERY, port)) -			!= RFC1035_MX_OK) +		RFC1035_TYPE_A, &found, HARVEST_AUTOQUERY|HARVEST_NODUPE, port)) +						!= RFC1035_MX_OK)  		return (rc); +	if (found)	return (RFC1035_MX_OK); +  #else  	if ((rc=harvest_records(res, list, mxreply, mxpreference, mxname,  		RFC1035_TYPE_A, &found, HARVEST_AUTOQUERY, port)) @@ -318,7 +319,7 @@ int seen_good=0;  			if (opts & RFC1035_MX_AFALLBACK)  				return (add_arecords(res, list, 0, -1, -						     namebuf, port)); +						     namebuf, port, opts));  			return RFC1035_MX_HARDERR;  		} @@ -342,8 +343,9 @@ int seen_good=0;  			continue;  		switch (add_arecords(res, list, replyp, -			replyp->allrrs[index]->rr.mx.preference, mxname, -			port)) { +				     replyp->allrrs[index]->rr.mx.preference, +				     mxname, +				     port, opts)) {  		case	RFC1035_MX_SOFTERR:  			seen_softerr=1;  			continue; diff --git a/rfc1035/rfc1035mxlist.h b/rfc1035/rfc1035mxlist.h index e4349b8..a4417b6 100644 --- a/rfc1035/rfc1035mxlist.h +++ b/rfc1035/rfc1035mxlist.h @@ -49,6 +49,7 @@ int rfc1035_mxlist_create_x(struct rfc1035_res *,  			    struct rfc1035_mxlist **);  #define RFC1035_MX_AFALLBACK 1  #define RFC1035_MX_IGNORESOFTERR 2 +#define RFC1035_MX_QUERYALL 4  #ifdef  __cplusplus  } diff --git a/rfc1035/spf.c b/rfc1035/spf.c index 3839fde..efda0d9 100644 --- a/rfc1035/spf.c +++ b/rfc1035/spf.c @@ -856,7 +856,7 @@ static char mechanism(const char *name,  		}  		rc=rfc1035_mxlist_create_x(&info->res, -					   domain_spec, 0, +					   domain_spec, RFC1035_MX_QUERYALL,  					   &mxlist);  		free(domain_spec);  		if (rc) | 
