s3: Fix a winbind race leading to 100% CPU
[samba.git] / source3 / winbindd / winbindd_dual.c
index 360f1b2dbb292c69587d56f8e496fd460fe0ef2f..2c0633c3eaa2673bb7c3a5c1db02d623a0ba5534 100644 (file)
@@ -37,6 +37,8 @@
 extern bool override_logfile;
 extern struct winbindd_methods cache_methods;
 
+static struct winbindd_child *children = NULL;
+
 /* Read some data from a client connection */
 
 static NTSTATUS child_read_request(struct winbindd_cli_state *state)
@@ -170,6 +172,7 @@ static void wb_child_request_done(struct tevent_req *subreq)
                 */
                close(state->child->sock);
                state->child->sock = -1;
+               DLIST_REMOVE(children, state->child);
                tevent_req_error(req, err);
                return;
        }
@@ -517,8 +520,6 @@ void setup_child(struct winbindd_domain *domain, struct winbindd_child *child,
        SMB_ASSERT(child->rpccli != NULL);
 }
 
-struct winbindd_child *children = NULL;
-
 void winbind_child_died(pid_t pid)
 {
        struct winbindd_child *child;