<root>
	<title>
		fakegethostbyname library
	</title>
 
	<paragraph title="What is fakegethostbyname?">
		It's mainly a quick hack, a library that overrides gethostbyname.
		Once I had an account on a openbsd box where I wanted to run a closed source 
		network application that usually connects to an hardcoded hostname. Since I 
		wanted to make it change behaviour, I was trying to get it resolve another ip
		for the hardcoded hostname, but I didn't had root access to the box, neither I
		wanted to just quickhack the binary, so I coded a little wrapper for the
		gethostbyname(3) function to make it resolve some hosts as I wanted, else just
		act as system gethostbyname.
		This silly trick uses the LD_PRELOAD loader variable, that forces the load of a library when linking.
		An example of how fakegethostbyname library works:
	</paragraph>

	<pre>$ ./resolve www.lupo.rm.it www.uniroma2.it www.google.com
www.lupo.rm.it resolved to 217.220.29.169
www.uniroma2.it resolved to 160.80.2.16
www.google.com resolved to 216.239.59.99
$ LD_PRELOAD=./fakegethostbyname.so \
HOSTS_OVERRIDE=www.uniroma2.it=1.2.3.4,www.google.com=5.6.7.8 \
./resolve www.lupo.rm.it www.uniroma2.it www.google.com
www.lupo.rm.it resolved to 217.220.29.169
www.uniroma2.it resolved to 1.2.3.4
www.google.com resolved to 5.6.7.8</pre>

	Tested on:
	<list>
		<item>Linux 2.4</item>
		<item>FreeBSD 5-CURRENT</item>
	</list>

	Releases:
	<list>
		<item>Tue Nov 11 22:10:34 CET 2003, first release</item>
	</list>

	Files
	<list>
		<item><link url="fakegethostbyname-1.0.tar.bz2">fakegethostbyname-1.0.tar.bz2</link> (source)</item>
	</list>
</root>

