我编写了一些 C 代码来连接到 Kerberized LDAP 服务器。这一切都工作正常,但目前,它每次连接时都会生成一个新的 TGT,而不是使用默认凭据缓存中的 TGT(假设它已经存在)。
我已经研究过使用 krb5_cc_resolve 和 krb5_initialize 之类的方法来获取对缓存的引用,但这似乎会破坏缓存(如果它已经存在)及其持有的任何票证。
基本上,我想知道的是:是否有任何方法可以检查现有 TGT 的默认凭据缓存而不破坏它?
I have written some C code to connect to a Kerberized LDAP server. This all works fine, but at present, it currently generates a new TGT every time it connects, rather than using the one (assuming it already exists) in the default credentials cache.
I have looked into using the likes of krb5_cc_resolve and krb5_initialize to get a reference to the cache, but this seems to destroy the cache if it already exists, along with any tickets it holds.
Basically, what I want to know is: is there any way of checking the default credentials cache for existing TGTs without destroying it?
发布评论
评论(2)
krb5_cc_initialize
清除缓存,如文档所述。如果您想访问现有缓存,请不要这样做文档:
krb5_cc_initialize
clears the cache, as the documentation says. Just don't do that if you want to access an existing cacheFrom the docs:
查看 kstart 的代码,其中实现了 -H 选项。
http://git.eyrie.org/?p=kerberos/kstart.git;a=blob;f=framework.c;h=66e851413a9b4d71fa4d61ded2f3c0d71cd03b0c;hb=HEAD
基本上,你需要检查票据中主体的过期时间。
Look in the code for kstart where it implements the -H option.
http://git.eyrie.org/?p=kerberos/kstart.git;a=blob;f=framework.c;h=66e851413a9b4d71fa4d61ded2f3c0d71cd03b0c;hb=HEAD
Basically, you need to check the expire time for the principal in the ticket.