1294328Sdes/* $OpenBSD: auth2-kbdint.c,v 1.7 2014/07/15 15:54:14 millert Exp $ */
298675Sdes/*
398675Sdes * Copyright (c) 2000 Markus Friedl.  All rights reserved.
498675Sdes *
598675Sdes * Redistribution and use in source and binary forms, with or without
698675Sdes * modification, are permitted provided that the following conditions
798675Sdes * are met:
898675Sdes * 1. Redistributions of source code must retain the above copyright
998675Sdes *    notice, this list of conditions and the following disclaimer.
1098675Sdes * 2. Redistributions in binary form must reproduce the above copyright
1198675Sdes *    notice, this list of conditions and the following disclaimer in the
1298675Sdes *    documentation and/or other materials provided with the distribution.
1398675Sdes *
1498675Sdes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1598675Sdes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1698675Sdes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1798675Sdes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1898675Sdes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1998675Sdes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2098675Sdes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2198675Sdes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2298675Sdes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2398675Sdes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2498675Sdes */
2598675Sdes
2698675Sdes#include "includes.h"
2798675Sdes
28162856Sdes#include <sys/types.h>
29162856Sdes
30162856Sdes#include <stdarg.h>
31162856Sdes
32162856Sdes#include "xmalloc.h"
3398675Sdes#include "packet.h"
34162856Sdes#include "key.h"
35162856Sdes#include "hostfile.h"
3698675Sdes#include "auth.h"
3798675Sdes#include "log.h"
38162856Sdes#include "buffer.h"
39294328Sdes#include "misc.h"
4098675Sdes#include "servconf.h"
4198675Sdes
4298675Sdes/* import */
4398675Sdesextern ServerOptions options;
4498675Sdes
4598675Sdesstatic int
4698675Sdesuserauth_kbdint(Authctxt *authctxt)
4798675Sdes{
4898675Sdes	int authenticated = 0;
4998675Sdes	char *lang, *devs;
5098675Sdes
5198675Sdes	lang = packet_get_string(NULL);
5298675Sdes	devs = packet_get_string(NULL);
5398675Sdes	packet_check_eom();
5498675Sdes
5598675Sdes	debug("keyboard-interactive devs %s", devs);
5698675Sdes
5798675Sdes	if (options.challenge_response_authentication)
5898675Sdes		authenticated = auth2_challenge(authctxt, devs);
5998675Sdes
60255767Sdes	free(devs);
61255767Sdes	free(lang);
6298675Sdes	return authenticated;
6398675Sdes}
6498675Sdes
6598675SdesAuthmethod method_kbdint = {
6698675Sdes	"keyboard-interactive",
6798675Sdes	userauth_kbdint,
6898675Sdes	&options.kbd_interactive_authentication
6998675Sdes};
70