Bus error in smtpctl spf walk

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Bus error in smtpctl spf walk

JanJ-2
>Synopsis: Bus error in smtpctl spf walk (on certain domains)
>Category: user
>Environment:
        System      : OpenBSD 6.3
        Details     : OpenBSD 6.3-beta (GENERIC.MP) #26: Fri Mar  2 22:56:04 MST 2018
                         [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP

        Architecture: OpenBSD.amd64
        Machine     : amd64
>Description:
        Got a mail with "Return-Path: [hidden email]" and wanted to add it to my white list but smtpctl spf walk says "Bus error". Other domains like facebookmail.com works without problem. http://www.kitterman.com/spf/validate.html seems to think sendgrid.meetup.com has a valid record.

>How-To-Repeat:
        echo sendgrid.meetup.com | smtpctl spf walk

>Fix:
        Not known

Reply | Threaded
Open this post in threaded view
|

Re: Bus error in smtpctl spf walk

Otto Moerbeek
On Tue, Mar 06, 2018 at 10:46:23AM +0100, Jan Johansson wrote:

> >Synopsis: Bus error in smtpctl spf walk (on certain domains)
> >Category: user
> >Environment:
> System      : OpenBSD 6.3
> Details     : OpenBSD 6.3-beta (GENERIC.MP) #26: Fri Mar  2 22:56:04 MST 2018
> [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
>
> Architecture: OpenBSD.amd64
> Machine     : amd64
> >Description:
>         Got a mail with "Return-Path: [hidden email]" and wanted to add it to my white list but smtpctl spf walk says "Bus error". Other domains like facebookmail.com works without problem. http://www.kitterman.com/spf/validate.html seems to think sendgrid.meetup.com has a valid record.
>
> >How-To-Repeat:
>         echo sendgrid.meetup.com | smtpctl spf walk
>
> >Fix:
>         Not known

Try this,

        -Otto

Index: spfwalk.c
===================================================================
RCS file: /cvs/src/usr.sbin/smtpd/spfwalk.c,v
retrieving revision 1.5
diff -u -p -r1.5 spfwalk.c
--- spfwalk.c 26 Jan 2018 08:00:54 -0000 1.5
+++ spfwalk.c 6 Mar 2018 12:12:42 -0000
@@ -140,6 +140,8 @@ dispatch_txt(struct dns_rr *rr)
  char *end;
  ssize_t n;
 
+ if (rr->rr_type != T_TXT)
+ return;
  n = parse_txt(rr->rr.other.rdata, rr->rr.other.rdlen, buf, sizeof(buf));
  if (n == -1 || n == sizeof(buf))
  return;

Reply | Threaded
Open this post in threaded view
|

Re: Bus error in smtpctl spf walk

Ricardo Mestre-2
Hi Otto,

Ugh! They have an "SPF record" and causes the error, your patch solves
the issue.

This will also prevent similar error(s) from other offenders, so FWIW
OK mestre@

On 13:13 Tue 06 Mar     , Otto Moerbeek wrote:

> On Tue, Mar 06, 2018 at 10:46:23AM +0100, Jan Johansson wrote:
>
> > >Synopsis: Bus error in smtpctl spf walk (on certain domains)
> > >Category: user
> > >Environment:
> > System      : OpenBSD 6.3
> > Details     : OpenBSD 6.3-beta (GENERIC.MP) #26: Fri Mar  2 22:56:04 MST 2018
> > [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> >
> > Architecture: OpenBSD.amd64
> > Machine     : amd64
> > >Description:
> >         Got a mail with "Return-Path: [hidden email]" and wanted to add it to my white list but smtpctl spf walk says "Bus error". Other domains like facebookmail.com works without problem. http://www.kitterman.com/spf/validate.html seems to think sendgrid.meetup.com has a valid record.
> >
> > >How-To-Repeat:
> >         echo sendgrid.meetup.com | smtpctl spf walk
> >
> > >Fix:
> >         Not known
>
> Try this,
>
> -Otto
>
> Index: spfwalk.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/spfwalk.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 spfwalk.c
> --- spfwalk.c 26 Jan 2018 08:00:54 -0000 1.5
> +++ spfwalk.c 6 Mar 2018 12:12:42 -0000
> @@ -140,6 +140,8 @@ dispatch_txt(struct dns_rr *rr)
>   char *end;
>   ssize_t n;
>  
> + if (rr->rr_type != T_TXT)
> + return;
>   n = parse_txt(rr->rr.other.rdata, rr->rr.other.rdlen, buf, sizeof(buf));
>   if (n == -1 || n == sizeof(buf))
>   return;
>

Reply | Threaded
Open this post in threaded view
|

Re: Bus error in smtpctl spf walk

JanJ-2
In reply to this post by Otto Moerbeek
Otto Moerbeek <[hidden email]> wrote:

> Try this,
>
> -Otto
>
> Index: spfwalk.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/spfwalk.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 spfwalk.c
> --- spfwalk.c 26 Jan 2018 08:00:54 -0000 1.5
> +++ spfwalk.c 6 Mar 2018 12:12:42 -0000
> @@ -140,6 +140,8 @@ dispatch_txt(struct dns_rr *rr)
>   char *end;
>   ssize_t n;
>  
> + if (rr->rr_type != T_TXT)
> + return;
>   n = parse_txt(rr->rr.other.rdata, rr->rr.other.rdlen, buf, sizeof(buf));
>   if (n == -1 || n == sizeof(buf))
>   return;

Thats works perfect!

Thank you!

Reply | Threaded
Open this post in threaded view
|

Re: Bus error in smtpctl spf walk

Gilles Chehade-7
In reply to this post by Otto Moerbeek
On Tue, Mar 06, 2018 at 01:13:11PM +0100, Otto Moerbeek wrote:

> On Tue, Mar 06, 2018 at 10:46:23AM +0100, Jan Johansson wrote:
>
> > >Synopsis: Bus error in smtpctl spf walk (on certain domains)
> > >Category: user
> > >Environment:
> > System      : OpenBSD 6.3
> > Details     : OpenBSD 6.3-beta (GENERIC.MP) #26: Fri Mar  2 22:56:04 MST 2018
> > [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> >
> > Architecture: OpenBSD.amd64
> > Machine     : amd64
> > >Description:
> >         Got a mail with "Return-Path: [hidden email]" and wanted to add it to my white list but smtpctl spf walk says "Bus error". Other domains like facebookmail.com works without problem. http://www.kitterman.com/spf/validate.html seems to think sendgrid.meetup.com has a valid record.
> >
> > >How-To-Repeat:
> >         echo sendgrid.meetup.com | smtpctl spf walk
> >
> > >Fix:
> >         Not known
>
> Try this,
>
> -Otto
>
> Index: spfwalk.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/smtpd/spfwalk.c,v
> retrieving revision 1.5
> diff -u -p -r1.5 spfwalk.c
> --- spfwalk.c 26 Jan 2018 08:00:54 -0000 1.5
> +++ spfwalk.c 6 Mar 2018 12:12:42 -0000
> @@ -140,6 +140,8 @@ dispatch_txt(struct dns_rr *rr)
>   char *end;
>   ssize_t n;
>  
> + if (rr->rr_type != T_TXT)
> + return;
>   n = parse_txt(rr->rr.other.rdata, rr->rr.other.rdlen, buf, sizeof(buf));
>   if (n == -1 || n == sizeof(buf))
>   return;
>

ok gilles@, the check can't hurt

I'm curious why we can even get rr_type != T_TXT when res_query_async()
is called with a type == T_TXT though, I'll look into this to ensure we
don't use a broken pattern in multiple places.

--
Gilles Chehade

https://www.poolp.org                                          @poolpOrg

Reply | Threaded
Open this post in threaded view
|

Re: Bus error in smtpctl spf walk

Otto Moerbeek
On Wed, Mar 07, 2018 at 08:30:25AM +0100, Gilles Chehade wrote:

> On Tue, Mar 06, 2018 at 01:13:11PM +0100, Otto Moerbeek wrote:
> > On Tue, Mar 06, 2018 at 10:46:23AM +0100, Jan Johansson wrote:
> >
> > > >Synopsis: Bus error in smtpctl spf walk (on certain domains)
> > > >Category: user
> > > >Environment:
> > > System      : OpenBSD 6.3
> > > Details     : OpenBSD 6.3-beta (GENERIC.MP) #26: Fri Mar  2 22:56:04 MST 2018
> > > [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP
> > >
> > > Architecture: OpenBSD.amd64
> > > Machine     : amd64
> > > >Description:
> > >         Got a mail with "Return-Path: [hidden email]" and wanted to add it to my white list but smtpctl spf walk says "Bus error". Other domains like facebookmail.com works without problem. http://www.kitterman.com/spf/validate.html seems to think sendgrid.meetup.com has a valid record.
> > >
> > > >How-To-Repeat:
> > >         echo sendgrid.meetup.com | smtpctl spf walk
> > >
> > > >Fix:
> > >         Not known
> >
> > Try this,
> >
> > -Otto
> >
> > Index: spfwalk.c
> > ===================================================================
> > RCS file: /cvs/src/usr.sbin/smtpd/spfwalk.c,v
> > retrieving revision 1.5
> > diff -u -p -r1.5 spfwalk.c
> > --- spfwalk.c 26 Jan 2018 08:00:54 -0000 1.5
> > +++ spfwalk.c 6 Mar 2018 12:12:42 -0000
> > @@ -140,6 +140,8 @@ dispatch_txt(struct dns_rr *rr)
> >   char *end;
> >   ssize_t n;
> >  
> > + if (rr->rr_type != T_TXT)
> > + return;
> >   n = parse_txt(rr->rr.other.rdata, rr->rr.other.rdlen, buf, sizeof(buf));
> >   if (n == -1 || n == sizeof(buf))
> >   return;
> >
>
> ok gilles@, the check can't hurt
>
> I'm curious why we can even get rr_type != T_TXT when res_query_async()
> is called with a type == T_TXT though, I'll look into this to ensure we
> don't use a broken pattern in multiple places.

It is because there's a cname record involved:

;; QUESTION SECTION:
;sendgrid.meetup.com.           IN      TXT

;; ANSWER SECTION:
sendgrid.meetup.com.    300     IN      CNAME   u3863915.wl166.sendgrid.net.
u3863915.wl166.sendgrid.net. 1800 IN    TXT     "v=spf1 include:sendgrid.net ~all"

        -Otto