Does anyone know how to clear the Kerberos cache cache on the local computer - using managed \ unmanaegd code?
Thanks in advance!
It seems to me that you need to call LsaCallAuthenticationPackage with KERB_PURGE_TKT_CACHE_REQUEST after using LsaConnectUntrusted or LsaRegisterLogonProcess . Sorry, no specifics, but I don't have my code for this around ...
The easiest way is to take the Microsoft KList source code (included in the SDK \ Samples platform) and do the same ...
There is an example of “managed C #” for cleaning kerberos tickets using pInvoke at https://github.com/ErtiEelmaa/StackOverflow/blob/master/GroupPolicyUtilities.cs
Copy / paste is too long here. It took some time since the structures in pInvoke were invalid (for example, someone, although C ++ LONG is equal to C # LONG and yada-yada), however I tested this and it worked for me.
In addition, I noticed that there are several errors in PurgeTicket on the Windows 2003 klist.c server:
Simple, stupid way:
system("kdestroy");
Or, if you want to be more legit, just check the source of the kdestroy implementation. krb5_cc_destroy() seems to be the corresponding function call.
kdestroy
krb5_cc_destroy()