]> andersk Git - openssh.git/blobdiff - compat.c
- OpenBSD CVS updates:
[openssh.git] / compat.c
index 5a633ff26c6a02a12bc11975c9b44c33a85c4bb4..e3b6db2dc332003accc1188956f4b98a5c8c49f6 100644 (file)
--- a/compat.c
+++ b/compat.c
@@ -32,6 +32,8 @@ RCSID("$Id$");
 
 #include "ssh.h"
 #include "packet.h"
+#include "xmalloc.h"
+#include "compat.h"
 
 int compat13 = 0;
 int compat20 = 0;
@@ -65,9 +67,36 @@ compat_datafellows(const char *version)
                len = strlen(check[i]);
                if (strlen(version) >= len &&
                   (strncmp(version, check[i], len) == 0)) {
-                       log("datafellows: %.200s", version);
+                       verbose("datafellows: %.200s", version);
                        datafellows = 1;
                        return;
                }
        }
 }
+
+#define        SEP     ","
+int
+proto_spec(const char *spec)
+{
+       char *s = xstrdup(spec);
+       char *p;
+       int ret = SSH_PROTO_UNKNOWN;
+
+       for ((p = strtok(s, SEP)); p; (p = strtok(NULL, SEP))) {
+               switch(atoi(p)) {
+               case 1:
+                       if (ret == SSH_PROTO_UNKNOWN)
+                               ret |= SSH_PROTO_1_PREFERRED;
+                       ret |= SSH_PROTO_1;
+                       break;
+               case 2:
+                       ret |= SSH_PROTO_2;
+                       break;
+               default:
+                       log("ignoring bad proto spec: '%s'.", p);
+                       break;
+               }
+       }
+       xfree(s);
+       return ret;
+}
This page took 0.03232 seconds and 4 git commands to generate.