auth2-kbdint.c revision 162856
11556Srgrimes/* $OpenBSD: auth2-kbdint.c,v 1.5 2006/08/03 03:34:41 deraadt Exp $ */ 21556Srgrimes/* 31556Srgrimes * Copyright (c) 2000 Markus Friedl. All rights reserved. 41556Srgrimes * 51556Srgrimes * Redistribution and use in source and binary forms, with or without 61556Srgrimes * modification, are permitted provided that the following conditions 71556Srgrimes * are met: 81556Srgrimes * 1. Redistributions of source code must retain the above copyright 91556Srgrimes * notice, this list of conditions and the following disclaimer. 101556Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111556Srgrimes * notice, this list of conditions and the following disclaimer in the 121556Srgrimes * documentation and/or other materials provided with the distribution. 131556Srgrimes * 141556Srgrimes * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 151556Srgrimes * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 161556Srgrimes * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 171556Srgrimes * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 181556Srgrimes * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 191556Srgrimes * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 201556Srgrimes * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 211556Srgrimes * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 221556Srgrimes * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 231556Srgrimes * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 241556Srgrimes */ 251556Srgrimes 261556Srgrimes#include "includes.h" 271556Srgrimes__RCSID("$FreeBSD: head/crypto/openssh/auth2-kbdint.c 162856 2006-09-30 13:38:06Z des $"); 281556Srgrimes 291556Srgrimes#include <sys/types.h> 301556Srgrimes 311556Srgrimes#include <stdarg.h> 321556Srgrimes 331556Srgrimes#include "xmalloc.h" 3450471Speter#include "packet.h" 351556Srgrimes#include "key.h" 361556Srgrimes#include "hostfile.h" 371556Srgrimes#include "auth.h" 381556Srgrimes#include "log.h" 391556Srgrimes#include "buffer.h" 401556Srgrimes#include "servconf.h" 411556Srgrimes 421556Srgrimes/* import */ 431556Srgrimesextern ServerOptions options; 441556Srgrimes 451556Srgrimesstatic int 461556Srgrimesuserauth_kbdint(Authctxt *authctxt) 471556Srgrimes{ 481556Srgrimes int authenticated = 0; 491556Srgrimes char *lang, *devs; 501556Srgrimes 511556Srgrimes lang = packet_get_string(NULL); 52 devs = packet_get_string(NULL); 53 packet_check_eom(); 54 55 debug("keyboard-interactive devs %s", devs); 56 57 if (options.challenge_response_authentication) 58 authenticated = auth2_challenge(authctxt, devs); 59 60 xfree(devs); 61 xfree(lang); 62#ifdef HAVE_CYGWIN 63 if (check_nt_auth(0, authctxt->pw) == 0) 64 authenticated = 0; 65#endif 66 return authenticated; 67} 68 69Authmethod method_kbdint = { 70 "keyboard-interactive", 71 userauth_kbdint, 72 &options.kbd_interactive_authentication 73}; 74