views:

422

answers:

3

Hi, Does anyone know how to clear out the Kerberos ticket cache on the local computer - using managed \ unmanaegd code?

Thanks in advance!

A: 

The simple, stupid way:

system("kdestroy");

Or if you want to be more legit, just check out the source of a kdestroy implementation. krb5_cc_destroy() seems to be the relevant function call.

John Zwinck
Thanks a lot!!!
rursw1
+1  A: 

I believe you need to do a call to LsaCallAuthenticationPackage using KERB_PURGE_TKT_CACHE_REQUEST after using either LsaConnectUntrusted or LsaRegisterLogonProcess. Sorry no specifics, but I don't have my code for this around...

Christopher_G_Lewis
Thanks a lot!!!
rursw1
Hi,It works excellent.In addition, is there a managed way to do that?
rursw1
Wrapping in pInvokes for managed code. See if these are at pInvoke.Net, if not, that site has got tons of information.
Christopher_G_Lewis
Yes, PInvoke works, but I wonder if there is a built in classes in the dot net framework to do that.
rursw1
@Christopher_G_Lewis Hi, This is an invite for the NerdDinner at Chicago. More details at http://nrddnr.com/2850. Please RSVP by 5 PM,Aug 29,2010. It would be great if you confirm or deny. Thanks!
Shankar Ramachandran
@rursw1 Please excuse the previous unrelated comment. This is the only way to contact users in SO :). I will remove it as I get Christopher_G_Lewis' response or by Aug 29.Please ping me if you want comment removed earlier than Aug 29.Thanks!
Shankar Ramachandran
+1  A: 

The most simple way is to take the source code of Microsoft's KList (Included in the platform SDK\ Samples), and to do like them...

rursw1