On Sun, Aug 25, 2019 at 07:01:01AM +0200, Martijn van Duren wrote: > Right now all we get is "Misbehaving filter", which doesn't tell the > developer a lot. > > Diff below does the following: > - Make the register_hooks actually fail on misbehaviour. > - Change some *ep = 0 to a more semantically correct ep[0] = '\0' > - Hoist some checks from lka_filter_process_response to processor_io > - Make lka_filter_process_response void (it fatals now) > - strtoull returns ULLONG_MAX on error, not ULONG_MAX > - change str{,n}casecmp to str{,n}cmp for consistency. > - change an fugly "nextline:" "goto nextline" loop to an actual while. > - restructure lka_filter_process_response to be shorter. > and most importantly > - Add a descriptive fatal() minefield. > > -12 LoC. > > Tested with filter-dnsbl with both a successful and rejected connection. > > OK?
just one remark. > Index: lka_filter.c > =================================================================== > RCS file: /cvs/src/usr.sbin/smtpd/lka_filter.c,v > retrieving revision 1.41 > diff -u -p -r1.41 lka_filter.c > --- lka_filter.c 18 Aug 2019 16:52:02 -0000 1.41 > +++ lka_filter.c 25 Aug 2019 04:47:47 -0000 > @@ -429,88 +429,68 @@ lka_filter_process_response(const char * > struct filter_session *fs; > > (void)strlcpy(buffer, line, sizeof buffer); > - if ((ep = strchr(buffer, '|')) == NULL) > - return 0; > - *ep = 0; > + ep = strchr(buffer, '|'); > + ep[0] = '\0'; is it possible to buffer to not have '|' ? if yes, you could deference NULL. -- Sebastien Marie