summaryrefslogtreecommitdiff
path: root/sshconnect2.c
diff options
context:
space:
mode:
authordjm <djm>2002-01-22 12:26:38 +0000
committerdjm <djm>2002-01-22 12:26:38 +0000
commitdfc3265490ffa671f8598919b70a11239ca3fb34 (patch)
tree20fef3db5e3aba800ee96e28809e7736f7f8bb11 /sshconnect2.c
parent77c99672a770f374058ec687c6d38b48565d13ac (diff)
downloadopenssh-dfc3265490ffa671f8598919b70a11239ca3fb34.tar.gz
- markus@cvs.openbsd.org 2002/01/13 17:57:37
[auth2.c auth2-chall.c compat.c sshconnect2.c sshd.c] use buffer API and avoid static strings of fixed size; ok provos@/mouring@
Diffstat (limited to 'sshconnect2.c')
-rw-r--r--sshconnect2.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/sshconnect2.c b/sshconnect2.c
index a565f73c..3e5ca7ad 100644
--- a/sshconnect2.c
+++ b/sshconnect2.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: sshconnect2.c,v 1.92 2001/12/28 15:06:00 markus Exp $");
+RCSID("$OpenBSD: sshconnect2.c,v 1.93 2002/01/13 17:57:37 markus Exp $");
#include <openssl/bn.h>
#include <openssl/md5.h>
@@ -991,22 +991,23 @@ authmethod_get(char *authlist)
}
}
-
-#define DELIM ","
-
static char *
authmethods_get(void)
{
Authmethod *method = NULL;
- char buf[1024];
+ Buffer b;
+ char *list;
- buf[0] = '\0';
+ buffer_init(&b);
for (method = authmethods; method->name != NULL; method++) {
if (authmethod_is_enabled(method)) {
- if (buf[0] != '\0')
- strlcat(buf, DELIM, sizeof buf);
- strlcat(buf, method->name, sizeof buf);
+ if (buffer_len(&b) > 0)
+ buffer_append(&b, ",", 1);
+ buffer_append(&b, method->name, strlen(method->name));
}
}
- return xstrdup(buf);
+ buffer_append(&b, "\0", 1);
+ list = xstrdup(buffer_ptr(&b));
+ buffer_free(&b);
+ return list;
}