Ignore:
Timestamp:
Apr 10, 2007, 5:27:38 AM (14 years ago)
Author:
Paul Smedley
Message:

Updated source to 3.0.25rc1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/samba/source/nsswitch/winbindd_cred_cache.c

    r22 r26  
    2828#define DBGC_CLASS DBGC_WINBIND
    2929
     30/* uncomment this to to fast debugging on the krb5 ticket renewal event */
     31#ifdef DEBUG_KRB5_TKT_RENEWAL
     32#undef DEBUG_KRB5_TKT_RENEWAL
     33#endif
     34
    3035#define MAX_CCACHES 100
    3136
    3237static struct WINBINDD_CCACHE_ENTRY *ccache_list;
     38
     39/* The Krb5 ticket refresh handler should be scheduled
     40   at one-half of the period from now till the tkt
     41   expiration */
     42#define KRB5_EVENT_REFRESH_TIME(x) ((x) - (((x) - time(NULL))/2))
    3343
    3444/****************************************************************
     
    116126                        entry->principal_name, entry->ccname));
    117127
    118                 new_start = entry->refresh_time;
     128#if defined(DEBUG_KRB5_TKT_RENEWAL)
     129                new_start = time(NULL) + 30;           
     130#else
     131                /* The tkt should be refreshed at one-half the period
     132                   from now to the expiration time */
     133                new_start = KRB5_EVENT_REFRESH_TIME(entry->refresh_time);
     134#endif
    119135
    120136                goto done;
     
    127143                                    entry->service,
    128144                                    &new_start);
     145#if defined(DEBUG_KRB5_TKT_RENEWAL)
     146        new_start = time(NULL) + 30;
     147#else
     148        new_start = KRB5_EVENT_REFRESH_TIME(new_start);
     149#endif
     150
    129151        gain_root_privilege();
    130152
     
    169191#ifdef HAVE_KRB5
    170192        int ret;
    171         time_t new_start;
    172193        struct timeval t;
    173194        struct WINBINDD_MEMORY_CREDS *cred_ptr = entry->cred_ptr;
     
    216237                        entry->principal_name, entry->ccname));
    217238
    218                 /* Renew at 1/2 the expiration time */
    219                 new_start = entry->refresh_time / 2;
    220 
    221239                goto got_ticket;
    222240        }
     
    234252  got_ticket:
    235253
    236 #if 0 /* TESTING */
     254#if defined(DEBUG_KRB5_TKT_RENEWAL)
    237255        t = timeval_set(time(NULL) + 30, 0);
    238256#else
    239         t = timeval_set(new_start, 0);
    240 #endif /* TESTING */
     257        t = timeval_set(KRB5_EVENT_REFRESH_TIME(entry->refresh_time), 0);
     258#endif
    241259
    242260        entry->event = event_add_timed(winbind_event_context(), entry,
     
    373391                        /* Renew at 1/2 the ticket expiration time */
    374392                        entry->event = event_add_timed(winbind_event_context(), entry,
    375                                                 timeval_set((ticket_end - 1)/2, 0),
     393#if defined(DEBUG_KRB5_TKT_RENEWAL)
     394                                                timeval_set(time(NULL)+30, 0),
     395#else
     396                                                timeval_set(KRB5_EVENT_REFRESH_TIME(ticket_end), 0),
     397#endif
    376398                                                "krb5_ticket_refresh_handler",
    377399                                                krb5_ticket_refresh_handler,
     
    494516                memcredp->len += strlen(pass)+1;
    495517        }
     518
    496519
    497520#if defined(LINUX)
Note: See TracChangeset for help on using the changeset viewer.