summaryrefslogtreecommitdiff
path: root/clientloop.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-02 07:46:16 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-06-02 07:46:16 +1000
commitb759c9c2efebe7b416ab81093ca8eb17836b6933 (patch)
tree41ad0279844ea8f149ab2c1015fa140061b390ac /clientloop.c
parent55119253c64808b0d3b2ab5d2bc67ee9dac3430b (diff)
- dtucker@cvs.openbsd.org 2013/06/01 13:15:52
[ssh-agent.c clientloop.c misc.h packet.c progressmeter.c misc.c channels.c sandbox-systrace.c] Use clock_gettime(CLOCK_MONOTONIC ...) for ssh timers so that things like keepalives and rekeying will work properly over clock steps. Suggested by markus@, "looks good" djm@.
Diffstat (limited to 'clientloop.c')
-rw-r--r--clientloop.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/clientloop.c b/clientloop.c
index 22138560b..4b071eb91 100644
--- a/clientloop.c
+++ b/clientloop.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: clientloop.c,v 1.250 2013/05/17 00:13:13 djm Exp $ */ 1/* $OpenBSD: clientloop.c,v 1.251 2013/06/01 13:15:51 dtucker Exp $ */
2/* 2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi> 3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -273,7 +273,7 @@ set_control_persist_exit_time(void)
273 control_persist_exit_time = 0; 273 control_persist_exit_time = 0;
274 } else if (control_persist_exit_time <= 0) { 274 } else if (control_persist_exit_time <= 0) {
275 /* a client connection has recently closed */ 275 /* a client connection has recently closed */
276 control_persist_exit_time = time(NULL) + 276 control_persist_exit_time = monotime() +
277 (time_t)options.control_persist_timeout; 277 (time_t)options.control_persist_timeout;
278 debug2("%s: schedule exit in %d seconds", __func__, 278 debug2("%s: schedule exit in %d seconds", __func__,
279 options.control_persist_timeout); 279 options.control_persist_timeout);
@@ -356,7 +356,7 @@ client_x11_get_proto(const char *display, const char *xauth_path,
356 if (system(cmd) == 0) 356 if (system(cmd) == 0)
357 generated = 1; 357 generated = 1;
358 if (x11_refuse_time == 0) { 358 if (x11_refuse_time == 0) {
359 now = time(NULL) + 1; 359 now = monotime() + 1;
360 if (UINT_MAX - timeout < now) 360 if (UINT_MAX - timeout < now)
361 x11_refuse_time = UINT_MAX; 361 x11_refuse_time = UINT_MAX;
362 else 362 else
@@ -581,7 +581,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
581{ 581{
582 struct timeval tv, *tvp; 582 struct timeval tv, *tvp;
583 int timeout_secs; 583 int timeout_secs;
584 time_t minwait_secs = 0, server_alive_time = 0, now = time(NULL); 584 time_t minwait_secs = 0, server_alive_time = 0, now = monotime();
585 int ret; 585 int ret;
586 586
587 /* Add any selections by the channel mechanism. */ 587 /* Add any selections by the channel mechanism. */
@@ -676,7 +676,7 @@ client_wait_until_can_do_something(fd_set **readsetp, fd_set **writesetp,
676 * Timeout. Could have been either keepalive or rekeying. 676 * Timeout. Could have been either keepalive or rekeying.
677 * Keepalive we check here, rekeying is checked in clientloop. 677 * Keepalive we check here, rekeying is checked in clientloop.
678 */ 678 */
679 if (server_alive_time != 0 && server_alive_time <= time(NULL)) 679 if (server_alive_time != 0 && server_alive_time <= monotime())
680 server_alive_check(); 680 server_alive_check();
681 } 681 }
682 682
@@ -1650,7 +1650,7 @@ client_loop(int have_pty, int escape_char_arg, int ssh2_chan_id)
1650 * connections, then quit. 1650 * connections, then quit.
1651 */ 1651 */
1652 if (control_persist_exit_time > 0) { 1652 if (control_persist_exit_time > 0) {
1653 if (time(NULL) >= control_persist_exit_time) { 1653 if (monotime() >= control_persist_exit_time) {
1654 debug("ControlPersist timeout expired"); 1654 debug("ControlPersist timeout expired");
1655 break; 1655 break;
1656 } 1656 }
@@ -1868,7 +1868,7 @@ client_request_x11(const char *request_type, int rchan)
1868 "malicious server."); 1868 "malicious server.");
1869 return NULL; 1869 return NULL;
1870 } 1870 }
1871 if (x11_refuse_time != 0 && time(NULL) >= x11_refuse_time) { 1871 if (x11_refuse_time != 0 && monotime() >= x11_refuse_time) {
1872 verbose("Rejected X11 connection after ForwardX11Timeout " 1872 verbose("Rejected X11 connection after ForwardX11Timeout "
1873 "expired"); 1873 "expired");
1874 return NULL; 1874 return NULL;