[openssh-commits] [openssh] 04/07: upstream: support VersionAddendum in the client, mirroring the
git+noreply at mindrot.org
git+noreply at mindrot.org
Sat Dec 7 21:24:06 AEDT 2024
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit 9a9ffee6e10bcd039f1f9385599577441ebe542a
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Fri Dec 6 16:21:48 2024 +0000
upstream: support VersionAddendum in the client, mirroring the
option of the same name in the server; bz2745 ok dtucker@
OpenBSD-Commit-ID: 6ff7905b3f9806649bde750515786553fb89cdf4
---
readconf.c | 28 +++++++++++++++++++++++++++-
readconf.h | 4 +++-
ssh.c | 9 ++++++++-
ssh_config.5 | 12 +++++++++---
sshconnect.c | 5 +++--
5 files changed, 50 insertions(+), 8 deletions(-)
diff --git a/readconf.c b/readconf.c
index 777739d6..aa646588 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.393 2024/11/27 16:07:08 djm Exp $ */
+/* $OpenBSD: readconf.c,v 1.394 2024/12/06 16:21:48 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -179,6 +179,7 @@ typedef enum {
oPubkeyAcceptedAlgorithms, oCASignatureAlgorithms, oProxyJump,
oSecurityKeyProvider, oKnownHostsCommand, oRequiredRSASize,
oEnableEscapeCommandline, oObscureKeystrokeTiming, oChannelTimeout,
+ oVersionAddendum,
oIgnore, oIgnoredUnknownOption, oDeprecated, oUnsupported
} OpCodes;
@@ -329,6 +330,7 @@ static struct {
{ "enableescapecommandline", oEnableEscapeCommandline },
{ "obscurekeystroketiming", oObscureKeystrokeTiming },
{ "channeltimeout", oChannelTimeout },
+ { "versionaddendum", oVersionAddendum },
{ NULL, oBadOption }
};
@@ -2440,6 +2442,28 @@ parse_pubkey_algos:
}
break;
+ case oVersionAddendum:
+ if (str == NULL || *str == '\0')
+ fatal("%s line %d: %s missing argument.",
+ filename, linenum, keyword);
+ len = strspn(str, WHITESPACE);
+ if (strchr(str + len, '\r') != NULL) {
+ fatal("%.200s line %d: Invalid %s argument",
+ filename, linenum, keyword);
+ }
+ if ((arg = strchr(line, '#')) != NULL) {
+ *arg = '\0';
+ rtrim(line);
+ }
+ if (*activep && options->version_addendum == NULL) {
+ if (strcasecmp(str + len, "none") == 0)
+ options->version_addendum = xstrdup("");
+ else
+ options->version_addendum = xstrdup(str + len);
+ }
+ argv_consume(&ac);
+ break;
+
case oDeprecated:
debug("%s line %d: Deprecated option \"%s\"",
filename, linenum, keyword);
@@ -2696,6 +2720,7 @@ initialize_options(Options * options)
options->tag = NULL;
options->channel_timeouts = NULL;
options->num_channel_timeouts = 0;
+ options->version_addendum = NULL;
}
/*
@@ -3649,6 +3674,7 @@ dump_client_config(Options *o, const char *host)
dump_cfg_string(oXAuthLocation, o->xauth_location);
dump_cfg_string(oKnownHostsCommand, o->known_hosts_command);
dump_cfg_string(oTag, o->tag);
+ dump_cfg_string(oVersionAddendum, o->version_addendum);
/* Forwards */
dump_cfg_forwards(oDynamicForward, o->num_local_forwards, o->local_forwards);
diff --git a/readconf.h b/readconf.h
index a1e43852..2922dcb2 100644
--- a/readconf.h
+++ b/readconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.h,v 1.157 2024/09/25 23:01:39 jsg Exp $ */
+/* $OpenBSD: readconf.h,v 1.158 2024/12/06 16:21:48 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
@@ -184,6 +184,8 @@ typedef struct {
char **channel_timeouts; /* inactivity timeout by channel type */
u_int num_channel_timeouts;
+ char *version_addendum;
+
char *ignored_unknown; /* Pattern list of unknown tokens to ignore */
} Options;
diff --git a/ssh.c b/ssh.c
index 112845be..5cd6a603 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.601 2024/10/18 05:03:34 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.602 2024/12/06 16:21:48 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1494,6 +1494,13 @@ main(int ac, char **av)
}
}
+ if (options.version_addendum != NULL) {
+ cp = default_client_percent_dollar_expand(
+ options.version_addendum, cinfo);
+ free(options.version_addendum);
+ options.version_addendum = cp;
+ }
+
if (options.num_system_hostfiles > 0 &&
strcasecmp(options.system_hostfiles[0], "none") == 0) {
if (options.num_system_hostfiles > 1)
diff --git a/ssh_config.5 b/ssh_config.5
index fed1a5ca..570bf651 100644
--- a/ssh_config.5
+++ b/ssh_config.5
@@ -33,8 +33,8 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
-.\" $OpenBSD: ssh_config.5,v 1.406 2024/12/05 22:45:03 naddy Exp $
-.Dd $Mdocdate: December 5 2024 $
+.\" $OpenBSD: ssh_config.5,v 1.407 2024/12/06 16:21:48 djm Exp $
+.Dd $Mdocdate: December 6 2024 $
.Dt SSH_CONFIG 5
.Os
.Sh NAME
@@ -2149,6 +2149,11 @@ See also
.Sx VERIFYING HOST KEYS
in
.Xr ssh 1 .
+.It Cm VersionAddendum
+Optionally specifies additional text to append to the SSH protocol banner
+sent by the client upon connection.
+The default is
+.Cm none .
.It Cm VisualHostKey
If this flag is set to
.Cm yes ,
@@ -2294,8 +2299,9 @@ The local username.
.Cm RemoteCommand ,
.Cm RemoteForward ,
.Cm RevokedHostKeys ,
-and
.Cm UserKnownHostsFile
+and
+.Cm VersionAddendum
accept the tokens %%, %C, %d, %h, %i, %j, %k, %L, %l, %n, %p, %r, and %u.
.Pp
.Cm KnownHostsCommand
diff --git a/sshconnect.c b/sshconnect.c
index 7cf6b638..c86182d1 100644
--- a/sshconnect.c
+++ b/sshconnect.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshconnect.c,v 1.368 2024/04/30 02:10:49 djm Exp $ */
+/* $OpenBSD: sshconnect.c,v 1.369 2024/12/06 16:21:48 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo at cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -1604,7 +1604,8 @@ ssh_login(struct ssh *ssh, Sensitive *sensitive, const char *orighost,
lowercase(host);
/* Exchange protocol version identification strings with the server. */
- if ((r = kex_exchange_identification(ssh, timeout_ms, NULL)) != 0)
+ if ((r = kex_exchange_identification(ssh, timeout_ms,
+ options.version_addendum)) != 0)
sshpkt_fatal(ssh, r, "banner exchange");
/* Put the connection into non-blocking mode. */
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list