summaryrefslogtreecommitdiffhomepage
path: root/svr-session.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2014-07-09 22:02:22 +0800
committerMatt Johnston <matt@ucc.asn.au>2014-07-09 22:02:22 +0800
commitf1826ea389bfddb6a0d52314d01e3d8b8f46eec8 (patch)
tree20b108d78b33ca06d3b025dab9e398ebe9849cb0 /svr-session.c
parentc884e5000e881f45e5c2328e219eebd07b0560ca (diff)
Fix auth timeout regression
Diffstat (limited to 'svr-session.c')
-rw-r--r--svr-session.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/svr-session.c b/svr-session.c
index 90d3414..4d3c058 100644
--- a/svr-session.c
+++ b/svr-session.c
@@ -80,12 +80,22 @@ svr_session_cleanup(void)
svr_pubkey_options_cleanup();
}
+static void
+svr_sessionloop() {
+ if (svr_ses.connect_time != 0
+ && monotonic_now() - svr_ses.connect_time >= AUTH_TIMEOUT) {
+ dropbear_close("Timeout before auth");
+ }
+}
+
void svr_session(int sock, int childpipe) {
char *host, *port;
size_t len;
common_session_init(sock, sock);
+ svr_ses.connect_time = monotonic_now();;
+
/* Initialise server specific parts of the session */
svr_ses.childpipe = childpipe;
#ifdef USE_VFORK
@@ -126,7 +136,7 @@ void svr_session(int sock, int childpipe) {
/* Run the main for loop. NULL is for the dispatcher - only the client
* code makes use of it */
- session_loop(NULL);
+ session_loop(svr_sessionloop);
/* Not reached */