upstream: Add a -V (version) option to sshd like the ssh client

has. OK markus@ deraadt@

OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e
This commit is contained in:
millert@openbsd.org 2023-01-18 01:50:21 +00:00 committed by Damien Miller
parent 62360feb7f
commit 7d17ea151c
No known key found for this signature in database
2 changed files with 12 additions and 6 deletions

8
sshd.8
View File

@ -33,8 +33,8 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\" .\"
.\" $OpenBSD: sshd.8,v 1.321 2022/09/11 06:38:11 jmc Exp $ .\" $OpenBSD: sshd.8,v 1.322 2023/01/18 01:50:21 millert Exp $
.Dd $Mdocdate: September 11 2022 $ .Dd $Mdocdate: January 18 2023 $
.Dt SSHD 8 .Dt SSHD 8
.Os .Os
.Sh NAME .Sh NAME
@ -43,7 +43,7 @@
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm sshd .Nm sshd
.Bk -words .Bk -words
.Op Fl 46DdeiqTt .Op Fl 46DdeiqTtV
.Op Fl C Ar connection_spec .Op Fl C Ar connection_spec
.Op Fl c Ar host_certificate_file .Op Fl c Ar host_certificate_file
.Op Fl E Ar log_file .Op Fl E Ar log_file
@ -245,6 +245,8 @@ USER@HOST pattern in
.Cm AllowUsers .Cm AllowUsers
or or
.Cm DenyUsers . .Cm DenyUsers .
.It Fl V
Display the version number and exit.
.El .El
.Sh AUTHENTICATION .Sh AUTHENTICATION
The OpenSSH SSH daemon supports SSH protocol 2 only. The OpenSSH SSH daemon supports SSH protocol 2 only.

10
sshd.c
View File

@ -1,4 +1,4 @@
/* $OpenBSD: sshd.c,v 1.595 2023/01/06 02:47:19 djm Exp $ */ /* $OpenBSD: sshd.c,v 1.596 2023/01/18 01:50:21 millert Exp $ */
/* /*
* Author: Tatu Ylonen <ylo@cs.hut.fi> * Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@ -901,7 +901,7 @@ usage(void)
{ {
fprintf(stderr, "%s, %s\n", SSH_RELEASE, SSH_OPENSSL_VERSION); fprintf(stderr, "%s, %s\n", SSH_RELEASE, SSH_OPENSSL_VERSION);
fprintf(stderr, fprintf(stderr,
"usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n" "usage: sshd [-46DdeiqTtV] [-C connection_spec] [-c host_cert_file]\n"
" [-E log_file] [-f config_file] [-g login_grace_time]\n" " [-E log_file] [-f config_file] [-g login_grace_time]\n"
" [-h host_key_file] [-o option] [-p port] [-u len]\n" " [-h host_key_file] [-o option] [-p port] [-u len]\n"
); );
@ -1581,7 +1581,7 @@ main(int ac, char **av)
/* Parse command-line arguments. */ /* Parse command-line arguments. */
while ((opt = getopt(ac, av, while ((opt = getopt(ac, av,
"C:E:b:c:f:g:h:k:o:p:u:46DQRTdeiqrt")) != -1) { "C:E:b:c:f:g:h:k:o:p:u:46DQRTdeiqrtV")) != -1) {
switch (opt) { switch (opt) {
case '4': case '4':
options.address_family = AF_INET; options.address_family = AF_INET;
@ -1682,6 +1682,10 @@ main(int ac, char **av)
exit(1); exit(1);
free(line); free(line);
break; break;
case 'V':
fprintf(stderr, "%s, %s\n",
SSH_VERSION, SSH_OPENSSL_VERSION);
exit(0);
default: default:
usage(); usage();
break; break;