From 0791a4d5beb7565c0ac476f8117b36b57fa5f938 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 11 Jul 2011 14:19:55 +0200 Subject: s3:winbindd_cm: make use of cli_state_is_connected() metze --- source3/winbindd/winbindd_cm.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'source3/winbindd/winbindd_cm.c') diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 86d6662e5a..c94d6709c4 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1445,12 +1445,10 @@ static void store_current_dc_in_gencache(const char *domain_name, char *key = NULL; char *value = NULL; - if (cli == NULL) { - return; - } - if (cli->fd == -1) { + if (!cli_state_is_connected(cli)) { return; } + get_peer_addr(cli->fd, addr, sizeof(addr)); key = current_dc_key(talloc_tos(), domain_name); @@ -1718,7 +1716,7 @@ void close_conns_after_fork(void) * so that we don't generate any SMBclose * requests in invalidate_cm_connection() */ - if (cli && cli->fd != -1) { + if (cli_state_is_connected(domain->conn.cli)) { close(domain->conn.cli->fd); domain->conn.cli->fd = -1; } @@ -2739,12 +2737,11 @@ void winbind_msg_ip_dropped(struct messaging_context *msg_ctx, for (domain = domain_list(); domain != NULL; domain = domain->next) { char sockaddr[INET6_ADDRSTRLEN]; - if (domain->conn.cli == NULL) { - continue; - } - if (domain->conn.cli->fd == -1) { + + if (!cli_state_is_connected(domain->conn.cli)) { continue; } + client_socket_addr(domain->conn.cli->fd, sockaddr, sizeof(sockaddr)); if (strequal(sockaddr, addr)) { -- cgit