Author: jra Date: 2006-12-08 18:40:13 +0000 (Fri, 08 Dec 2006) New Revision: 20087
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20087 Log: Ensure we clean up any random pending events we may have inherited from our parent in the winbindd forked child. Jeremy. Modified: branches/SAMBA_3_0/source/lib/events.c branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c branches/SAMBA_3_0_24/source/lib/events.c branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c Changeset: Modified: branches/SAMBA_3_0/source/lib/events.c =================================================================== --- branches/SAMBA_3_0/source/lib/events.c 2006-12-08 18:29:44 UTC (rev 20086) +++ branches/SAMBA_3_0/source/lib/events.c 2006-12-08 18:40:13 UTC (rev 20087) @@ -130,3 +130,18 @@ } return num_events; } + +/* Returns 1 if event was found and cancelled, 0 otherwise. */ + +int cancel_named_event(const char *event_name) +{ + struct timed_event *te; + + for (te = timed_events; te; te = te->next) { + if (strcmp(event_name, te->event_name) == 0) { + TALLOC_FREE(te); + return 1; + } + } + return 0; +} Modified: branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c =================================================================== --- branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-12-08 18:29:44 UTC (rev 20086) +++ branches/SAMBA_3_0/source/nsswitch/winbindd_dual.c 2006-12-08 18:40:13 UTC (rev 20087) @@ -845,16 +845,22 @@ child->domain->startup_time = time(NULL); } + /* Ensure we have no pending check_online events other + than one for this domain. */ + for (domain = domain_list(); domain; domain = domain->next) { if (domain != child->domain) { - /* Ensure we have no "check_online" events pending - that are not on this domain. */ if (domain->check_online_event) { TALLOC_FREE(domain->check_online_event); } } } + /* Ensure we're not handling an event inherited from + our parent. */ + + cancel_named_event("krb5_ticket_refresh_handler"); + while (1) { int ret; Modified: branches/SAMBA_3_0_24/source/lib/events.c =================================================================== --- branches/SAMBA_3_0_24/source/lib/events.c 2006-12-08 18:29:44 UTC (rev 20086) +++ branches/SAMBA_3_0_24/source/lib/events.c 2006-12-08 18:40:13 UTC (rev 20087) @@ -130,3 +130,18 @@ } return num_events; } + +/* Returns 1 if event was found and cancelled, 0 otherwise. */ + +int cancel_named_event(const char *event_name) +{ + struct timed_event *te; + + for (te = timed_events; te; te = te->next) { + if (strcmp(event_name, te->event_name) == 0) { + TALLOC_FREE(te); + return 1; + } + } + return 0; +} Modified: branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c =================================================================== --- branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c 2006-12-08 18:29:44 UTC (rev 20086) +++ branches/SAMBA_3_0_24/source/nsswitch/winbindd_dual.c 2006-12-08 18:40:13 UTC (rev 20087) @@ -845,16 +845,22 @@ child->domain->startup_time = time(NULL); } + /* Ensure we have no pending check_online events other + than one for this domain. */ + for (domain = domain_list(); domain; domain = domain->next) { if (domain != child->domain) { - /* Ensure we have no "check_online" events pending - that are not on this domain. */ if (domain->check_online_event) { TALLOC_FREE(domain->check_online_event); } } } + /* Ensure we're not handling an event inherited from + our parent. */ + + cancel_named_event("krb5_ticket_refresh_handler"); + while (1) { int ret;