[BACK]Return to compat.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / ssh

Diff for /src/usr.bin/ssh/compat.c between version 1.56 and 1.57

version 1.56, 2001/12/19 07:18:56 version 1.57, 2002/01/13 17:57:37
Line 25 
Line 25 
 #include "includes.h"  #include "includes.h"
 RCSID("$OpenBSD$");  RCSID("$OpenBSD$");
   
   #include "buffer.h"
 #include "packet.h"  #include "packet.h"
 #include "xmalloc.h"  #include "xmalloc.h"
 #include "compat.h"  #include "compat.h"
Line 182 
Line 183 
 char *  char *
 compat_cipher_proposal(char *cipher_prop)  compat_cipher_proposal(char *cipher_prop)
 {  {
           Buffer b;
         char *orig_prop, *fix_ciphers;          char *orig_prop, *fix_ciphers;
         char *cp, *tmp;          char *cp, *tmp;
         size_t len;  
   
         if (!(datafellows & SSH_BUG_BIGENDIANAES))          if (!(datafellows & SSH_BUG_BIGENDIANAES))
                 return(cipher_prop);                  return(cipher_prop);
   
         len = strlen(cipher_prop) + 1;          buffer_init(&b);
         fix_ciphers = xmalloc(len);  
         *fix_ciphers = '\0';  
         tmp = orig_prop = xstrdup(cipher_prop);          tmp = orig_prop = xstrdup(cipher_prop);
         while ((cp = strsep(&tmp, ",")) != NULL) {          while ((cp = strsep(&tmp, ",")) != NULL) {
                 if (strncmp(cp, "aes", 3) && strncmp(cp, "rijndael", 8)) {                  if (strncmp(cp, "aes", 3) && strncmp(cp, "rijndael", 8)) {
                         if (*fix_ciphers)                          if (buffer_len(&b) > 0)
                                 strlcat(fix_ciphers, ",", len);                                  buffer_append(&b, ",", 1);
                         strlcat(fix_ciphers, cp, len);                          buffer_append(&b, cp, strlen(cp));
                 }                  }
         }          }
           buffer_append(&b, "\0", 1);
           fix_ciphers = xstrdup(buffer_ptr(&b));
           buffer_free(&b);
         xfree(orig_prop);          xfree(orig_prop);
         debug2("Original cipher proposal: %s", cipher_prop);          debug2("Original cipher proposal: %s", cipher_prop);
         debug2("Compat cipher proposal: %s", fix_ciphers);          debug2("Compat cipher proposal: %s", fix_ciphers);

Legend:
Removed from v.1.56  
changed lines
  Added in v.1.57