summaryrefslogtreecommitdiff
path: root/source3/nsswitch/winbindd_cm.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/nsswitch/winbindd_cm.c')
-rw-r--r--source3/nsswitch/winbindd_cm.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/source3/nsswitch/winbindd_cm.c b/source3/nsswitch/winbindd_cm.c
index 90df5019d4..05ea317d18 100644
--- a/source3/nsswitch/winbindd_cm.c
+++ b/source3/nsswitch/winbindd_cm.c
@@ -446,25 +446,25 @@ static BOOL connection_ok(struct winbindd_cm_conn *conn)
static void find_cm_connection(const char *domain, const char *pipe_name,
struct winbindd_cm_conn **conn_out)
{
- struct winbindd_cm_conn *conn, conn_temp;
-
- *conn_out = NULL;
+ struct winbindd_cm_conn *conn;
- for (conn = cm_conns; conn; conn = conn->next) {
+ for (conn = cm_conns; conn; ) {
if (strequal(conn->domain, domain) &&
strequal(conn->pipe_name, pipe_name)) {
if (!connection_ok(conn)) {
+ /* Dead connection - remove it. */
+ struct winbindd_cm_conn *conn_temp = conn->next;
if (conn->cli)
cli_shutdown(conn->cli);
- ZERO_STRUCT(conn_temp);
- conn_temp.next = conn->next;
DLIST_REMOVE(cm_conns, conn);
SAFE_FREE(conn);
- conn = &conn_temp; /* Just to keep the loop moving */
+ conn = conn_temp; /* Keep the loop moving */
+ continue;
} else {
break;
}
}
+ conn = conn->next;
}
*conn_out = conn;