Commit dca35590 authored by Niels Möller's avatar Niels Möller
Browse files

(server_userauth_none): New authentication

method.

Rev: src/server_userauth.c:1.34
Rev: src/server_userauth.h:1.18
parent 5ba654d7
......@@ -23,6 +23,7 @@
#include "server_userauth.h"
#include "charset.h"
#include "connection.h"
#include "format.h"
#include "ssh.h"
......@@ -368,3 +369,42 @@ make_userauth_service(struct int_list *advertised_methods,
return &self->super;
}
/* None service (which works like external-keyexchange) */
static void
do_none_authenticate(struct userauth *s UNUSED,
struct ssh_connection *connection UNUSED,
struct lsh_string *username,
UINT32 service UNUSED,
struct simple_buffer *args,
struct command_continuation *c,
struct exception_handler *e)
{
username = utf8_to_local(username, 1, 1);
if (!username)
{
PROTOCOL_ERROR(e, "Invalid utf8 in username.");
return;
}
if (parse_eod(args))
{
static const struct exception wrong_user
= STATIC_EXCEPTION(EXC_USERAUTH,
"User needs to authenticate properly");
if (connection->user
&& lsh_string_eq(username, connection->user->name))
COMMAND_RETURN(c, connection->user);
else
EXCEPTION_RAISE(e, &wrong_user);
}
else
PROTOCOL_ERROR(e, "Invalid none USERAUTH message.");
lsh_string_free(username);
}
struct userauth server_userauth_none =
{ STATIC_HEADER, do_none_authenticate };
......@@ -95,6 +95,8 @@ format_userauth_success(void);
/* authentication methods */
extern struct userauth server_userauth_none;
struct userauth *
make_userauth_password(struct user_db *db);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment