comparison svr-session.c @ 1139:43a8ea69b24c

Fix problem where auth timeout wasn't checked when waiting for ident
author Matt Johnston <matt@ucc.asn.au>
date Mon, 03 Aug 2015 21:59:40 +0800
parents 8e0280986710
children 64a50eac1030
comparison
equal deleted inserted replaced
1138:cc3916a7afd9 1139:43a8ea69b24c
86 m_free(svr_ses.remotehost); 86 m_free(svr_ses.remotehost);
87 m_free(svr_ses.childpids); 87 m_free(svr_ses.childpids);
88 svr_ses.childpidsize = 0; 88 svr_ses.childpidsize = 0;
89 } 89 }
90 90
91 static void
92 svr_sessionloop() {
93 if (svr_ses.connect_time != 0
94 && monotonic_now() - svr_ses.connect_time >= AUTH_TIMEOUT) {
95 dropbear_close("Timeout before auth");
96 }
97 }
98
99 void svr_session(int sock, int childpipe) { 91 void svr_session(int sock, int childpipe) {
100 char *host, *port; 92 char *host, *port;
101 size_t len; 93 size_t len;
102 94
103 common_session_init(sock, sock); 95 common_session_init(sock, sock);
104
105 svr_ses.connect_time = monotonic_now();;
106 96
107 /* Initialise server specific parts of the session */ 97 /* Initialise server specific parts of the session */
108 svr_ses.childpipe = childpipe; 98 svr_ses.childpipe = childpipe;
109 #ifdef USE_VFORK 99 #ifdef USE_VFORK
110 svr_ses.server_pid = getpid(); 100 svr_ses.server_pid = getpid();
144 /* start off with key exchange */ 134 /* start off with key exchange */
145 send_msg_kexinit(); 135 send_msg_kexinit();
146 136
147 /* 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
148 * code makes use of it */ 138 * code makes use of it */
149 session_loop(svr_sessionloop); 139 session_loop(NULL);
150 140
151 /* Not reached */ 141 /* Not reached */
152 142
153 } 143 }
154 144