#undef SPF_DEBUG
+#define SPF_ERROR spf_error_quark ()
+static inline GQuark
+spf_error_quark (void)
+{
+ return g_quark_from_static_string ("spf-error-quark");
+}
+
struct spf_dns_cb {
struct spf_record *rec;
struct spf_addr *addr;
spf_action_t cur_action;
gboolean in_include;
+ GError **err;
};
-#define CHECK_REC(rec) \
+#define CHECK_REC(rec, err) \
do { \
if ((rec)->nested > SPF_MAX_NESTING || \
(rec)->dns_requests > SPF_MAX_DNS_REQUESTS) { \
+ g_set_error ((err), SPF_ERROR, ERANGE, \
+ "spf recursion limit is reached: %d", \
+ (rec)->dns_requests); \
return FALSE; \
} \
} while (0) \
-static gboolean parse_spf_record (struct worker_task *task, struct spf_record *rec);
-static void start_spf_parse (struct spf_record *rec, gchar *begin);
+static gboolean parse_spf_record (struct worker_task *task, struct spf_record *rec, GError **err);
+static void start_spf_parse (struct spf_record *rec, gchar *begin, GError **err);
/* Determine spf mech */
static spf_mech_t
}
g_list_free (rec->addrs);
}
+ if (rec->err != NULL) {
+ g_error_free (rec->err);
+ }
}
static gboolean
-parse_spf_ipmask (const gchar *begin, struct spf_addr *addr)
+parse_spf_ipmask (const gchar *begin, struct spf_addr *addr, GError **err)
{
const gchar *pos;
gchar mask_buf[5] = {'\0'}, *p;
case 0:
/* Require ':' */
if (*pos != ':') {
+ g_set_error (err, SPF_ERROR, EINVAL, "invalid ip record, must start with ':'");
return FALSE;
}
state = 1;
case 1:
#ifdef HAVE_INET_PTON
if (p - ip_buf >= (gint)sizeof (ip_buf)) {
+ g_set_error (err, SPF_ERROR, E2BIG, "invalid ip record, too long: %d",
+ (gint)(p - ip_buf));
return FALSE;
}
if (g_ascii_isxdigit (*pos)) {
}
else {
/* Invalid character */
+ g_set_error (err, SPF_ERROR, EINVAL, "invalid character in ip record");
return FALSE;
}
break;
case 2:
/* Parse mask */
if (p - mask_buf >= (gint)sizeof (mask_buf)) {
+ g_set_error (err, SPF_ERROR, E2BIG, "mask value is too long in ip record");
return FALSE;
}
if (g_ascii_isdigit (*pos)) {
*p ++ = *pos ++;
}
else {
+ g_set_error (err, SPF_ERROR, EINVAL, "invalid characters in the mask field in ip record");
return FALSE;
}
break;
addr->data.normal.ipv6 = TRUE;
}
else {
+ g_set_error (err, SPF_ERROR, EINVAL, "cannot parse IP address in ip record");
return FALSE;
}
}
if (!addr->data.normal.ipv6) {
addr->data.normal.mask = strtoul (mask_buf, NULL, 10);
if (addr->data.normal.mask > 32) {
- msg_info ("bad ipmask value: '%s'", begin);
+ g_set_error (err, SPF_ERROR, E2BIG, "invalid mask in ip record: %d", addr->data.normal.mask);
return FALSE;
}
}
else {
addr->data.normal.mask = strtoul (mask_buf, NULL, 10);
if (addr->data.normal.mask > 128) {
- msg_info ("bad ipmask value: '%s'", begin);
+ g_set_error (err, SPF_ERROR, E2BIG, "invalid mask in ip record: %d", addr->data.normal.mask);
return FALSE;
}
}
}
static gchar *
-parse_spf_hostmask (struct worker_task *task, const gchar *begin, struct spf_addr *addr, struct spf_record *rec)
+parse_spf_hostmask (struct worker_task *task, const gchar *begin,
+ struct spf_addr *addr, struct spf_record *rec, GError **err)
{
gchar *host = NULL, *p, mask_buf[3];
gint hostlen;
rspamd_strlcpy (mask_buf, p + 1, sizeof (mask_buf));
addr->data.normal.mask = mask_buf[0] * 10 + mask_buf[1];
if (addr->data.normal.mask > 32) {
+ g_set_error (err, SPF_ERROR, E2BIG, "invalid mask in ip record: %d", addr->data.normal.mask);
return FALSE;
}
if (host == NULL) {
case SPF_RESOLVE_MX:
if (reply->type == DNS_REQUEST_MX) {
/* Now resolve A record for this MX */
- if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, elt_data->mx.name)) {
+ if (make_dns_request (task->resolver,
+ task->s, task->task_pool, spf_record_dns_callback, (void *)cb,
+ DNS_REQUEST_A, elt_data->mx.name)) {
task->dns_requests ++;
cb->rec->requests_inflight ++;
}
cb->rec->addrs = g_list_insert_before (cb->rec->addrs, tmp, new_addr);
}
else {
- msg_info ("wrong address list");
+ g_set_error (cb->err, SPF_ERROR, EINVAL, "cannot find address");
}
}
cb->rec->addrs = g_list_insert_before (cb->rec->addrs, tmp, new_addr);
}
else {
- msg_info ("wrong address list");
+ g_set_error (cb->err, SPF_ERROR, EINVAL, "cannot find address in list");
}
}
g_list_free (cb->rec->addrs);
cb->rec->addrs = NULL;
}
- start_spf_parse (cb->rec, begin);
+ start_spf_parse (cb->rec, begin, cb->err);
}
break;
tmp = cb->rec->addrs;
cb->rec->addrs = NULL;
cb->rec->in_include = TRUE;
- start_spf_parse (cb->rec, begin);
+ start_spf_parse (cb->rec, begin, cb->err);
cb->rec->in_include = FALSE;
#ifdef SPF_DEBUG
switch (cb->cur_action) {
case SPF_RESOLVE_MX:
if (reply->type == DNS_REQUEST_MX) {
- msg_info ("cannot find MX record for %s", cb->rec->cur_domain);
+ g_set_error (cb->err, SPF_ERROR, EINVAL,
+ "cannot find MX record for %s", cb->rec->cur_domain);
cb->addr->data.normal.d.in4.s_addr = INADDR_NONE;
cb->addr->data.normal.mask = 32;
}
else if (reply->type != DNS_REQUEST_MX) {
- msg_info ("cannot resolve MX record for %s", cb->rec->cur_domain);
+ g_set_error (cb->err, SPF_ERROR, EINVAL,
+ "cannot resolve MX record for %s", cb->rec->cur_domain);
cb->addr->data.normal.d.in4.s_addr = INADDR_NONE;
cb->addr->data.normal.mask = 32;
}
case SPF_RESOLVE_PTR:
break;
case SPF_RESOLVE_REDIRECT:
- msg_info ("cannot resolve TXT record for redirect action");
+ g_set_error (cb->err, SPF_ERROR, EINVAL,
+ "cannot resolve TXT record for %s, redirect action",
+ cb->rec->cur_domain);
break;
case SPF_RESOLVE_INCLUDE:
- msg_info ("cannot resolve TXT record for include action");
+ g_set_error (cb->err, SPF_ERROR, EINVAL,
+ "cannot resolve TXT record for %s, include action",
+ cb->rec->cur_domain);
break;
case SPF_RESOLVE_EXP:
break;
}
if (cb->rec->requests_inflight == 0) {
- cb->rec->callback (cb->rec, cb->rec->task);
+ cb->rec->callback (cb->rec, cb->rec->task, cb->rec->err);
}
}
static gboolean
-parse_spf_a (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_a (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
struct spf_dns_cb *cb;
gchar *host;
- CHECK_REC (rec);
+ CHECK_REC (rec, err);
if (begin == NULL || *begin != ':') {
return FALSE;
}
begin ++;
- host = parse_spf_hostmask (task, begin, addr, rec);
+ host = parse_spf_hostmask (task, begin, addr, rec, err);
if (!host) {
return FALSE;
cb->addr = addr;
cb->cur_action = SPF_RESOLVE_A;
cb->in_include = rec->in_include;
- if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) {
+ cb->err = err;
+ if (make_dns_request (task->resolver, task->s, task->task_pool,
+ spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) {
task->dns_requests ++;
rec->requests_inflight ++;
return TRUE;
}
static gboolean
-parse_spf_ptr (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_ptr (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
- CHECK_REC (rec);
+ CHECK_REC (rec, err);
- msg_info ("ptr parsing is unimplemented");
+ g_set_error (err, SPF_ERROR, ENOTSUP, "PTR records parsing is not implemented");
return FALSE;
}
static gboolean
-parse_spf_mx (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_mx (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
struct spf_dns_cb *cb;
gchar *host;
- CHECK_REC (rec);
+ CHECK_REC (rec, err);
if (begin == NULL) {
return FALSE;
begin ++;
}
- host = parse_spf_hostmask (task, begin, addr, rec);
+ host = parse_spf_hostmask (task, begin, addr, rec, err);
if (!host) {
return FALSE;
memset (&addr->data.normal, 0, sizeof (addr->data.normal));
cb->cur_action = SPF_RESOLVE_MX;
cb->in_include = rec->in_include;
- if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_MX, host)) {
+ cb->err = err;
+ if (make_dns_request (task->resolver, task->s, task->task_pool,
+ spf_record_dns_callback, (void *)cb, DNS_REQUEST_MX, host)) {
task->dns_requests ++;
rec->requests_inflight ++;
}
static gboolean
-parse_spf_all (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_all (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
/* All is 0/0 */
memset (&addr->data.normal.d, 0, sizeof (addr->data.normal.d));
}
static gboolean
-parse_spf_ip4 (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_ip4 (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
/* ip4:addr[/mask] */
- CHECK_REC (rec);
- return parse_spf_ipmask (begin, addr);
+ CHECK_REC (rec, err);
+ return parse_spf_ipmask (begin, addr, err);
}
#ifdef HAVE_INET_PTON
static gboolean
-parse_spf_ip6 (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_ip6 (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
/* ip6:addr[/mask] */
- CHECK_REC (rec);
- return parse_spf_ipmask (begin, addr);
+ CHECK_REC (rec, err);
+ return parse_spf_ipmask (begin, addr, err);
}
#endif
static gboolean
-parse_spf_include (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_include (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
struct spf_dns_cb *cb;
gchar *domain;
- CHECK_REC (rec);
+ CHECK_REC (rec, err);
if (begin == NULL || *begin != ':') {
return FALSE;
cb->addr = addr;
cb->cur_action = SPF_RESOLVE_INCLUDE;
cb->in_include = rec->in_include;
+ cb->err = err;
addr->is_list = TRUE;
addr->data.list = NULL;
domain = memory_pool_strdup (task->task_pool, begin);
- if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) {
+ if (make_dns_request (task->resolver, task->s, task->task_pool,
+ spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) {
task->dns_requests ++;
rec->requests_inflight ++;
}
static gboolean
-parse_spf_exp (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_exp (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
- CHECK_REC (rec);
+ CHECK_REC (rec, err);
- msg_info ("exp record is ignored");
return TRUE;
}
static gboolean
-parse_spf_redirect (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_redirect (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
struct spf_dns_cb *cb;
gchar *domain;
- CHECK_REC (rec);
+ CHECK_REC (rec, err);
if (begin == NULL || *begin != '=') {
return FALSE;
cb->addr = addr;
cb->cur_action = SPF_RESOLVE_REDIRECT;
cb->in_include = rec->in_include;
+ cb->err = err;
domain = memory_pool_strdup (task->task_pool, begin);
- if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) {
+ if (make_dns_request (task->resolver, task->s, task->task_pool,
+ spf_record_dns_callback, (void *)cb, DNS_REQUEST_TXT, domain)) {
task->dns_requests ++;
rec->requests_inflight ++;
}
static gboolean
-parse_spf_exists (struct worker_task *task, const gchar *begin, struct spf_record *rec, struct spf_addr *addr)
+parse_spf_exists (struct worker_task *task, const gchar *begin, struct spf_record *rec,
+ struct spf_addr *addr, GError **err)
{
struct spf_dns_cb *cb;
gchar *host;
- CHECK_REC (rec);
+ CHECK_REC (rec, err);
if (begin == NULL || *begin != ':') {
return FALSE;
cb->addr = addr;
cb->cur_action = SPF_RESOLVE_EXISTS;
cb->in_include = rec->in_include;
+ cb->err = err;
host = memory_pool_strdup (task->task_pool, begin);
- if (make_dns_request (task->resolver, task->s, task->task_pool, spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) {
+ if (make_dns_request (task->resolver, task->s, task->task_pool,
+ spf_record_dns_callback, (void *)cb, DNS_REQUEST_A, host)) {
task->dns_requests ++;
rec->requests_inflight ++;
}
static void
-reverse_spf_ip (gchar *ip, gint len)
+reverse_spf_ip (gchar *ip, gint len, GError **err)
{
gchar ipbuf[sizeof("255.255.255.255") - 1], *p, *c;
gint t = 0, l = len;
if (len > (gint)sizeof (ipbuf)) {
- msg_info ("cannot reverse string of length %d", len);
+ g_set_error (err, SPF_ERROR, E2BIG, "cannot reverse string of length %d", len);
return;
}
}
static gchar *
-expand_spf_macro (struct worker_task *task, struct spf_record *rec, gchar *begin)
+expand_spf_macro (struct worker_task *task, struct spf_record *rec, gchar *begin, GError **err)
{
gchar *p, *c, *new, *tmp;
gint len = 0, slen = 0, state = 0;
}
else {
/* Something unknown */
- msg_info ("bad spf element: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf element in a macro: %s", begin);
return begin;
}
p ++;
}
break;
default:
- msg_info ("unknown or unsupported spf macro %c in %s", *p, begin);
+ g_set_error (err, SPF_ERROR, EINVAL,
+ "unknown or unsupported spf macro %c in %s", *p, begin);
return begin;
}
p ++;
need_expand = TRUE;
}
else if (*p != 'r' && !g_ascii_isdigit (*p)) {
- msg_info ("unknown or unsupported spf modifier %c in %s", *p, begin);
+ g_set_error (err, SPF_ERROR, EINVAL,
+ "unknown or unsupported spf modifier %c in %s", *p, begin);
return begin;
}
p ++;
}
else {
/* Something unknown */
- msg_info ("bad spf element: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf element in a macro: %s", begin);
return begin;
}
p ++;
}
break;
default:
- msg_info ("unknown or unsupported spf macro %c in %s", *p, begin);
+ g_set_error (err, SPF_ERROR, EINVAL,
+ "unknown or unsupported spf macro %c in %s", *p, begin);
return begin;
}
p ++;
state = 0;
}
else if (*p == 'r' && len != 0) {
- reverse_spf_ip (c - len, len);
+ reverse_spf_ip (c - len, len, err);
len = 0;
}
else if (g_ascii_isdigit (*p)) {
/*XXX: try to implement domain strimming */
}
else {
- msg_info ("unknown or unsupported spf modifier %c in %s", *p, begin);
+ g_set_error (err, SPF_ERROR, EINVAL,
+ "unknown or unsupported spf modifier %c in %s", *p, begin);
return begin;
}
p ++;
}
/* Null terminate */
*c = '\0';
- msg_info ("%s", new);
return new;
}
/* Read current element and try to parse record */
static gboolean
-parse_spf_record (struct worker_task *task, struct spf_record *rec)
+parse_spf_record (struct worker_task *task, struct spf_record *rec, GError **err)
{
struct spf_addr *new = NULL;
gboolean need_shift, res = FALSE;
return TRUE;
}
else {
- begin = expand_spf_macro (task, rec, rec->cur_elt);
+ begin = expand_spf_macro (task, rec, rec->cur_elt, err);
if (*begin == '?' || *begin == '+' || *begin == '-' || *begin == '~') {
begin ++;
}
if (g_ascii_strncasecmp (begin, SPF_ALL, sizeof (SPF_ALL) - 1) == 0) {
NEW_ADDR (new);
begin += sizeof (SPF_ALL) - 1;
- res = parse_spf_all (task, begin, rec, new);
+ res = parse_spf_all (task, begin, rec, new, err);
}
else if (g_ascii_strncasecmp (begin, SPF_A, sizeof (SPF_A) - 1) == 0) {
NEW_ADDR (new);
begin += sizeof (SPF_A) - 1;
- res = parse_spf_a (task, begin, rec, new);
+ res = parse_spf_a (task, begin, rec, new, err);
}
else {
- msg_info ("bad spf command: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf command: %s", begin);
}
break;
case 'i':
if (g_ascii_strncasecmp (begin, SPF_IP4, sizeof (SPF_IP4) - 1) == 0) {
NEW_ADDR (new);
begin += sizeof (SPF_IP4) - 1;
- res = parse_spf_ip4 (task, begin, rec, new);
+ res = parse_spf_ip4 (task, begin, rec, new, err);
}
else if (g_ascii_strncasecmp (begin, SPF_INCLUDE, sizeof (SPF_INCLUDE) - 1) == 0) {
NEW_ADDR (new);
begin += sizeof (SPF_INCLUDE) - 1;
- res = parse_spf_include (task, begin, rec, new);
+ res = parse_spf_include (task, begin, rec, new, err);
}
else if (g_ascii_strncasecmp (begin, SPF_IP6, sizeof (SPF_IP6) - 1) == 0) {
#ifdef HAVE_INET_PTON
NEW_ADDR (new);
begin += sizeof (SPF_IP6) - 1;
- res = parse_spf_ip6 (task, begin, rec, new);
+ res = parse_spf_ip6 (task, begin, rec, new, err);
#else
msg_info ("ignoring ip6 spf command as IPv6 is not supported: %s", begin);
new = NULL;
#endif
}
else {
- msg_info ("bad spf command: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf command: %s", begin);
}
break;
case 'm':
if (g_ascii_strncasecmp (begin, SPF_MX, sizeof (SPF_MX) - 1) == 0) {
NEW_ADDR (new);
begin += sizeof (SPF_MX) - 1;
- res = parse_spf_mx (task, begin, rec, new);
+ res = parse_spf_mx (task, begin, rec, new, err);
}
else {
msg_info ("bad spf command: %s", begin);
if (g_ascii_strncasecmp (begin, SPF_PTR, sizeof (SPF_PTR) - 1) == 0) {
NEW_ADDR (new);
begin += sizeof (SPF_PTR) - 1;
- res = parse_spf_ptr (task, begin, rec, new);
+ res = parse_spf_ptr (task, begin, rec, new, err);
}
else {
- msg_info ("bad spf command: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf command: %s", begin);
}
break;
case 'e':
/* exp or exists */
if (g_ascii_strncasecmp (begin, SPF_EXP, sizeof (SPF_EXP) - 1) == 0) {
begin += sizeof (SPF_EXP) - 1;
- res = parse_spf_exp (task, begin, rec, NULL);
+ res = parse_spf_exp (task, begin, rec, NULL, err);
}
else if (g_ascii_strncasecmp (begin, SPF_EXISTS, sizeof (SPF_EXISTS) - 1) == 0) {
NEW_ADDR (new);
begin += sizeof (SPF_EXISTS) - 1;
- res = parse_spf_exists (task, begin, rec, new);
+ res = parse_spf_exists (task, begin, rec, new, err);
}
else {
- msg_info ("bad spf command: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf command: %s", begin);
}
break;
case 'r':
/* redirect */
if (g_ascii_strncasecmp (begin, SPF_REDIRECT, sizeof (SPF_REDIRECT) - 1) == 0) {
begin += sizeof (SPF_REDIRECT) - 1;
- res = parse_spf_redirect (task, begin, rec, NULL);
+ res = parse_spf_redirect (task, begin, rec, NULL, err);
}
else {
- msg_info ("bad spf command: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf command: %s", begin);
}
break;
case 'v':
}
break;
default:
- msg_info ("bad spf command: %s", begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf command: %s", begin);
break;
}
if (res) {
}
static void
-start_spf_parse (struct spf_record *rec, gchar *begin)
+start_spf_parse (struct spf_record *rec, gchar *begin, GError **err)
{
/* Skip spaces */
while (g_ascii_isspace (*begin)) {
if (rec->elts) {
memory_pool_add_destructor (rec->task->task_pool, (pool_destruct_func)g_strfreev, rec->elts);
rec->cur_elt = rec->elts[0];
- while (parse_spf_record (rec->task, rec));
+ while (parse_spf_record (rec->task, rec, err));
}
}
else if (g_ascii_strncasecmp (begin, SPF_VER2_STR, sizeof (SPF_VER2_STR) - 1) == 0) {
/* Skip one number of record, so no we are here spf2.0/ */
begin += sizeof (SPF_VER2_STR);
if (*begin != '/') {
- msg_info ("sender id string has invalid scope");
+ g_set_error (err, SPF_ERROR, EINVAL, "sender id string has invalid scope");
}
else {
begin ++;
if (rec->elts) {
memory_pool_add_destructor (rec->task->task_pool, (pool_destruct_func)g_strfreev, rec->elts);
rec->cur_elt = rec->elts[0];
- while (parse_spf_record (rec->task, rec));
+ while (parse_spf_record (rec->task, rec, err));
}
}
else {
- msg_info ("bad spf record version: %*s", sizeof (SPF_VER1_STR) - 1, begin);
+ g_set_error (err, SPF_ERROR, EINVAL, "bad spf record version: %*.s",
+ (int)sizeof (SPF_VER1_STR) - 1, begin);
}
}
cur = reply->elements;
while (cur) {
elt = cur->data;
- start_spf_parse (rec, elt->txt.data);
+ start_spf_parse (rec, elt->txt.data, &rec->err);
cur = g_list_next (cur);
}
}
if (rec->requests_inflight == 0) {
- rec->callback (rec, rec->task);
+ rec->callback (rec, rec->task, rec->err);
}
}
rec = memory_pool_alloc0 (task->task_pool, sizeof (struct spf_record));
rec->task = task;
rec->callback = callback;
+ rec->err = NULL;
/* Add destructor */
memory_pool_add_destructor (task->task_pool, (pool_destruct_func)spf_record_destructor, rec);