00001 /* 00002 * Copyright (c) 2000 Markus Friedl. All rights reserved. 00003 * 00004 * Redistribution and use in source and binary forms, with or without 00005 * modification, are permitted provided that the following conditions 00006 * are met: 00007 * 1. Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * 2. Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in the 00011 * documentation and/or other materials provided with the distribution. 00012 * 00013 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00014 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 00015 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 00016 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 00017 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 00018 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00019 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00020 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00021 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 00022 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00023 */ 00024 00025 #include "includes.h" 00026 RCSID("$OpenBSD: auth2-kbdint.c,v 1.2 2002/05/31 11:35:15 markus Exp $"); 00027 00028 #include "packet.h" 00029 #include "auth.h" 00030 #include "log.h" 00031 #include "servconf.h" 00032 #include "xmalloc.h" 00033 00034 /* import */ 00035 extern ServerOptions options; 00036 00037 static int 00038 userauth_kbdint(Authctxt *authctxt) 00039 { 00040 int authenticated = 0; 00041 char *lang, *devs; 00042 00043 lang = packet_get_string(NULL); 00044 devs = packet_get_string(NULL); 00045 packet_check_eom(); 00046 00047 debug("keyboard-interactive devs %s", devs); 00048 00049 if (options.challenge_response_authentication) 00050 authenticated = auth2_challenge(authctxt, devs); 00051 00052 xfree(devs); 00053 xfree(lang); 00054 #ifdef HAVE_CYGWIN 00055 if (check_nt_auth(0, authctxt->pw) == 0) 00056 authenticated = 0; 00057 #endif 00058 return authenticated; 00059 } 00060 00061 Authmethod method_kbdint = { 00062 "keyboard-interactive", 00063 userauth_kbdint, 00064 &options.kbd_interactive_authentication 00065 };