Kerberos.NET icon indicating copy to clipboard operation
Kerberos.NET copied to clipboard

Setting RenewTickets does not respect existing cache file settings

Open macsux opened this issue 2 years ago • 2 comments

Setting RenewTickets seems to "forget" cache configuration of the client and revert back to default cache location. Code used:

            var client = new KerberosClient(config, loggerFactory);
            client.CacheInMemory = false;
            client.Cache = new Krb5TicketCache(options.CacheFile);
            client.RenewTickets = true;

after the last line runs, the cache is no longer pointing to what is specified in options.CacheFile.

macsux avatar Nov 29 '21 22:11 macsux

That's certainly odd. The client.RenewTickets property just sets client.Cache.RenewTickets which is not used at all in Krb5TicketCache. I suspect that line is a red herring. I believe what's happening is KerberosClient.SetupCache() is being called when client.Cache is geted, which is querying the client-wide configuration for it's cache path.

https://github.com/dotnet/Kerberos.NET/blob/ddc0f270988b812dd6cd4dc71cfbbac5d938d21c/Kerberos.NET/Client/KerberosClient.cs#L686-L709

https://github.com/dotnet/Kerberos.NET/blob/ddc0f270988b812dd6cd4dc71cfbbac5d938d21c/Kerberos.NET/Client/KerberosClient.cs#L712-L726

SteveSyfuhs avatar Nov 29 '21 23:11 SteveSyfuhs

I recently did an overhaul of how the client instantiates the cache. Can you see if this repros for you anymore?

SteveSyfuhs avatar Feb 25 '22 18:02 SteveSyfuhs