summaryrefslogtreecommitdiff
path: root/auth2.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth2.c')
-rw-r--r--auth2.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/auth2.c b/auth2.c
index dc35a55f4..431f955fc 100644
--- a/auth2.c
+++ b/auth2.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: auth2.c,v 1.81 2002/01/11 13:39:36 markus Exp $"); 26RCSID("$OpenBSD: auth2.c,v 1.82 2002/01/13 17:57:37 markus Exp $");
27 27
28#include <openssl/evp.h> 28#include <openssl/evp.h>
29 29
@@ -588,31 +588,22 @@ static char *
588authmethods_get(void) 588authmethods_get(void)
589{ 589{
590 Authmethod *method = NULL; 590 Authmethod *method = NULL;
591 u_int size = 0; 591 Buffer b;
592 char *list; 592 char *list;
593 593
594 buffer_init(&b);
594 for (method = authmethods; method->name != NULL; method++) { 595 for (method = authmethods; method->name != NULL; method++) {
595 if (strcmp(method->name, "none") == 0) 596 if (strcmp(method->name, "none") == 0)
596 continue; 597 continue;
597 if (method->enabled != NULL && *(method->enabled) != 0) { 598 if (method->enabled != NULL && *(method->enabled) != 0) {
598 if (size != 0) 599 if (buffer_len(&b) > 0)
599 size += strlen(DELIM); 600 buffer_append(&b, ",", 1);
600 size += strlen(method->name); 601 buffer_append(&b, method->name, strlen(method->name));
601 }
602 }
603 size++; /* trailing '\0' */
604 list = xmalloc(size);
605 list[0] = '\0';
606
607 for (method = authmethods; method->name != NULL; method++) {
608 if (strcmp(method->name, "none") == 0)
609 continue;
610 if (method->enabled != NULL && *(method->enabled) != 0) {
611 if (list[0] != '\0')
612 strlcat(list, DELIM, size);
613 strlcat(list, method->name, size);
614 } 602 }
615 } 603 }
604 buffer_append(&b, "\0", 1);
605 list = xstrdup(buffer_ptr(&b));
606 buffer_free(&b);
616 return list; 607 return list;
617} 608}
618 609