Protocols.LDAP: Attempt to pin connections to the same server.

When using replication and DNS-round-robin for LDAP, it is common that
the servers in the rotation aren't 100% identical, so attempt to have
successive connections go to the same LDAP server if possible, otherwise
higher level protocols (eg incremental updates) may be broken.

Fixes [bug 7406].

Also improves support for IPv6.
Precompiler: Fix support for recent Pike 7.8.

Pike 7.8.594 and later have TYPEOF() et al, but not set_program_id_to_id().