version 1.147, 2018/05/11 03:22:55 |
version 1.148, 2018/07/09 21:35:50 |
|
|
#include "ssh2.h" |
#include "ssh2.h" |
#include "packet.h" |
#include "packet.h" |
#include "log.h" |
#include "log.h" |
#include "buffer.h" |
#include "sshbuf.h" |
#include "misc.h" |
#include "misc.h" |
#include "servconf.h" |
#include "servconf.h" |
#include "compat.h" |
#include "compat.h" |
|
|
static char * |
static char * |
authmethods_get(Authctxt *authctxt) |
authmethods_get(Authctxt *authctxt) |
{ |
{ |
Buffer b; |
struct sshbuf *b; |
char *list; |
char *list; |
u_int i; |
int i, r; |
|
|
buffer_init(&b); |
if ((b = sshbuf_new()) == NULL) |
|
fatal("%s: sshbuf_new failed", __func__); |
for (i = 0; authmethods[i] != NULL; i++) { |
for (i = 0; authmethods[i] != NULL; i++) { |
if (strcmp(authmethods[i]->name, "none") == 0) |
if (strcmp(authmethods[i]->name, "none") == 0) |
continue; |
continue; |
|
|
if (!auth2_method_allowed(authctxt, authmethods[i]->name, |
if (!auth2_method_allowed(authctxt, authmethods[i]->name, |
NULL)) |
NULL)) |
continue; |
continue; |
if (buffer_len(&b) > 0) |
if ((r = sshbuf_putf(b, "%s%s", sshbuf_len(b) ? "," : "", |
buffer_append(&b, ",", 1); |
authmethods[i]->name)) != 0) |
buffer_append(&b, authmethods[i]->name, |
fatal("%s: buffer error: %s", __func__, ssh_err(r)); |
strlen(authmethods[i]->name)); |
|
} |
} |
if ((list = sshbuf_dup_string(&b)) == NULL) |
if ((list = sshbuf_dup_string(b)) == NULL) |
fatal("%s: sshbuf_dup_string failed", __func__); |
fatal("%s: sshbuf_dup_string failed", __func__); |
buffer_free(&b); |
sshbuf_free(b); |
return list; |
return list; |
} |
} |
|
|