Add in rety loop for query_user_list (from APP_HEAD). Deals with a bug
[nivanova/samba-autobuild/.git] / source3 / nsswitch / winbindd_cm.c
index 9a34293cdb0cc9fb72e90a4ce426d05d16bcf21a..381cdaaa20f258bfe7390830ca5b4644e566075e 100644 (file)
@@ -659,3 +659,34 @@ void winbindd_cm_status(void)
        else
                DEBUG(0, ("\tNo active connections\n"));
 }
+
+/* Close all cached connections */
+
+void winbindd_cm_flush(void)
+{
+       struct winbindd_cm_conn *conn, tmp;
+
+       /* Flush connection cache */
+
+       for (conn = cm_conns; conn; conn = conn->next) {
+
+               if (!connection_ok(conn))
+                       continue;
+
+               DEBUG(10, ("Closing connection to %s on %s\n",
+                       conn->pipe_name, conn->controller));
+
+               if (conn->cli)
+                       cli_shutdown(conn->cli);
+
+               tmp.next = conn->next;
+
+               DLIST_REMOVE(cm_conns, conn);
+               SAFE_FREE(conn);
+               conn = &tmp;
+       }
+
+       /* Flush failed connection cache */
+
+       flush_negative_conn_cache();
+}