Lorikeet heimdal for upstream

This pull request is most of the patches still pending in Samba's lorikeet-heimdal repo.  

The purpose of this pull request is to try and reduce the divergence between lorikeet-heimdal and heimdal