summaryrefslogtreecommitdiff
path: root/source3/nsswitch
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2003-05-14 21:28:54 +0000
committerJeremy Allison <jra@samba.org>2003-05-14 21:28:54 +0000
commit05799e60fce24f957f4597af249eadff38ed42f4 (patch)
tree18c255a8de579199efcc2546449fd1480d85fc77 /source3/nsswitch
parent1904a21193a8c6cb1c293e26b3c2d0c9e80401a3 (diff)
downloadsamba-05799e60fce24f957f4597af249eadff38ed42f4.tar.gz
samba-05799e60fce24f957f4597af249eadff38ed42f4.tar.bz2
samba-05799e60fce24f957f4597af249eadff38ed42f4.zip
Ok, try and fix this correctly... Simplify the nasty loop logic.
Jeremy. (This used to be commit c19599a5624ac7ea63b529bf7d36cdcd7c8ef89f)
Diffstat (limited to 'source3/nsswitch')
-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;