summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2015-03-03 06:48:58 +0000
committerDamien Miller <djm@mindrot.org>2015-03-04 04:54:11 +1100
commit68d2dfc464fbcdf8d6387884260f9801f4352393 (patch)
tree73bd299fc3cdec7768d13d519b21becccaf41745
parent39e2f1229562e1195169905607bc12290d21f021 (diff)
upstream commit
Allow "ssh -Q protocol-version" to list supported SSH protocol versions. Useful for detecting builds without SSH v.1 support; idea and ok markus@
-rw-r--r--ssh.112
-rw-r--r--ssh.c9
2 files changed, 15 insertions, 6 deletions
diff --git a/ssh.1 b/ssh.1
index 56492120..da64b719 100644
--- a/ssh.1
+++ b/ssh.1
@@ -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.1,v 1.355 2015/01/30 11:43:14 djm Exp $
-.Dd $Mdocdate: January 30 2015 $
+.\" $OpenBSD: ssh.1,v 1.356 2015/03/03 06:48:58 djm Exp $
+.Dd $Mdocdate: March 3 2015 $
.Dt SSH 1
.Os
.Sh NAME
@@ -58,7 +58,7 @@
.Op Fl O Ar ctl_cmd
.Op Fl o Ar option
.Op Fl p Ar port
-.Op Fl Q Cm cipher | cipher-auth | mac | kex | key
+.Op Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
.Op Fl R Oo Ar bind_address : Oc Ns Ar port : Ns Ar host : Ns Ar hostport
.Op Fl S Ar ctl_path
.Op Fl W Ar host : Ns Ar port
@@ -497,7 +497,7 @@ For full details of the options listed below, and their possible values, see
Port to connect to on the remote host.
This can be specified on a
per-host basis in the configuration file.
-.It Fl Q Cm cipher | cipher-auth | mac | kex | key
+.It Fl Q Cm cipher | cipher-auth | mac | kex | key | protocol-version
Queries
.Nm
for the algorithms supported for the specified version 2.
@@ -511,7 +511,9 @@ The available features are:
.Ar kex
(key exchange algorithms),
.Ar key
-(key types).
+(key types) and
+.Ar protocol-version
+(supported SSH protocol versions).
.It Fl q
Quiet mode.
Causes most warning and diagnostic messages to be suppressed.
diff --git a/ssh.c b/ssh.c
index 57b53fb2..0ad82f02 100644
--- a/ssh.c
+++ b/ssh.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssh.c,v 1.415 2015/02/20 22:17:21 djm Exp $ */
+/* $OpenBSD: ssh.c,v 1.416 2015/03/03 06:48:58 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -678,6 +678,13 @@ main(int ac, char **av)
cp = key_alg_list(1, 0);
else if (strcmp(optarg, "key-plain") == 0)
cp = key_alg_list(0, 1);
+ else if (strcmp(optarg, "protocol-version") == 0) {
+#ifdef WITH_SSH1
+ cp = xstrdup("1\n2");
+#else
+ cp = xstrdup("2");
+#endif
+ }
if (cp == NULL)
fatal("Unsupported query \"%s\"", optarg);
printf("%s\n", cp);