s3:winbindd: cancel all ccache entry events and not just one
authorStefan Metzmacher <metze@samba.org>
Tue, 30 Dec 2008 08:17:20 +0000 (09:17 +0100)
committerStefan Metzmacher <metze@samba.org>
Mon, 5 Jan 2009 14:07:33 +0000 (15:07 +0100)
cancel_named_event() is stupid by design and also only cancels
one single event.

metze

source3/winbindd/winbindd_cred_cache.c
source3/winbindd/winbindd_dual.c
source3/winbindd/winbindd_proto.h

index e9e9e4dd12630474d56ce886fa7159d92109e8d1..fcb3d033a66b7dc1ab2206662d699ee79e5eed3a 100644 (file)
@@ -75,6 +75,20 @@ static int ccache_entry_count(void)
        return i;
 }
 
+void ccache_remove_all_after_fork(void)
+{
+       struct WINBINDD_CCACHE_ENTRY *cur, *next;
+
+       for (cur = ccache_list; cur; cur = next) {
+               next = cur->next;
+               DLIST_REMOVE(ccache_list, cur);
+               TALLOC_FREE(cur->event);
+               TALLOC_FREE(cur);
+       }
+
+       return;
+}
+
 /****************************************************************
  Do the work of refreshing the ticket.
 ****************************************************************/
index 42e43e8cf38e54b26b7f7388d27df0a7ea14fd54..b6af796a87dbcbe67f4a372289d26302296abc59 100644 (file)
@@ -1206,6 +1206,10 @@ static bool fork_domain_child(struct winbindd_child *child)
 
        close_conns_after_fork();
 
+       /* Ensure we're not handling an event inherited from
+          our parent. */
+       ccache_remove_all_after_fork();
+
        if (!override_logfile) {
                lp_set_logfile(child->logfilename);
                reopen_logs();
@@ -1269,12 +1273,6 @@ static bool fork_domain_child(struct winbindd_child *child)
                }
        }
 
-       /* Ensure we're not handling an event inherited from
-          our parent. */
-
-       cancel_named_event(winbind_event_context(),
-                          "krb5_ticket_refresh_handler");
-
        /* We might be in the idmap child...*/
        if (child->domain && !(child->domain->internal) &&
            lp_winbind_offline_logon()) {
index 64024660e66f53dcb95332f6d90a9196a1754803..8b0943423d3df97334b29b1175a8f96188c92237 100644 (file)
@@ -243,6 +243,7 @@ bool ccache_entry_exists(const char *username);
 bool ccache_entry_identical(const char *username,
                            uid_t uid,
                            const char *ccname);
+void ccache_remove_all_after_fork(void);
 NTSTATUS add_ccache_to_list(const char *princ_name,
                            const char *ccname,
                            const char *service,