Unpack SO_PEERCRED structure depending on OS

OpenBSD uses a different structure to pass credentials, make
authentication socket credential detection more robust and OS dependent.