I'm trying to purge a specific ticket from the cache,using LsaCallAuthenticationPackage. I always get ERROR_INVALID_PARAMETER 87 in the package status. What could be the reason? Here is my code (All other steps succeeded):
KERB_QUERY_TKT_CACHE_REQUEST tktCacheRequest = {
KerbQueryTicketCacheMessage};
void* pRep;
开发者_运维知识库 DWORD cbRep;
NTSTATUS pkgStatus;
NTSTATUS s = LsaCallAuthenticationPackage(
* hLsa, * nAuthPackage,
&tktCacheRequest, sizeof tktCacheRequest,
&pRep, &cbRep, &pkgStatus);
pTktCacheResponse = (KERB_QUERY_TKT_CACHE_RESPONSE)pRep;
for (ULONG i = 0; i < pTktCacheResponse->CountOfTickets; ++i) { KERB_TICKET_CACHE_INFO& ti = pTktCacheResponse->Tickets[i]; if (/Some condition/) { KERB_PURGE_TKT_CACHE_REQUEST req; req.MessageType = KerbPurgeTicketCacheMessage; req.ServerName = ti.ServerName; req.RealmName = ti.ServerName; req.LogonId.HighPart = req.LogonId.LowPart = 0; NTSTATUS pkgStatus = 0;
PVOID pReturnBuffer = NULL;
ULONG nReturnedBufferLen = 0;
NTSTATUS s = LsaCallAuthenticationPackage(
hLsa, nAuthPackage,
&req, sizeof (req) *2,
0, 0, &pkgStatus);
ULONG winErr = LsaNtStatusToWinError(pkgStatus);
}
}
Thanks!!
I kust use the memory allocation model as in the original Microsoft's klist (found in Microsoft Windows Platform SDK's samples), and got it works.
Thanks.
精彩评论