The cwrap project released a new preloadable wrapper which can be used for
nameserver redirection or DNS response faking. The tool is named
resolv_wrapper and can be used in testing environment to route DNS queries
to a real nameserver separate from resolv.conf or fake one with simple config
file. The tool is supported on several platforms, including Linux, Solaris and
If you want to write a unit test, which requires to acquire a Kerberos ticket
using kinit before, you would need to be able to locate the Kerberos KDC
looking up a SRV records in the nameserver. resolv_wrapper could be used make
sure the kinit is working correctly by talking to your nameserver or by faking
the DNS response. It wraps the functions provided by libresolv.so like
res_query() and res_search().
You can download resolv_wrapper here.