Re-enable checks for initgroups() and unsetenv()

7b7c13c4420da1231bb300215630b03588766b2c accidentally removed
configure-time checks for initgroups() and unsetenv() availability,
essentially generating dead code due to HAVE_* checks and introducing
issues with dropping permissions. This patch simply restores those
checks.