Joint Scientific IT and Technical Services

Personal Homepage

libnss-ldap with hosts support from LDAP (Cernko, Patrick; Raufer, Dirk)

Current versions of libnss-ldap for linux have problems when it comes to providing the hosts name service resource: As the code internally has to use gethostby* calls too, it creates an infinite loop trying to look up the name/IP address of the configured LDAP server(s).

The patch provided here avoids this infinite loop by using a small trick: before any gethostby* calls, it sets a special environment variable. If the code encounters a host lookup request with this environment variable set, it responds with NSS_UNAVAIL. As a result, the resolver will forward the lookup request to the next configured modules (mostly dns).

libnss-ldap_hostsByLDAP.diff