comparison svr-session.c @ 940:e9dfb6d15193

Fix auth timeout regression
author Matt Johnston <matt@ucc.asn.au>
date Wed, 09 Jul 2014 22:02:22 +0800
parents a0819ecfee0b
children f7f6c15b0ec3
comparison
equal deleted inserted replaced
939:a0819ecfee0b 940:e9dfb6d15193
78 { 78 {
79 /* free potential public key options */ 79 /* free potential public key options */
80 svr_pubkey_options_cleanup(); 80 svr_pubkey_options_cleanup();
81 } 81 }
82 82
83 static void
84 svr_sessionloop() {
85 if (svr_ses.connect_time != 0
86 && monotonic_now() - svr_ses.connect_time >= AUTH_TIMEOUT) {
87 dropbear_close("Timeout before auth");
88 }
89 }
90
83 void svr_session(int sock, int childpipe) { 91 void svr_session(int sock, int childpipe) {
84 char *host, *port; 92 char *host, *port;
85 size_t len; 93 size_t len;
86 94
87 common_session_init(sock, sock); 95 common_session_init(sock, sock);
96
97 svr_ses.connect_time = monotonic_now();;
88 98
89 /* Initialise server specific parts of the session */ 99 /* Initialise server specific parts of the session */
90 svr_ses.childpipe = childpipe; 100 svr_ses.childpipe = childpipe;
91 #ifdef USE_VFORK 101 #ifdef USE_VFORK
92 svr_ses.server_pid = getpid(); 102 svr_ses.server_pid = getpid();
124 /* start off with key exchange */ 134 /* start off with key exchange */
125 send_msg_kexinit(); 135 send_msg_kexinit();
126 136
127 /* Run the main for loop. NULL is for the dispatcher - only the client 137 /* Run the main for loop. NULL is for the dispatcher - only the client
128 * code makes use of it */ 138 * code makes use of it */
129 session_loop(NULL); 139 session_loop(svr_sessionloop);
130 140
131 /* Not reached */ 141 /* Not reached */
132 142
133 } 143 }
134 144