summaryrefslogtreecommitdiff
path: root/usr/src/cmd/ssh/libssh/common/packet.c
diff options
context:
space:
mode:
authorJan Pechanec <Jan.Pechanec@Sun.COM>2009-09-14 08:35:38 -0700
committerJan Pechanec <Jan.Pechanec@Sun.COM>2009-09-14 08:35:38 -0700
commit3a7bd03955840c70afc1457eb632dfcd13b91f03 (patch)
treebf2fe81824a7bc1300bdb423d8f715b4c13a9ea0 /usr/src/cmd/ssh/libssh/common/packet.c
parenta76042b7b4e2deb62a8f2be75d2bb142e1ee70bf (diff)
downloadillumos-joyent-3a7bd03955840c70afc1457eb632dfcd13b91f03.tar.gz
6868716 dangling sshd authentication thread after timeout exit of monitor
6875551 remove the "authenticated" label from sshd.c
Diffstat (limited to 'usr/src/cmd/ssh/libssh/common/packet.c')
-rw-r--r--usr/src/cmd/ssh/libssh/common/packet.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/usr/src/cmd/ssh/libssh/common/packet.c b/usr/src/cmd/ssh/libssh/common/packet.c
index 4464cf4e18..1221db134a 100644
--- a/usr/src/cmd/ssh/libssh/common/packet.c
+++ b/usr/src/cmd/ssh/libssh/common/packet.c
@@ -933,8 +933,11 @@ packet_send(void)
* Waits until a packet has been received, and returns its type. Note that
* no other data is processed until this returns, so this function should not
* be used during the interactive session.
+ *
+ * The function is also used in the monitor to read the authentication context
+ * in aps_read_auth_context() via packet_read_seqnr(), before the monitor enters
+ * aps_monitor_loop() and starts using the process_input() function.
*/
-
int
packet_read_seqnr(u_int32_t *seqnr_p)
{
@@ -980,11 +983,22 @@ packet_read_seqnr(u_int32_t *seqnr_p)
/* Read data from the socket. */
len = read(connection_in, buf, sizeof(buf));
if (len == 0) {
- log("Connection closed by %.200s", get_remote_ipaddr());
+ if (packet_connection_is_on_socket())
+ log("Connection closed by %.200s",
+ get_remote_ipaddr());
+ else
+ debug("child closed the communication pipe "
+ "before user auth was finished");
fatal_cleanup();
}
- if (len < 0)
- fatal("Read from socket failed: %.100s", strerror(errno));
+ if (len < 0) {
+ if (packet_connection_is_on_socket())
+ fatal("Read from socket failed: %.100s",
+ strerror(errno));
+ else
+ fatal("Read from communication pipe failed: "
+ "%.100s", strerror(errno));
+ }
/* Append it to the buffer. */
packet_process_incoming(buf, len);
}