1122842Sdas/*-
2126904Scperciva * Copyright (c) 2004 The FreeBSD Project.
3126904Scperciva * All rights reserved.
4126904Scperciva *
5126904Scperciva * Redistribution and use in source and binary forms, with or without
6126904Scperciva * modification, are permitted provided that the following conditions
7126904Scperciva * are met:
8126904Scperciva * 1. Redistributions of source code must retain the above copyright
9126904Scperciva *    notice, this list of conditions and the following disclaimer.
10126904Scperciva * 2. Redistributions in binary form must reproduce the above copyright
11126904Scperciva *    notice, this list of conditions and the following disclaimer in the
12126904Scperciva *    documentation and/or other materials provided with the distribution.
13126904Scperciva *
14126904Scperciva * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15126904Scperciva * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16126904Scperciva * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17126904Scperciva * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18126904Scperciva * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19126904Scperciva * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20126904Scperciva * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21126904Scperciva * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22126904Scperciva * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23126904Scperciva * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24126904Scperciva * SUCH DAMAGE.
25122842Sdas */
26122842Sdas
27122842Sdas#include <sys/cdefs.h>
28122842Sdas__FBSDID("$FreeBSD$");
29122842Sdas
30126904Scperciva#include <stdio.h>
31126117Scperciva#include <syslog.h>
32122842Sdas#include <unistd.h>
33122842Sdas
34122842Sdas#define	MESSAGE	"This account is currently not available.\n"
35122842Sdas
36122842Sdasint
37139685Sdelphijmain(__unused int argc, __unused char *argv[])
38122842Sdas{
39139656Sdelphij	const char *user, *tt;
40122842Sdas
41126117Scperciva	if ((tt = ttyname(0)) == NULL)
42126117Scperciva		tt = "UNKNOWN";
43126117Scperciva	if ((user = getlogin()) == NULL)
44126117Scperciva		user = "UNKNOWN";
45126117Scperciva	openlog("nologin", LOG_CONS, LOG_AUTH);
46126117Scperciva	syslog(LOG_CRIT, "Attempted login by %s on %s", user, tt);
47126117Scperciva	closelog();
48126117Scperciva
49126904Scperciva	printf("%s", MESSAGE);
50126904Scperciva	return 1;
51122842Sdas}
52