summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--channels.c16
-rw-r--r--misc.c11
3 files changed, 27 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 8ad8b1a4e..1a5e6c2e5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,10 @@
2 - (djm) [commit configure.ac defines.h sshpty.c] don't attempt to use 2 - (djm) [commit configure.ac defines.h sshpty.c] don't attempt to use
3 vhangup on Linux. It doens't work for non-root users, and for them 3 vhangup on Linux. It doens't work for non-root users, and for them
4 it just messes up the tty settings. 4 it just messes up the tty settings.
5 - (djm) [misc.c] Use CLOCK_BOOTTIME in preference to CLOCK_MONOTONIC
6 when it is available. It takes into account time spent suspended,
7 thereby ensuring timeouts (e.g. for expiring agent keys) fire
8 correctly. bz#2228 reported by John Haxby
5 9
620140519 1020140519
7 - (djm) [rijndael.c rijndael.h] Sync with newly-ressurected versions ine 11 - (djm) [rijndael.c rijndael.h] Sync with newly-ressurected versions ine
diff --git a/channels.c b/channels.c
index 1020071ff..ea79dd3c5 100644
--- a/channels.c
+++ b/channels.c
@@ -2700,6 +2700,7 @@ channel_set_af(int af)
2700 * "0.0.0.0" -> wildcard v4/v6 if SSH_OLD_FORWARD_ADDR 2700 * "0.0.0.0" -> wildcard v4/v6 if SSH_OLD_FORWARD_ADDR
2701 * "" (empty string), "*" -> wildcard v4/v6 2701 * "" (empty string), "*" -> wildcard v4/v6
2702 * "localhost" -> loopback v4/v6 2702 * "localhost" -> loopback v4/v6
2703 * "127.0.0.1" / "::1" -> accepted even if gateway_ports isn't set
2703 */ 2704 */
2704static const char * 2705static const char *
2705channel_fwd_bind_addr(const char *listen_addr, int *wildcardp, 2706channel_fwd_bind_addr(const char *listen_addr, int *wildcardp,
@@ -2729,9 +2730,20 @@ channel_fwd_bind_addr(const char *listen_addr, int *wildcardp,
2729 "\"%s\" overridden by server " 2730 "\"%s\" overridden by server "
2730 "GatewayPorts", listen_addr); 2731 "GatewayPorts", listen_addr);
2731 } 2732 }
2732 } 2733 } else if (strcmp(listen_addr, "localhost") != 0 ||
2733 else if (strcmp(listen_addr, "localhost") != 0) 2734 strcmp(listen_addr, "127.0.0.1") == 0 ||
2735 strcmp(listen_addr, "::1") == 0) {
2736 /* Accept localhost address when GatewayPorts=yes */
2734 addr = listen_addr; 2737 addr = listen_addr;
2738 }
2739 } else if (strcmp(listen_addr, "127.0.0.1") == 0 ||
2740 strcmp(listen_addr, "::1") == 0) {
2741 /*
2742 * If a specific IPv4/IPv6 localhost address has been
2743 * requested then accept it even if gateway_ports is in
2744 * effect. This allows the client to prefer IPv4 or IPv6.
2745 */
2746 addr = listen_addr;
2735 } 2747 }
2736 if (wildcardp != NULL) 2748 if (wildcardp != NULL)
2737 *wildcardp = wildcard; 2749 *wildcardp = wildcard;
diff --git a/misc.c b/misc.c
index deb8768f3..099c4ef80 100644
--- a/misc.c
+++ b/misc.c
@@ -882,17 +882,24 @@ ms_to_timeval(struct timeval *tv, int ms)
882time_t 882time_t
883monotime(void) 883monotime(void)
884{ 884{
885#if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) 885#if defined(HAVE_CLOCK_GETTIME) && \
886 (defined(CLOCK_MONOTONIC) || defined(CLOCK_BOOTTIME))
886 struct timespec ts; 887 struct timespec ts;
887 static int gettime_failed = 0; 888 static int gettime_failed = 0;
888 889
889 if (!gettime_failed) { 890 if (!gettime_failed) {
891#if defined(CLOCK_BOOTTIME)
892 if (clock_gettime(CLOCK_BOOTTIME, &ts) == 0)
893 return (ts.tv_sec);
894#endif
895#if defined(CLOCK_MONOTONIC)
890 if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) 896 if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0)
891 return (ts.tv_sec); 897 return (ts.tv_sec);
898#endif
892 debug3("clock_gettime: %s", strerror(errno)); 899 debug3("clock_gettime: %s", strerror(errno));
893 gettime_failed = 1; 900 gettime_failed = 1;
894 } 901 }
895#endif 902#endif /* HAVE_CLOCK_GETTIME && (CLOCK_MONOTONIC || CLOCK_BOOTTIME */
896 903
897 return time(NULL); 904 return time(NULL);
898} 905}