Up ../

Libbind.so for Irix 6.5.x

Irix normally uses the nsd daemon in front of the various name services. eg
gethostbyname() --> libc.so --> nsd --> dns, nis, ldap etc

Unfortunately nsd hadn't had a good security record. So turning off nsd and building the resolver library (libbind) from ISC Bind-9.4-ESV and linking against that seemed a better option. The downside is that all the irix supplied network programs are then unable to resolve names - they do seem to fall back to /etc/hosts.

A solution is to build a shared library from libbind.a and place it in /lib32 - you may need to build the archive and shared library for each ABI supported on your platform (N32, O32, N64.)

The runtime linker rld will search for symbols in shared libraries specified by the _RLDN32_LIST environment variable. eg

	_RLDN32_LIST=libbind.so:DEFAULT

and likewise for each supported ABI eg

	_RLDN64_LIST=libbind.so:DEFAULT

The resolver library isn't built by default but the code is found under

	bind-9.4-ESV-R1/lib/bind

For the archive library as long as the netdb.h used when building the library is consistent with the netdb.h used when compiling the application all is well. But for the shared library the netdb.h under

	bind-9.4-ESV-R1/lib/bind/include 

must be consistent with the system /usr/include/netdb.h The changes that I could identify

Define
	AI_NUMERICSERV                  0x8
Redefine
	AI_MASK            from 0x7  to 0xf
	AI_V4MAPPED        from 0x8  to 0x800
	AI_ALL	           from 0x10 to 0x100
	AI_ADDRCONFIG      from 0x20 to 0x400

For some reason the hints->ai_flags field always contains AI_ADDRCONFIG which isn't covered by AI_MASK and this causes getaddrinfo() to fail. ie

line 360  bind-9.4-ESV-R1/lib/bind/irs/getaddrinfo.c 

	if (hints->ai_flags & ~AI_MASK)
		SETERROR(EAI_BADFLAGS);

changing this to

	if (hints->ai_flags & ~(AI_MASK|AI_ADDRCONFIG))
		SETERROR(EAI_BADFLAGS);

fixes this but not sure of further ramifications.

Typing make, or better gmake in

	bind-9.4-ESV-R1/lib/bind

will build the archive library. The shared library is constructed from the archive library

 
ld -shared -all -no_unresolved libbind.a -soname libbind.so -o libbind.so -none -lc

You may also want to fiddle with so_locations to optimise the mapping of the shared library.

cp /usr/lib32/so_locations /usr/lib32/so_locations.BCK
ld -shared -update_registry /usr/lib32/so_locations \
	-all -no_unresolved libbind.a -soname libbind.so -o libbind.so -none -lc

Copy libbind.so into /lib32 and test.

	cp libbind.so /lib32
	env RLDN32_LIST=libbind.so:DEFAULT /usr/etc/ping some-fqdn.notin.hosts

LICENSE
Creative Commons CC0 http://creativecommons.org/publicdomain/zero/1.0/legalcode

AUTHOR
James Sainsbury