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 ?
Apologize in advance if this message is duplicated. Trying different configs and the first try didn't go through. The following res_comp.c patch may be better. It is simpler and catches the following: .my.domain my..domain my.domain. I haven't tested to see if it messes up 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 misc@opensmtpd.org > > > To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org > > > > -- > > Edgar Pettijohn > > > > -- > > You received this mail because you are subscribed to misc@opensmtpd.org > > To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org > > > > -- > Gilles Chehade > > https://www.poolp.org @poolpOrg > > -- > You received this mail because you are subscribed to misc@opensmtpd.org > To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org -- 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;