On 16-09-26 21:42:09, Peter Hessler wrote:
> On 2016 Sep 26 (Mon) at 14:31:04 -0500 (-0500), Edgar Pettijohn wrote:
> :On 16-09-26 09:26:04, Gilles Chehade wrote:
> :> On Sun, Sep 25, 2016 at 11:20:39AM -0500, Edgar Pettijohn wrote:
> :> > In my testing it did not, but I could be wrong.
> :> >
> :> > On 16-09-25 17:56:42, Eric Faurot wrote:
> :> > > On Sat, Sep 24, 2016 at 08:42:25PM -0500, Edgar Pettijohn wrote:
> :> > > > Enforce stricter rfc helo compliance.
> :> > > > --
> :> > > > Edgar Pettijohn
> :> > >
> :> > > I am pretty sure res_hnok already does that check.
> :> > >
> :> > > Eric.
> :> > >
> :>
> :> turns out res_hnok() doesn't, but should this be fixed in it or in smtpd ?
> :
> :The following catches:
> :.my.domain
> :my..domain
>
> these are invalid domains
>
> :my.domain.
>
> this is not!
Looks like that may break stuff. This may be better and allows for a trailing
'.'.
Index: res_comp.c
===================================================================
RCS file: /cvs/src/lib/libc/net/res_comp.c,v
retrieving revision 1.20
diff -u -p -u -r1.20 res_comp.c
--- res_comp.c 1 May 2016 15:17:29 -0000 1.20
+++ res_comp.c 26 Sep 2016 21:47:24 -0000
@@ -347,21 +347,16 @@ dn_find(u_char *exp_dn, u_char *msg, u_c
int
__res_hnok(const char *dn)
{
- int pch = PERIOD, ch = *dn++;
+ int pch = PERIOD, ch = *dn;
+
+ if (ch == '.')
+ return (0);
while (ch != '\0') {
int nch = *dn++;
if (periodchar(ch)) {
- ;
- } else if (periodchar(pch)) {
- if (!borderchar(ch))
- return (0);
- } else if (periodchar(nch) || nch == '\0') {
- if (!borderchar(ch))
- return (0);
- } else {
- if (!middlechar(ch))
+ if (!borderchar(pch) || !borderchar(nch) && nch != '\0')
return (0);
}
pch = ch, ch = nch;
>
>
> :
> :I haven't tested to see if it breaks anything else though.
> :>
> :>
> :> > > > Index: util.c
> :> > > > ===================================================================
> :> > > > RCS file: /cvs/src/usr.sbin/smtpd/util.c,v
> :> > > > retrieving revision 1.128
> :> > > > diff -u -p -u -r1.128 util.c
> :> > > > --- util.c 31 Aug 2016 10:18:08 -0000 1.128
> :> > > > +++ util.c 25 Sep 2016 01:41:34 -0000
> :> > > > @@ -495,6 +495,9 @@ valid_domainpart(const char *s)
> :> > > > struct in6_addr ina6;
> :> > > > char *c, domain[SMTPD_MAXDOMAINPARTSIZE];
> :> > > > const char *p;
> :> > > > + size_t len;
> :> > > > +
> :> > > > + len = strlen(s);
> :> > > >
> :> > > > if (*s == '[') {
> :> > > > if (strncasecmp("[IPv6:", s, 6) == 0)
> :> > > > @@ -519,8 +522,9 @@ valid_domainpart(const char *s)
> :> > > > return 0;
> :> > > > }
> :> > > >
> :> > > > - if (*s == '\0')
> :> > > > + if (*s == '\0' || s[0] == '.' || s[len - 1] == '.') {
> :> > > > return 0;
> :> > > > + }
> :> > > >
> :> > > > return res_hnok(s);
> :> > > > }
> :> > >
> :> > >
> :> > > --
> :> > > You received this mail because you are subscribed to [email protected]
> :> > > To unsubscribe, send a mail to: [email protected]
> :> >
> :> > --
> :> > Edgar Pettijohn
> :> >
> :> > --
> :> > You received this mail because you are subscribed to [email protected]
> :> > To unsubscribe, send a mail to: [email protected]
> :> >
> :>
> :> --
> :> Gilles Chehade
> :>
> :> https://www.poolp.org @poolpOrg
> :>
> :> --
> :> You received this mail because you are subscribed to [email protected]
> :> To unsubscribe, send a mail to: [email protected]
> :
> :--
> :Edgar Pettijohn
>
> :Index: res_comp.c
> :===================================================================
> :RCS file: /cvs/src/lib/libc/net/res_comp.c,v
> :retrieving revision 1.20
> :diff -u -p -u -r1.20 res_comp.c
> :--- res_comp.c 1 May 2016 15:17:29 -0000 1.20
> :+++ res_comp.c 26 Sep 2016 18:51:59 -0000
> :@@ -347,21 +347,16 @@ dn_find(u_char *exp_dn, u_char *msg, u_c
> : int
> : __res_hnok(const char *dn)
> : {
> :- int pch = PERIOD, ch = *dn++;
> :+ int pch = PERIOD, ch = *dn;
> :+
> :+ if (ch == '.')
> :+ return (0);
> :
> : while (ch != '\0') {
> : int nch = *dn++;
> :
> : if (periodchar(ch)) {
> :- ;
> :- } else if (periodchar(pch)) {
> :- if (!borderchar(ch))
> :- return (0);
> :- } else if (periodchar(nch) || nch == '\0') {
> :- if (!borderchar(ch))
> :- return (0);
> :- } else {
> :- if (!middlechar(ch))
> :+ if (!borderchar(pch) || !borderchar(nch))
> : return (0);
> : }
> : pch = ch, ch = nch;
>
>
> --
> What did Mickey Mouse get for Christmas?
> A Dan Quayle watch.
--
Edgar Pettijohn