diff options
Diffstat (limited to 'auth2.c')
-rw-r--r-- | auth2.c | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: auth2.c,v 1.147 2018/05/11 03:22:55 dtucker Exp $ */ | 1 | /* $OpenBSD: auth2.c,v 1.148 2018/07/09 21:35:50 markus Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. | 3 | * Copyright (c) 2000 Markus Friedl. All rights reserved. |
4 | * | 4 | * |
@@ -41,7 +41,7 @@ | |||
41 | #include "ssh2.h" | 41 | #include "ssh2.h" |
42 | #include "packet.h" | 42 | #include "packet.h" |
43 | #include "log.h" | 43 | #include "log.h" |
44 | #include "buffer.h" | 44 | #include "sshbuf.h" |
45 | #include "misc.h" | 45 | #include "misc.h" |
46 | #include "servconf.h" | 46 | #include "servconf.h" |
47 | #include "compat.h" | 47 | #include "compat.h" |
@@ -451,11 +451,12 @@ auth2_method_allowed(Authctxt *authctxt, const char *method, | |||
451 | static char * | 451 | static char * |
452 | authmethods_get(Authctxt *authctxt) | 452 | authmethods_get(Authctxt *authctxt) |
453 | { | 453 | { |
454 | Buffer b; | 454 | struct sshbuf *b; |
455 | char *list; | 455 | char *list; |
456 | u_int i; | 456 | int i, r; |
457 | 457 | ||
458 | buffer_init(&b); | 458 | if ((b = sshbuf_new()) == NULL) |
459 | fatal("%s: sshbuf_new failed", __func__); | ||
459 | for (i = 0; authmethods[i] != NULL; i++) { | 460 | for (i = 0; authmethods[i] != NULL; i++) { |
460 | if (strcmp(authmethods[i]->name, "none") == 0) | 461 | if (strcmp(authmethods[i]->name, "none") == 0) |
461 | continue; | 462 | continue; |
@@ -465,14 +466,13 @@ authmethods_get(Authctxt *authctxt) | |||
465 | if (!auth2_method_allowed(authctxt, authmethods[i]->name, | 466 | if (!auth2_method_allowed(authctxt, authmethods[i]->name, |
466 | NULL)) | 467 | NULL)) |
467 | continue; | 468 | continue; |
468 | if (buffer_len(&b) > 0) | 469 | if ((r = sshbuf_putf(b, "%s%s", sshbuf_len(b) ? "," : "", |
469 | buffer_append(&b, ",", 1); | 470 | authmethods[i]->name)) != 0) |
470 | buffer_append(&b, authmethods[i]->name, | 471 | fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
471 | strlen(authmethods[i]->name)); | ||
472 | } | 472 | } |
473 | if ((list = sshbuf_dup_string(&b)) == NULL) | 473 | if ((list = sshbuf_dup_string(b)) == NULL) |
474 | fatal("%s: sshbuf_dup_string failed", __func__); | 474 | fatal("%s: sshbuf_dup_string failed", __func__); |
475 | buffer_free(&b); | 475 | sshbuf_free(b); |
476 | return list; | 476 | return list; |
477 | } | 477 | } |
478 | 478 | ||