mirror of
https://github.com/samba-team/samba.git
synced 2025-02-04 17:47:26 +03:00
s3-winbind: Make KRB5_EVENT_REFRESH_TIME a function
This commit is contained in:
parent
eb3ee7801f
commit
acf54c37a8
@ -47,7 +47,12 @@ static void add_krb5_ticket_gain_handler_event(struct WINBINDD_CCACHE_ENTRY *,
|
|||||||
/* The Krb5 ticket refresh handler should be scheduled
|
/* The Krb5 ticket refresh handler should be scheduled
|
||||||
at one-half of the period from now till the tkt
|
at one-half of the period from now till the tkt
|
||||||
expiration */
|
expiration */
|
||||||
#define KRB5_EVENT_REFRESH_TIME(x) ((x) - (((x) - time(NULL))/2))
|
|
||||||
|
static time_t krb5_event_refresh_time(time_t end_time)
|
||||||
|
{
|
||||||
|
time_t rest = end_time - time(NULL);
|
||||||
|
return end_time - rest/2;
|
||||||
|
}
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
Find an entry by name.
|
Find an entry by name.
|
||||||
@ -183,7 +188,7 @@ rekinit:
|
|||||||
/* The tkt should be refreshed at one-half the period
|
/* The tkt should be refreshed at one-half the period
|
||||||
from now to the expiration time */
|
from now to the expiration time */
|
||||||
expire_time = entry->refresh_time;
|
expire_time = entry->refresh_time;
|
||||||
new_start = KRB5_EVENT_REFRESH_TIME(entry->refresh_time);
|
new_start = krb5_event_refresh_time(entry->refresh_time);
|
||||||
#endif
|
#endif
|
||||||
goto done;
|
goto done;
|
||||||
} else {
|
} else {
|
||||||
@ -207,7 +212,7 @@ rekinit:
|
|||||||
new_start = time(NULL) + 30;
|
new_start = time(NULL) + 30;
|
||||||
#else
|
#else
|
||||||
expire_time = new_start;
|
expire_time = new_start;
|
||||||
new_start = KRB5_EVENT_REFRESH_TIME(new_start);
|
new_start = krb5_event_refresh_time(new_start);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gain_root_privilege();
|
gain_root_privilege();
|
||||||
@ -373,7 +378,7 @@ static void krb5_ticket_gain_handler(struct event_context *event_ctx,
|
|||||||
#if defined(DEBUG_KRB5_TKT_RENEWAL)
|
#if defined(DEBUG_KRB5_TKT_RENEWAL)
|
||||||
t = timeval_set(time(NULL) + 30, 0);
|
t = timeval_set(time(NULL) + 30, 0);
|
||||||
#else
|
#else
|
||||||
t = timeval_set(KRB5_EVENT_REFRESH_TIME(entry->refresh_time), 0);
|
t = timeval_set(krb5_event_refresh_time(entry->refresh_time), 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (entry->refresh_time == 0) {
|
if (entry->refresh_time == 0) {
|
||||||
@ -558,7 +563,8 @@ NTSTATUS add_ccache_to_list(const char *princ_name,
|
|||||||
#if defined(DEBUG_KRB5_TKT_RENEWAL)
|
#if defined(DEBUG_KRB5_TKT_RENEWAL)
|
||||||
t = timeval_set(time(NULL)+30, 0);
|
t = timeval_set(time(NULL)+30, 0);
|
||||||
#else
|
#else
|
||||||
t = timeval_set(KRB5_EVENT_REFRESH_TIME(ticket_end), 0);
|
t = timeval_set(krb5_event_refresh_time(ticket_end),
|
||||||
|
0);
|
||||||
#endif
|
#endif
|
||||||
if (!entry->refresh_time) {
|
if (!entry->refresh_time) {
|
||||||
entry->refresh_time = t.tv_sec;
|
entry->refresh_time = t.tv_sec;
|
||||||
@ -642,7 +648,7 @@ NTSTATUS add_ccache_to_list(const char *princ_name,
|
|||||||
#if defined(DEBUG_KRB5_TKT_RENEWAL)
|
#if defined(DEBUG_KRB5_TKT_RENEWAL)
|
||||||
t = timeval_set(time(NULL)+30, 0);
|
t = timeval_set(time(NULL)+30, 0);
|
||||||
#else
|
#else
|
||||||
t = timeval_set(KRB5_EVENT_REFRESH_TIME(ticket_end), 0);
|
t = timeval_set(krb5_event_refresh_time(ticket_end), 0);
|
||||||
#endif
|
#endif
|
||||||
if (entry->refresh_time == 0) {
|
if (entry->refresh_time == 0) {
|
||||||
entry->refresh_time = t.tv_sec;
|
entry->refresh_time = t.tv_sec;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user