On Fri, Apr 08, 2016 at 03:44:16PM +0200, Joerg Jung wrote:
> > On 07 Apr 2016, at 23:24, Michiel van Es <m...@pragmasec.nl> wrote:
> >> On 07 Apr 2016, at 21:28, Joerg Jung <m...@umaxx.net> wrote:
> >> On Thu, Apr 07, 2016 at 04:41:57PM +0200, Michiel van Es wrote:
> >>>> On 07 Apr 2016, at 16:37, Michiel van Es <m...@pragmasec.nl> wrote:
> >>>>> On 07 Apr 2016, at 16:05, Joerg Jung <m...@umaxx.net> wrote:
> >>>>>> On 07 Apr 2016, at 14:47, Michiel van Es <m...@pragmasec.nl> wrote:
> >>>>>>> On 07 Apr 2016, at 14:40, Joerg Jung <m...@umaxx.net> wrote:
> >>>>>>>
> >>>>> Wow… what a mess, I think this is what is happening:
> >>>>>
> >>>>> - EAI_NODATA is usually -5 aka "No address associated with hostname".
> >>>>>
> >>>>> - Ubuntu eglibc seems to guard EAI_NODATA behind a #ifdef _GNU_SOURCE 
> >>>>> in netdb.h,
> >>>>> so you may do not have it defined at all.
> >>>>> (- Nevertheless the error string is given with gai_strerror() anyway, 
> >>>>> no matter that EAI_NODATA is not there.)
> >>>>>
> >>>>> - in case EAI_NODATA is not defined opensmtpd-extras defines EAI_NODATA 
> >>>>> == EAI_NONAME == -2 in configure.ac
> >>>>> -> I think this is wrong and should be done as last resort. The better 
> >>>>> solution should be to define _GNU_SOURCE to
> >>>>> receive EAI_NODATA from standard netdb.h. Can you try the following 
> >>>>> please:

[...]

> >> Ok, I was wrong here. _GNU_SOURCE is already defined via
> >> openbsd-compat/includes.h

[...]

> >> I fail to understand, where the EAI_NODATA=-2 comes from.  With
> >> GNU_SOURCE defined as mentioned above it should come from netdb.h header
> >> with -5 instead of -2.
> >>
> >> Can you try to remove/comment the whole #ifndef EAI_NODATA in
> >> openbsd-compat/defines.h line 205-213?
> >
> > done, rebuilding with ./bootstrap; etc.
> >
> > but got the same error:
> >
> > debug: smtp: new client on listener: 0x1bc3110
> > smtp-in: New session e7ba7643bb567563 from host pro-mail-smtp-001.bol.com 
> > [185.14.168.222]
> > filter: post-event event=EVENT_CONNECT filter=dnsbl
> > filter: new query QUERY_CONNECT
> > filter: filter_drain_query e7ba7644f7858c96[QUERY_CONNECT8.21.114.197 <-> 
> > 185.14.168.222(pro-mail-smtp-001.bol.com),filter_session@0x1bb2010[datalen=0,eom=(nil),ofile=(nil)]]
> > filter: running filter filter:dnsbl[hooks=0xffffffff,flags=0x0000] for 
> > query e7ba7644f7858c96[QUERY_CONNECT8.21.114.197 <-> 
> > 185.14.168.222(pro-mail-smtp-001.bol.com),filter_session@0x1bb2010[datalen=0,eom=(nil),ofile=(nil)]]
> > filter: waiting for running query 
> > e7ba7644f7858c96[QUERY_CONNECT8.21.114.197 <-> 
> > 185.14.168.222(pro-mail-smtp-001.bol.com),filter_session@0x1bb2010[datalen=0,eom=(nil),ofile=(nil)]]
> > dnsbl[8693]: debug: on_connect: checking 222.168.14.185.psbl.surriel.com.
> > dnsbl[8693]: warn: DEBUG: ar_gai_errno=-5, EAI_NODATA=-2, EAI_NONAME=-2, 
> > gai_strerror=‘No address associated with hostname’
> 
> For now I’m out of ideas how to solve the EAI_NODATA -5 vs -2 problem and 
> where it exactly comes from.
> I need to install Ubuntu myself to figure out. Maybe I find some time on 
> Weekend to do so.

The diff below should fix this for Debian, Ubuntu, and probably others.
The problem was the following: _GNU_SOURCE is defined in includes.h (see
above, EAI_NODATA is guarded by _GNU_SOURCE), but was just not used in
filter-dnsbl.  The diff below adds the missing include and also removes
the ancient ifndef from defines.h as it should not be required anymore
(since more than 16 years).  Better bail out with an error if undeclared
instead of re-defining things.

> You opened a bug report already anyways, I will try to resolve this with a 
> good solution.

Michiel, can you please test if the diff below works in your Ubuntu
setup and let us know? If yes, I'll commit and we can close issue #672.

@Martin: can you please test on Debian? 

Thanks,
Regards,
Joerg



diff --git a/extras/wip/filters/filter-dnsbl/filter_dnsbl.c 
b/extras/wip/filters/filter-dnsbl/filter_dnsbl.c
index b7a6d4e..d81683a 100644
--- a/extras/wip/filters/filter-dnsbl/filter_dnsbl.c
+++ b/extras/wip/filters/filter-dnsbl/filter_dnsbl.c
@@ -15,6 +15,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#include "includes.h"
+
 #include <sys/types.h>
 #include <sys/socket.h>
 
diff --git a/openbsd-compat/defines.h b/openbsd-compat/defines.h
index 93bffd0..f480f2a 100644
--- a/openbsd-compat/defines.h
+++ b/openbsd-compat/defines.h
@@ -202,14 +202,4 @@ typedef uint16_t   in_port_t;
 # endif
 #endif
 
-/* chl parts */
-#ifndef EAI_NODATA
-# ifdef EAI_NONAME
-#  define EAI_NODATA EAI_NONAME
-# else
-#  error "Neither EAI_NODATA and EAI_NONAME are defined! :("
-# endif
-#endif
-/* end of chl */
-
 #endif /* _DEFINES_H */

--
You received this mail because you are subscribed to misc@opensmtpd.org
To unsubscribe, send a mail to: misc+unsubscr...@opensmtpd.org

Reply via email to