[openssh-commits] [openssh] 01/02: upstream: Store timeouts as int, not u_int as they are limited to
git+noreply at mindrot.org
git+noreply at mindrot.org
Tue Jun 20 10:07:14 AEST 2023
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit b53a809a549dcd4fbde554c6aa283e597b15ea33
Author: millert at openbsd.org <millert at openbsd.org>
Date: Mon Jun 5 13:24:36 2023 +0000
upstream: Store timeouts as int, not u_int as they are limited to
INT_MAX. Fixes sign compare warnings systems with 32-bit time_t due to type
promotion. OK djm@
OpenBSD-Commit-ID: 48081e9ad35705c5f1705711704a4c2ff94e87b7
---
channels.c | 10 +++++-----
channels.h | 6 +++---
servconf.c | 9 +++++----
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/channels.c b/channels.c
index ffaf8972..f2c873d7 100644
--- a/channels.c
+++ b/channels.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.430 2023/03/10 03:01:51 dtucker Exp $ */
+/* $OpenBSD: channels.c,v 1.431 2023/06/05 13:24:36 millert Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -154,7 +154,7 @@ struct permission_set {
/* Used to record timeouts per channel type */
struct ssh_channel_timeout {
char *type_pattern;
- u_int timeout_secs;
+ int timeout_secs;
};
/* Master structure for channels state */
@@ -312,11 +312,11 @@ channel_lookup(struct ssh *ssh, int id)
*/
void
channel_add_timeout(struct ssh *ssh, const char *type_pattern,
- u_int timeout_secs)
+ int timeout_secs)
{
struct ssh_channels *sc = ssh->chanctxt;
- debug2_f("channel type \"%s\" timeout %u seconds",
+ debug2_f("channel type \"%s\" timeout %d seconds",
type_pattern, timeout_secs);
sc->timeouts = xrecallocarray(sc->timeouts, sc->ntimeouts,
sc->ntimeouts + 1, sizeof(*sc->timeouts));
@@ -340,7 +340,7 @@ channel_clear_timeouts(struct ssh *ssh)
sc->ntimeouts = 0;
}
-static u_int
+static int
lookup_timeout(struct ssh *ssh, const char *type)
{
struct ssh_channels *sc = ssh->chanctxt;
diff --git a/channels.h b/channels.h
index 91cc466c..90f6d290 100644
--- a/channels.h
+++ b/channels.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.h,v 1.149 2023/03/04 03:22:59 dtucker Exp $ */
+/* $OpenBSD: channels.h,v 1.150 2023/06/05 13:24:36 millert Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
@@ -210,7 +210,7 @@ struct Channel {
/* Last traffic seen for OPEN channels */
time_t lastused;
/* Inactivity timeout deadline in seconds (0 = no timeout) */
- u_int inactive_deadline;
+ int inactive_deadline;
};
#define CHAN_EXTENDED_IGNORE 0
@@ -308,7 +308,7 @@ int channel_close_fd(struct ssh *, Channel *, int *);
void channel_send_window_changes(struct ssh *);
/* channel inactivity timeouts */
-void channel_add_timeout(struct ssh *, const char *, u_int);
+void channel_add_timeout(struct ssh *, const char *, int);
void channel_clear_timeouts(struct ssh *);
/* mux proxy support */
diff --git a/servconf.c b/servconf.c
index 0f4fd2f1..0e6b606b 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: servconf.c,v 1.393 2023/05/24 23:01:06 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.394 2023/06/05 13:24:36 millert Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -959,7 +959,7 @@ process_permitopen(struct ssh *ssh, ServerOptions *options)
/* Parse a ChannelTimeout clause "pattern=interval" */
static int
-parse_timeout(const char *s, char **typep, u_int *secsp)
+parse_timeout(const char *s, char **typep, int *secsp)
{
char *cp, *sdup;
int secs;
@@ -985,7 +985,7 @@ parse_timeout(const char *s, char **typep, u_int *secsp)
if (typep != NULL)
*typep = xstrdup(sdup);
if (secsp != NULL)
- *secsp = (u_int)secs;
+ *secsp = secs;
free(sdup);
return 0;
}
@@ -993,7 +993,8 @@ parse_timeout(const char *s, char **typep, u_int *secsp)
void
process_channel_timeouts(struct ssh *ssh, ServerOptions *options)
{
- u_int i, secs;
+ int secs;
+ u_int i;
char *type;
debug3_f("setting %u timeouts", options->num_channel_timeouts);
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list