187866Ssheldonh/* $OpenBSD: auth2-none.c,v 1.18 2014/07/15 15:54:14 millert Exp $ */
288282Ssheldonh/*
387866Ssheldonh * Copyright (c) 2000 Markus Friedl.  All rights reserved.
487866Ssheldonh *
587866Ssheldonh * Redistribution and use in source and binary forms, with or without
687866Ssheldonh * modification, are permitted provided that the following conditions
787866Ssheldonh * are met:
887866Ssheldonh * 1. Redistributions of source code must retain the above copyright
987866Ssheldonh *    notice, this list of conditions and the following disclaimer.
1087866Ssheldonh * 2. Redistributions in binary form must reproduce the above copyright
1187866Ssheldonh *    notice, this list of conditions and the following disclaimer in the
1287866Ssheldonh *    documentation and/or other materials provided with the distribution.
1387866Ssheldonh *
1487866Ssheldonh * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1587866Ssheldonh * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1687866Ssheldonh * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1787866Ssheldonh * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1887866Ssheldonh * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
1987866Ssheldonh * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2087866Ssheldonh * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2187866Ssheldonh * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2287866Ssheldonh * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2387866Ssheldonh * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2487866Ssheldonh */
2587866Ssheldonh
2687866Ssheldonh#include "includes.h"
2787866Ssheldonh
2887866Ssheldonh#include <sys/types.h>
2987866Ssheldonh#include <sys/stat.h>
3087866Ssheldonh#include <sys/uio.h>
3187866Ssheldonh
3288282Ssheldonh#include <fcntl.h>
3387866Ssheldonh#include <string.h>
34150312Simura#include <unistd.h>
35150312Simura#include <stdarg.h>
36150312Simura#include <stdio.h>
37150312Simura
3887866Ssheldonh#include "atomicio.h"
39150312Simura#include "xmalloc.h"
4087866Ssheldonh#include "key.h"
4187866Ssheldonh#include "hostfile.h"
4287866Ssheldonh#include "auth.h"
4387866Ssheldonh#include "packet.h"
4487866Ssheldonh#include "log.h"
4587866Ssheldonh#include "buffer.h"
4687866Ssheldonh#include "misc.h"
4787866Ssheldonh#include "servconf.h"
4887866Ssheldonh#include "compat.h"
4987866Ssheldonh#include "ssh2.h"
5087866Ssheldonh#ifdef GSSAPI
5187866Ssheldonh#include "ssh-gss.h"
5287866Ssheldonh#endif
5387866Ssheldonh#include "monitor_wrap.h"
5487866Ssheldonh
5587866Ssheldonh/* import */
5687866Ssheldonhextern ServerOptions options;
5787866Ssheldonh
5887866Ssheldonh/* "none" is allowed only one time */
5987866Ssheldonhstatic int none_enabled = 1;
6087866Ssheldonh
6187866Ssheldonhstatic int
6287866Ssheldonhuserauth_none(Authctxt *authctxt)
6387866Ssheldonh{
6487866Ssheldonh	none_enabled = 0;
6587866Ssheldonh	packet_check_eom();
6687866Ssheldonh	if (options.permit_empty_passwd && options.password_authentication)
6787866Ssheldonh		return (PRIVSEP(auth_password(authctxt, "")));
6887866Ssheldonh	return (0);
6987866Ssheldonh}
7087866Ssheldonh
7187866SsheldonhAuthmethod method_none = {
7287866Ssheldonh	"none",
7387866Ssheldonh	userauth_none,
7487866Ssheldonh	&none_enabled
7587866Ssheldonh};
7687866Ssheldonh