Question about purge a particular ticket from the cache

Chuang Liu liu_nsk at yahoo.com.cn
Thu Jun 14 21:40:51 EDT 2007


I tried to purge a particular ticket from the cache
using "KERB_PURGE_TKT_CACHE_REQUEST", and got a " The
parameter is incorrect" error. Could anybody help me
please?

I first tried to get all existing tickets. 

  KERB_QUERY_TKT_CACHE_REQUEST req = {
    KerbQueryTicketCacheMessage
  };

  // send the request to Kerb and get a response
  void* pRep;
  DWORD cbRep;
  NTSTATUS pkgStatus;
  NTSTATUS s = LsaCallAuthenticationPackage(
                m_hLSA, m_nKerbIndex,
                &req, sizeof req,
                &pRep, &cbRep, &pkgStatus);
  if (s) {
    OutputInfo(L"LsaCallAuthenticationPackage", s);
    return;
  }
  if (pkgStatus) {
    OutputInfo(L"KerbQueryTicketCacheMessage",
               pkgStatus);
    return;
  }

   // we now have a collection of information about
   // all tickets in the current logon session
   m_pTktCache = (KERB_QUERY_TKT_CACHE_RESPONSE*)pRep;

then I checked each ticket, if it follows a particular
patter, I will purge it. 

   for (DWORD i = 0; i < m_pTktCache->CountOfTickets;
++i) {

      KERB_TICKET_CACHE_INFO& ti =
m_pTktCache->Tickets[i];

     if(/* some pattern*/) {
       KERB_PURGE_TKT_CACHE_REQUEST req;
       req.MessageType = KerbPurgeTicketCacheMessage;
       req.ServerName = ti.ServerName;
       req.RealmName = ti.RealmName; 

       NTSTATUS pkgStatus;
       NTSTATUS s = LsaCallAuthenticationPackage(
                    m_hLSA, m_nKerbIndex,
                    &req, sizeof req,
                    0, 0, &pkgStatus);
      
       if (pkgStatus) {
           OutputInfo(L"KerbPurgeTicketCache",
pkgStatus);
          return;
      }
     
  }


The purge of the particular key failed with error
message "The parameter is incorrect". Did I miss
anything in the code? Thanks. 

Chuang


       
____________________________________________________________________________________
Boardwalk for $500? In 2007? Ha! Play Monopoly Here and Now (it's updated for today's economy) at Yahoo! Games.
http://get.games.yahoo.com/proddesc?gamekey=monopolyherenow  



More information about the Kerberos mailing list