ssh-keyscan for ssh2 (was Re: openssh-2.9p1)

Wayne Davison wayne at blorf.net
Sat May 19 05:31:19 EST 2001


On Fri, 18 May 2001 mouring at etoh.eviladmin.org wrote:
> I'm not seeing RSA protcol 2 keys.

I think the following patch (applied after my first patch) will make
this work.  I had previously mentioned that my patch wasn't working with
2.5.2p2, and this patch fixes this (the returned key is "ssh-rsa").

..wayne..

---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: ssh-keyscan.c
--- old/ssh-keyscan.c	Fri May 18 12:23:49 2001
+++ ./ssh-keyscan.c	Fri May 18 12:21:04 2001
@@ -25,6 +25,7 @@
 #include "ssh1.h"
 #include "key.h"
 #include "kex.h"
+#include "compat.h"
 #include "myproposal.h"
 #include "packet.h"
 #include "dispatch.h"
@@ -471,7 +472,7 @@
 void
 congreet(int s)
 {
-	char buf[80], *cp;
+	char buf[256], *cp;
 	size_t bufsiz;
 	int n = 0;
 	con *c = &fdcon[s];
@@ -493,6 +494,12 @@
 	}
 	*cp = '\0';
 	fprintf(stderr, "# %s %s\n", c->c_name, buf);
+	if (!(c->c_keytypes & 1)) {
+		char remote_version[sizeof buf];
+
+		if (sscanf(buf, "SSH-%*d.%*d-%[^\n]\n", remote_version) == 1)
+			compat_datafellows(remote_version);
+	}
 	n = snprintf(buf, sizeof buf, "SSH-%d.%d-OpenSSH-keyscan\r\n",
 	    c->c_keytypes & 1 ? PROTOCOL_MAJOR_1 : PROTOCOL_MAJOR_2,
 	    c->c_keytypes & 1 ? PROTOCOL_MINOR_1 : PROTOCOL_MINOR_2);
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---




More information about the openssh-unix-dev mailing list