summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2012-03-20 10:34:55 -0400
committerStephen Gallagher <sgallagh@redhat.com>2012-03-20 11:32:45 -0400
commit5ca493af3e24e2cf7299289364cf23ccec9e5d35 (patch)
tree33239ea0b08263115baccf20a9cfc06117bd734c /src
parent0d3bd5e0dbdd7579b64cec0b0e93605a3c37cdc1 (diff)
downloadsssd-5ca493af3e24e2cf7299289364cf23ccec9e5d35.tar.gz
sssd-5ca493af3e24e2cf7299289364cf23ccec9e5d35.tar.bz2
sssd-5ca493af3e24e2cf7299289364cf23ccec9e5d35.zip
SSH: Fix infinite loop in sss_ssh_knownhostsproxy
https://fedorahosted.org/sssd/ticket/1268
Diffstat (limited to 'src')
-rw-r--r--src/sss_client/ssh/sss_ssh_knownhostsproxy.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c
index c6b0bd86..6424d7b7 100644
--- a/src/sss_client/ssh/sss_ssh_knownhostsproxy.c
+++ b/src/sss_client/ssh/sss_ssh_knownhostsproxy.c
@@ -135,27 +135,30 @@ connect_socket(int family, struct sockaddr *addr, size_t addr_len)
("read() failed (%d): %s\n", ret, strerror(ret)));
goto done;
} else if (res == 0) {
- break;
+ ret = EOK;
+ goto done;
}
+ errno = 0;
res = sss_atomic_write(i == 0 ? sock : 1, buffer, res);
+ ret = errno;
if (res == -1) {
- ret = errno;
DEBUG(SSSDBG_OP_FAILURE,
("sss_atomic_write() failed (%d): %s\n",
ret, strerror(ret)));
goto done;
+ } else if (ret == EPIPE) {
+ ret = EOK;
+ goto done;
}
}
if (fds[i].revents & POLLHUP) {
- break;
+ ret = EOK;
+ goto done;
}
}
}
- ret = EOK;
- DEBUG(SSSDBG_TRACE_FUNC, ("Connection closed\n"));
-
done:
if (sock >= 0) close(sock);