]> andersk Git - openssh.git/blobdiff - compat.c
- stevesk@cvs.openbsd.org 2002/02/04 00:53:39
[openssh.git] / compat.c
index 09ca4a447e9b2094b49dfe59c2382f9629b42671..050ee47babb8f1a3cae6ba2292852614404c1df5 100644 (file)
--- a/compat.c
+++ b/compat.c
@@ -23,8 +23,9 @@
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: compat.c,v 1.55 2001/12/05 16:54:51 markus Exp $");
+RCSID("$OpenBSD: compat.c,v 1.58 2002/01/21 22:30:12 markus Exp $");
 
+#include "buffer.h"
 #include "packet.h"
 #include "xmalloc.h"
 #include "compat.h"
@@ -82,19 +83,19 @@ compat_datafellows(const char *version)
                { "2.1 *",              SSH_BUG_SIGBLOB|SSH_BUG_HMAC|
                                        SSH_OLD_SESSIONID|SSH_BUG_DEBUG|
                                        SSH_BUG_RSASIGMD5|SSH_BUG_HBSERVICE },
-               { "2.0.13*,"    
-                 "2.0.14*,"    
-                 "2.0.15*,"    
-                 "2.0.16*,"    
-                 "2.0.17*,"    
-                 "2.0.18*,"    
+               { "2.0.13*,"
+                 "2.0.14*,"
+                 "2.0.15*,"
+                 "2.0.16*,"
+                 "2.0.17*,"
+                 "2.0.18*,"
                  "2.0.19*",            SSH_BUG_SIGBLOB|SSH_BUG_HMAC|
                                        SSH_OLD_SESSIONID|SSH_BUG_DEBUG|
                                        SSH_BUG_PKSERVICE|SSH_BUG_X11FWD|
                                        SSH_BUG_PKOK|SSH_BUG_RSASIGMD5|
                                        SSH_BUG_HBSERVICE|SSH_BUG_OPENFAILURE|
                                        SSH_BUG_DUMMYCHAN },
-               { "2.0.11*,"    
+               { "2.0.11*,"
                  "2.0.12*",            SSH_BUG_SIGBLOB|SSH_BUG_HMAC|
                                        SSH_OLD_SESSIONID|SSH_BUG_DEBUG|
                                        SSH_BUG_PKSERVICE|SSH_BUG_X11FWD|
@@ -124,7 +125,7 @@ compat_datafellows(const char *version)
                { "1.3.2*",             SSH_BUG_IGNOREMSG },    /* f-secure */
                { "*SSH Compatible Server*",                    /* Netscreen */
                                        SSH_BUG_PASSWORDPAD },
-               { "*OSU_0*,"            
+               { "*OSU_0*,"
                  "OSU_1.0*,"
                  "OSU_1.1*,"
                  "OSU_1.2*,"
@@ -182,24 +183,25 @@ proto_spec(const char *spec)
 char *
 compat_cipher_proposal(char *cipher_prop)
 {
+       Buffer b;
        char *orig_prop, *fix_ciphers;
        char *cp, *tmp;
-       size_t len;
 
        if (!(datafellows & SSH_BUG_BIGENDIANAES))
                return(cipher_prop);
 
-       len = strlen(cipher_prop) + 1;
-       fix_ciphers = xmalloc(len);
-       *fix_ciphers = '\0';
+       buffer_init(&b);
        tmp = orig_prop = xstrdup(cipher_prop);
        while ((cp = strsep(&tmp, ",")) != NULL) {
-               if (strncmp(cp, "aes", 3) && strncmp(cp, "rijndael", 8)) {
-                       if (*fix_ciphers)
-                               strlcat(fix_ciphers, ",", len);
-                       strlcat(fix_ciphers, cp, len);
+               if (strncmp(cp, "aes", 3) != 0) {
+                       if (buffer_len(&b) > 0)
+                               buffer_append(&b, ",", 1);
+                       buffer_append(&b, cp, strlen(cp));
                }
        }
+       buffer_append(&b, "\0", 1);
+       fix_ciphers = xstrdup(buffer_ptr(&b));
+       buffer_free(&b);
        xfree(orig_prop);
        debug2("Original cipher proposal: %s", cipher_prop);
        debug2("Compat cipher proposal: %s", fix_ciphers);
This page took 0.034672 seconds and 4 git commands to generate.