diff options
Diffstat (limited to 'sshd.c')
-rw-r--r-- | sshd.c | 24 |
1 files changed, 14 insertions, 10 deletions
@@ -40,7 +40,7 @@ | |||
40 | */ | 40 | */ |
41 | 41 | ||
42 | #include "includes.h" | 42 | #include "includes.h" |
43 | RCSID("$OpenBSD: sshd.c,v 1.222 2001/12/28 14:50:54 markus Exp $"); | 43 | RCSID("$OpenBSD: sshd.c,v 1.223 2002/01/13 17:57:37 markus Exp $"); |
44 | 44 | ||
45 | #include <openssl/dh.h> | 45 | #include <openssl/dh.h> |
46 | #include <openssl/bn.h> | 46 | #include <openssl/bn.h> |
@@ -480,9 +480,11 @@ destroy_sensitive_data(void) | |||
480 | static char * | 480 | static char * |
481 | list_hostkey_types(void) | 481 | list_hostkey_types(void) |
482 | { | 482 | { |
483 | static char buf[1024]; | 483 | Buffer b; |
484 | char *p; | ||
484 | int i; | 485 | int i; |
485 | buf[0] = '\0'; | 486 | |
487 | buffer_init(&b); | ||
486 | for (i = 0; i < options.num_host_key_files; i++) { | 488 | for (i = 0; i < options.num_host_key_files; i++) { |
487 | Key *key = sensitive_data.host_keys[i]; | 489 | Key *key = sensitive_data.host_keys[i]; |
488 | if (key == NULL) | 490 | if (key == NULL) |
@@ -490,16 +492,18 @@ list_hostkey_types(void) | |||
490 | switch (key->type) { | 492 | switch (key->type) { |
491 | case KEY_RSA: | 493 | case KEY_RSA: |
492 | case KEY_DSA: | 494 | case KEY_DSA: |
493 | strlcat(buf, key_ssh_name(key), sizeof buf); | 495 | if (buffer_len(&b) > 0) |
494 | strlcat(buf, ",", sizeof buf); | 496 | buffer_append(&b, ",", 1); |
497 | p = key_ssh_name(key); | ||
498 | buffer_append(&b, p, strlen(p)); | ||
495 | break; | 499 | break; |
496 | } | 500 | } |
497 | } | 501 | } |
498 | i = strlen(buf); | 502 | buffer_append(&b, "\0", 1); |
499 | if (i > 0 && buf[i-1] == ',') | 503 | p = xstrdup(buffer_ptr(&b)); |
500 | buf[i-1] = '\0'; | 504 | buffer_free(&b); |
501 | debug("list_hostkey_types: %s", buf); | 505 | debug("list_hostkey_types: %s", p); |
502 | return buf; | 506 | return p; |
503 | } | 507 | } |
504 | 508 | ||
505 | static Key * | 509 | static Key * |