LookupAccountName / LsaLookupNames fails for cached domain credential when DC unavailable

254 Views Asked by At

I'm investigating a failure in my Windows 10 Credential Provider. It calls out to LookupAccountName in order to get the SID of the user that is attempting to log in. Its per-user configuration uses the account SID as the key.

The failure scenario is as follows:

  • There is a mixture of local and domain accounts on a domain joined computer.
  • The computer is in an offline or otherwise disconnected state and cannot contact the domain controller.
  • The domain user has logged in to this computer in the past and its credential is cached.
  • The call to LookupAccountName fails with ERROR_TRUSTED_RELATIONSHIP_FAILURE (0x6FD)

Here's where things are interesting:

I can log in with a local account and then "Run As" the domain user. Then subsequent calls to LookupAccountName (even when run in the context of the local user) succeeds in looking up the SID of the domain user. It will continue to work until the computer is rebooted.

I've tried calling LookupAccountName as well as LsaLookupNames2. Both exhibit the same behavior. (I assume LookupAccountName is built off of LsaLookupNames2).

It doesn't look like the NetUser* APIs will help me, as I believe they are intended for local accounts.

Is there a way to lookup the account SID for an offline domain credential? Without requiring them to log in first?

Why does using "Run As" cause these APIs to suddenly work?

0

There are 0 best solutions below