nwrap: rewrite linked-list datastructures to be properly separated.
authorMichael Adam <obnox@samba.org>
Wed, 11 Nov 2015 09:27:50 +0000 (10:27 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 11 Jan 2016 11:25:29 +0000 (12:25 +0100)
commit95025358d80c3c93476b934467d7ada7d6c060ed
tree7d38290c32908e8f76662fbaedd73b0d1e189d37
parent19d54157a479a0fa45720a1f2e64b26d9e1eb31d
nwrap: rewrite linked-list datastructures to be properly separated.

The data structures were wrong:

- The nwrap_entdata structures reflects one line of the hosts
  file, with ip, fqdn and aliases.
  But they also had a linked list structure.

- Now the hash table was used to point each
  ip address, fqdn and alias name occurring in the hosts
  file to the list of lines (entdata structs) that contain
  this name/address.

The problem was that these list heads were pointing to the same
entdata structures, while the list should actually be individual
for each entity (ip, fqdn, alias). This lead to wrong assiciations
of lines to IP addresse and also endless loops in the list, when
one line was put into one list twice starting from two different
points.

This patch fixes this by lifting the linked list structure to
a layer nwrap_entlist above nwrap_entdata. The entlist
entries just contain pointers to the entdata, and hence
each line can be referenced independetly by several lists.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
lib/nss_wrapper/nss_wrapper.c