summaryrefslogtreecommitdiffstats
path: root/crypto/openssh/compat.c
diff options
context:
space:
mode:
authorgreen <green@FreeBSD.org>2000-12-05 02:20:19 +0000
committergreen <green@FreeBSD.org>2000-12-05 02:20:19 +0000
commit2aecee364f2b1fa8b38c4d29600f05f33075cddf (patch)
treebf0881ca432b88e84b40b65bc72970ba5b2a3120 /crypto/openssh/compat.c
parent100d82038d69581b72d61ea79acb559a97322110 (diff)
downloadFreeBSD-src-2aecee364f2b1fa8b38c4d29600f05f33075cddf.zip
FreeBSD-src-2aecee364f2b1fa8b38c4d29600f05f33075cddf.tar.gz
Import of OpenSSH 2.3.0 (virgin OpenBSD source release).
Diffstat (limited to 'crypto/openssh/compat.c')
-rw-r--r--crypto/openssh/compat.c48
1 files changed, 34 insertions, 14 deletions
diff --git a/crypto/openssh/compat.c b/crypto/openssh/compat.c
index eeb6e2e..a9daabc 100644
--- a/crypto/openssh/compat.c
+++ b/crypto/openssh/compat.c
@@ -23,12 +23,13 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: compat.c,v 1.23 2000/09/07 21:13:37 markus Exp $");
+RCSID("$OpenBSD: compat.c,v 1.27 2000/10/31 09:31:58 markus Exp $");
#include "ssh.h"
#include "packet.h"
#include "xmalloc.h"
#include "compat.h"
+#include <regex.h>
int compat13 = 0;
int compat20 = 0;
@@ -50,27 +51,46 @@ enable_compat13(void)
void
compat_datafellows(const char *version)
{
- int i;
- size_t len;
- struct {
- char *version;
+ int i, ret;
+ char ebuf[1024];
+ regex_t reg;
+ static struct {
+ char *pat;
int bugs;
} check[] = {
- {"2.1.0", SSH_BUG_SIGBLOB|SSH_BUG_HMAC},
- {"2.0.1", SSH_BUG_SIGBLOB|SSH_BUG_HMAC|SSH_BUG_PUBKEYAUTH|SSH_BUG_X11FWD},
- {"2.", SSH_BUG_HMAC|SSH_COMPAT_SESSIONID_ENCODING},
- {NULL, 0}
+ { "^OpenSSH[-_]2\\.[012]", SSH_OLD_SESSIONID },
+ { "MindTerm", 0 },
+ { "^2\\.1\\.0 ", SSH_BUG_SIGBLOB|SSH_BUG_HMAC|
+ SSH_OLD_SESSIONID },
+ { "^2\\.0\\.", SSH_BUG_SIGBLOB|SSH_BUG_HMAC|
+ SSH_OLD_SESSIONID|
+ SSH_BUG_PUBKEYAUTH|SSH_BUG_X11FWD },
+ { "^2\\.[23]\\.0 ", SSH_BUG_HMAC},
+ { "^2\\.[2-9]\\.", 0 },
+ { "^2\\.4$", SSH_OLD_SESSIONID}, /* Van Dyke */
+ { "^3\\.0 SecureCRT", SSH_OLD_SESSIONID},
+ { "^1\\.7 SecureFX", SSH_OLD_SESSIONID},
+ { "^2\\.", SSH_BUG_HMAC}, /* XXX fallback */
+ { NULL, 0 }
};
/* process table, return first match */
- for (i = 0; check[i].version; i++) {
- len = strlen(check[i].version);
- if (strlen(version) >= len &&
- (strncmp(version, check[i].version, len) == 0)) {
- verbose("datafellows: %.200s", version);
+ for (i = 0; check[i].pat; i++) {
+ ret = regcomp(&reg, check[i].pat, REG_EXTENDED|REG_NOSUB);
+ if (ret != 0) {
+ regerror(ret, &reg, ebuf, sizeof(ebuf));
+ ebuf[sizeof(ebuf)-1] = '\0';
+ error("regerror: %s", ebuf);
+ continue;
+ }
+ ret = regexec(&reg, version, 0, NULL, 0);
+ regfree(&reg);
+ if (ret == 0) {
+ debug("match: %s pat %s\n", version, check[i].pat);
datafellows = check[i].bugs;
return;
}
}
+ debug("no match: %s", version);
}
#define SEP ","
OpenPOWER on IntegriCloud