merge of the netsamlogon caching code from APPLIANCE_HEAD