Avoid infinite loop in nss_dns getnetbyname [BZ #17630]

(cherry picked from commit 11e3417af6e354f1942c68a271ae51e892b2814d)
(cherry picked from commit e54db0ea6a49affac43fa305fd134f3020c41382)

Conflicts:
	NEWS