summaryrefslogtreecommitdiff
path: root/usr.bin/ssh/auth2.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/ssh/auth2.c')
-rw-r--r--usr.bin/ssh/auth2.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/usr.bin/ssh/auth2.c b/usr.bin/ssh/auth2.c
index bd389d86b24..6def8f6769d 100644
--- a/usr.bin/ssh/auth2.c
+++ b/usr.bin/ssh/auth2.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: auth2.c,v 1.81 2002/01/11 13:39:36 markus Exp $");
+RCSID("$OpenBSD: auth2.c,v 1.82 2002/01/13 17:57:37 markus Exp $");
#include <openssl/evp.h>
@@ -533,31 +533,22 @@ static char *
authmethods_get(void)
{
Authmethod *method = NULL;
- u_int size = 0;
+ Buffer b;
char *list;
+ buffer_init(&b);
for (method = authmethods; method->name != NULL; method++) {
if (strcmp(method->name, "none") == 0)
continue;
if (method->enabled != NULL && *(method->enabled) != 0) {
- if (size != 0)
- size += strlen(DELIM);
- size += strlen(method->name);
- }
- }
- size++; /* trailing '\0' */
- list = xmalloc(size);
- list[0] = '\0';
-
- for (method = authmethods; method->name != NULL; method++) {
- if (strcmp(method->name, "none") == 0)
- continue;
- if (method->enabled != NULL && *(method->enabled) != 0) {
- if (list[0] != '\0')
- strlcat(list, DELIM, size);
- strlcat(list, method->name, size);
+ if (buffer_len(&b) > 0)
+ buffer_append(&b, ",", 1);
+ buffer_append(&b, method->name, strlen(method->name));
}
}
+ buffer_append(&b, "\0", 1);
+ list = xstrdup(buffer_ptr(&b));
+ buffer_free(&b);
return list;
}