Skip to content

Commit 7d17ea1

Browse files
millertdjmdjm
authored andcommitted
upstream: Add a -V (version) option to sshd like the ssh client
has. OK markus@ deraadt@ OpenBSD-Commit-ID: abe990ec3e636fb040132aab8cbbede98f0c413e
1 parent 62360fe commit 7d17ea1

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

sshd.8

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
3434
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3535
.\"
36-
.\" $OpenBSD: sshd.8,v 1.321 2022/09/11 06:38:11 jmc Exp $
37-
.Dd $Mdocdate: September 11 2022 $
36+
.\" $OpenBSD: sshd.8,v 1.322 2023/01/18 01:50:21 millert Exp $
37+
.Dd $Mdocdate: January 18 2023 $
3838
.Dt SSHD 8
3939
.Os
4040
.Sh NAME
@@ -43,7 +43,7 @@
4343
.Sh SYNOPSIS
4444
.Nm sshd
4545
.Bk -words
46-
.Op Fl 46DdeiqTt
46+
.Op Fl 46DdeiqTtV
4747
.Op Fl C Ar connection_spec
4848
.Op Fl c Ar host_certificate_file
4949
.Op Fl E Ar log_file
@@ -245,6 +245,8 @@ USER@HOST pattern in
245245
.Cm AllowUsers
246246
or
247247
.Cm DenyUsers .
248+
.It Fl V
249+
Display the version number and exit.
248250
.El
249251
.Sh AUTHENTICATION
250252
The OpenSSH SSH daemon supports SSH protocol 2 only.

sshd.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: sshd.c,v 1.595 2023/01/06 02:47:19 djm Exp $ */
1+
/* $OpenBSD: sshd.c,v 1.596 2023/01/18 01:50:21 millert Exp $ */
22
/*
33
* Author: Tatu Ylonen <[email protected]>
44
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
@@ -901,7 +901,7 @@ usage(void)
901901
{
902902
fprintf(stderr, "%s, %s\n", SSH_RELEASE, SSH_OPENSSL_VERSION);
903903
fprintf(stderr,
904-
"usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n"
904+
"usage: sshd [-46DdeiqTtV] [-C connection_spec] [-c host_cert_file]\n"
905905
" [-E log_file] [-f config_file] [-g login_grace_time]\n"
906906
" [-h host_key_file] [-o option] [-p port] [-u len]\n"
907907
);
@@ -1581,7 +1581,7 @@ main(int ac, char **av)
15811581

15821582
/* Parse command-line arguments. */
15831583
while ((opt = getopt(ac, av,
1584-
"C:E:b:c:f:g:h:k:o:p:u:46DQRTdeiqrt")) != -1) {
1584+
"C:E:b:c:f:g:h:k:o:p:u:46DQRTdeiqrtV")) != -1) {
15851585
switch (opt) {
15861586
case '4':
15871587
options.address_family = AF_INET;
@@ -1682,6 +1682,10 @@ main(int ac, char **av)
16821682
exit(1);
16831683
free(line);
16841684
break;
1685+
case 'V':
1686+
fprintf(stderr, "%s, %s\n",
1687+
SSH_VERSION, SSH_OPENSSL_VERSION);
1688+
exit(0);
16851689
default:
16861690
usage();
16871691
break;

0 commit comments

Comments
 (0)