Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
static inline rbl_result_t rbl_dns_check(const char *hostname)
{
static inline rbl_result_t rbl_dns_check(const char *hostname)
{
+ debug("looking up for %s", hostname);
struct hostent *host = gethostbyname(hostname);
if (host != NULL) {
struct hostent *host = gethostbyname(hostname);
if (host != NULL) {
return RBL_FOUND;
} else {
if (h_errno == HOST_NOT_FOUND) {
return RBL_FOUND;
} else {
if (h_errno == HOST_NOT_FOUND) {
+ debug("host not found: %s", hostname);
+ debug("dns error: %m");
config_t *config = config_new();
config->filename = file;
if (!config_reload(config)) {
config_t *config = config_new();
config->filename = file;
if (!config_reload(config)) {
+ config_delete(&config);
return NULL;
}
return config;
return NULL;
}
return config;
- PARSE_CHECK(data->rbls.len,
+ PARSE_CHECK(data->rbls.len || data->host_offsets.len,
"no file parameter in the filter %s", filter->name);
filter->data = data;
return true;
"no file parameter in the filter %s", filter->name);
filter->data = data;
return true;
PARSE_CHECK(config->is_email != config->is_hostname,
"matched field MUST be emails XOR hostnames");
PARSE_CHECK(config->is_email != config->is_hostname,
"matched field MUST be emails XOR hostnames");
- PARSE_CHECK(config->tries.len,
+ PARSE_CHECK(config->tries.len || config->host_offsets.len,
"no file parameter in the filter %s", filter->name);
filter->data = config;
return true;
"no file parameter in the filter %s", filter->name);
filter->data = config;
return true;
if (config->match_ ## Flag) { \
const int len = m_strlen(query->Field); \
strlist_copy(normal, query->Field, len, false); \
if (config->match_ ## Flag) { \
const int len = m_strlen(query->Field); \
strlist_copy(normal, query->Field, len, false); \
- for (uint32_t i = 0 ; len > 0 && i < config->tries.len ; ++i) { \
+ for (uint32_t i = 0 ; len > 0 && i < config->host_offsets.len ; ++i) { \
const char *rbl = array_ptr(config->hosts, \
array_elt(config->host_offsets, i));\
const int weight = array_elt(config->host_weights, i); \
const char *rbl = array_ptr(config->hosts, \
array_elt(config->host_offsets, i));\
const int weight = array_elt(config->host_weights, i); \