Hi, 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!!