summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYousong Zhou <yszhou4tech@gmail.com>2014-03-13 16:28:16 +0800
committerYousong Zhou <yszhou4tech@gmail.com>2014-03-13 16:28:16 +0800
commitc68e790544f3fd7e5abaf500a3f09f0206514d79 (patch)
treeb22938289064a2de51801b9a672023b04d9411ca
parent739d388d6be24e7c4c7bd3c0e5bc3f3738c59975 (diff)
downloaddropbear-c68e790544f3fd7e5abaf500a3f09f0206514d79.tar.gz
Use AUTH_TIMEOUT only before authdone != 1.
While at it, fix a few indentations and typo.
-rw-r--r--common-session.c7
-rw-r--r--packet.c4
-rw-r--r--process-packet.c2
3 files changed, 7 insertions, 6 deletions
diff --git a/common-session.c b/common-session.c
index 02eeaae..49dd8f8 100644
--- a/common-session.c
+++ b/common-session.c
@@ -433,12 +433,13 @@ static long select_timeout() {
long ret = LONG_MAX;
if (KEX_REKEY_TIMEOUT > 0)
ret = MIN(KEX_REKEY_TIMEOUT, ret);
- if (AUTH_TIMEOUT > 0)
+ /* AUTH_TIMEOUT is only relevant before authdone */
+ if (sess.authstate.authdone != 1 && AUTH_TIMEOUT > 0)
ret = MIN(AUTH_TIMEOUT, ret);
if (opts.keepalive_secs > 0)
ret = MIN(opts.keepalive_secs, ret);
- if (opts.idle_timeout_secs > 0)
- ret = MIN(opts.idle_timeout_secs, ret);
+ if (opts.idle_timeout_secs > 0)
+ ret = MIN(opts.idle_timeout_secs, ret);
return ret;
}
diff --git a/packet.c b/packet.c
index b624c27..8f7aa38 100644
--- a/packet.c
+++ b/packet.c
@@ -87,12 +87,12 @@ void write_packet() {
if (written < 0) {
if (errno == EINTR) {
m_free(iov);
- TRACE2(("leave writepacket: EINTR"))
+ TRACE2(("leave write_packet: EINTR"))
return;
} else {
dropbear_exit("Error writing");
}
- }
+ }
if (written == 0) {
ses.remoteclosed();
diff --git a/process-packet.c b/process-packet.c
index 1c2ca7b..3659cc0 100644
--- a/process-packet.c
+++ b/process-packet.c
@@ -52,7 +52,7 @@ void process_packet() {
ses.lastpacket = type;
- ses.last_packet_time = time(NULL);
+ ses.last_packet_time = time(NULL);
/* These packets we can receive at any time */
switch(type) {