1215116Sdes/* $OpenBSD: auth2-none.c,v 1.16 2010/06/25 08:46:17 djm 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 28162852Sdes#include <sys/types.h> 29162852Sdes#include <sys/stat.h> 30162852Sdes#include <sys/uio.h> 31162852Sdes 32162852Sdes#include <fcntl.h> 33162852Sdes#include <stdarg.h> 34181111Sdes#include <string.h> 35162852Sdes#include <unistd.h> 36162852Sdes 37181111Sdes#include "atomicio.h" 38162852Sdes#include "xmalloc.h" 39162852Sdes#include "key.h" 40162852Sdes#include "hostfile.h" 4198675Sdes#include "auth.h" 4298675Sdes#include "packet.h" 4398675Sdes#include "log.h" 44162852Sdes#include "buffer.h" 4598675Sdes#include "servconf.h" 4698675Sdes#include "compat.h" 4798675Sdes#include "ssh2.h" 48162852Sdes#ifdef GSSAPI 49162852Sdes#include "ssh-gss.h" 50162852Sdes#endif 5198675Sdes#include "monitor_wrap.h" 5298675Sdes 5398675Sdes/* import */ 5498675Sdesextern ServerOptions options; 5598675Sdes 5698675Sdes/* "none" is allowed only one time */ 5798675Sdesstatic int none_enabled = 1; 5898675Sdes 5998675Sdesstatic int 6098675Sdesuserauth_none(Authctxt *authctxt) 6198675Sdes{ 6298675Sdes none_enabled = 0; 6398675Sdes packet_check_eom(); 64215116Sdes if (options.permit_empty_passwd && options.password_authentication) 65124208Sdes return (PRIVSEP(auth_password(authctxt, ""))); 66124208Sdes return (0); 6798675Sdes} 6898675Sdes 6998675SdesAuthmethod method_none = { 7098675Sdes "none", 7198675Sdes userauth_none, 7298675Sdes &none_enabled 7398675Sdes}; 74