Henrik K wrote:

> On Thu, Jul 02, 2009 at 09:10:54AM +0200, Per Jessen wrote:
>> 
>> Here it is in a nutshell:
>> 
>> 1) a tiny perl test-script using gethostbyname() will look at
>> /etc/hosts and try to resolve the name from there. Works fine and
>> just as expected.
>> 
>> 2) a call to gethostbyname() from within an SA plugin does NOT look
>> at /etc/hosts.
> 
> Please share your code so we can verify and test it. There is nothing
> in SA code that would redefine gethostbyname.

No that's not what I meant - I meant that something changes the
_behaviour_ of gethostbyname() such that it ignores /etc/hosts.  This
could be the resolver config for instance. 

To verify it:

Add "1.2.3.4  www.doesnt.matter" to your /etc/hosts file.

Run this script:

http://jessen.ch/files/test_gethostbyname.pl 

"./test_gethostbyname www.doesnt.matter"

This will say "1.2.3.4" as expected. 

Now for calling gethostbyname() from within SA - I could share the
plugin code, but it won't work without a few other things, so if you
can think of another/easier way of calling gethostbyname() from within
SA, then you'll see that "www.doesnt.matter" does not resolve.


/Per Jessen, Zürich

Reply via email to