krb5_cc_initialize
문서에 나와 있듯이 캐시를 지 웁니다. 기존 캐시에 액세스하려면 그렇게하지 마십시오.
에서 워드 프로세서 :
-------------------기존 자격 증명이 삭제되고 캐시의 주체 이름이 지정된 값으로 설정됩니다.
-H 옵션을 구현하는 kstart에 대한 코드를 살펴보십시오.
http://git.eyrie.org/?p=kerberos/kstart.git;a=blob;f=framework.c;h=66e851413a9b4d71fa4d61ded2f3c0d71cd03b0c;hb=HEAD
기본적으로 티켓에서 본인의 만료 시간을 확인해야합니다.
/* Obtain the ticket. */
memset(&increds, 0, sizeof(increds));
code = krb5_cc_resolve(ctx, config->cache, &ccache);
if (code != 0)
goto done;
increds.client = config->client;
else {
code = krb5_cc_get_principal(ctx, ccache, &increds.client);
if (code != 0)
goto done;
}
code = get_krbtgt_princ(ctx, increds.client, &increds.server);
if (code != 0)
goto done;
code = krb5_get_credentials(ctx, 0, ccache, &increds, &outcreds);
if (code != 0)
goto done;
increds_valid = true;
/* Check the expiration time and renewal limit. */
if (code == 0) {
now = time(NULL);
then = outcreds->times.endtime;
if (config->happy_ticket > 0)
offset = 60 * config->happy_ticket;
else
offset = 60 * config->keep_ticket + EXPIRE_FUDGE;
if (then < now + offset)
code = KRB5KRB_AP_ERR_TKT_EXPIRED;
출처
https://stackoverflow.com/questions/7415142