1295367Sdes/* $OpenBSD: auth2-none.c,v 1.18 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
28162852Sdes#include <sys/types.h>
29162852Sdes#include <sys/stat.h>
30162852Sdes#include <sys/uio.h>
31162852Sdes
32162852Sdes#include <fcntl.h>
33181111Sdes#include <string.h>
34162852Sdes#include <unistd.h>
35295367Sdes#include <stdarg.h>
36295367Sdes#include <stdio.h>
37162852Sdes
38181111Sdes#include "atomicio.h"
39162852Sdes#include "xmalloc.h"
40162852Sdes#include "key.h"
41162852Sdes#include "hostfile.h"
4298675Sdes#include "auth.h"
4398675Sdes#include "packet.h"
4498675Sdes#include "log.h"
45162852Sdes#include "buffer.h"
46295367Sdes#include "misc.h"
4798675Sdes#include "servconf.h"
4898675Sdes#include "compat.h"
4998675Sdes#include "ssh2.h"
50162852Sdes#ifdef GSSAPI
51162852Sdes#include "ssh-gss.h"
52162852Sdes#endif
5398675Sdes#include "monitor_wrap.h"
5498675Sdes
5598675Sdes/* import */
5698675Sdesextern ServerOptions options;
5798675Sdes
5898675Sdes/* "none" is allowed only one time */
5998675Sdesstatic int none_enabled = 1;
6098675Sdes
6198675Sdesstatic int
6298675Sdesuserauth_none(Authctxt *authctxt)
6398675Sdes{
6498675Sdes	none_enabled = 0;
6598675Sdes	packet_check_eom();
66215116Sdes	if (options.permit_empty_passwd && options.password_authentication)
67124208Sdes		return (PRIVSEP(auth_password(authctxt, "")));
68124208Sdes	return (0);
6998675Sdes}
7098675Sdes
7198675SdesAuthmethod method_none = {
7298675Sdes	"none",
7398675Sdes	userauth_none,
7498675Sdes	&none_enabled
7598675Sdes};
76