171ff2d08SDavid Schultz /*-
23590bb99SColin Percival * Copyright (c) 2004 The FreeBSD Project.
33590bb99SColin Percival * All rights reserved.
43590bb99SColin Percival *
53590bb99SColin Percival * Redistribution and use in source and binary forms, with or without
63590bb99SColin Percival * modification, are permitted provided that the following conditions
73590bb99SColin Percival * are met:
83590bb99SColin Percival * 1. Redistributions of source code must retain the above copyright
93590bb99SColin Percival * notice, this list of conditions and the following disclaimer.
103590bb99SColin Percival * 2. Redistributions in binary form must reproduce the above copyright
113590bb99SColin Percival * notice, this list of conditions and the following disclaimer in the
123590bb99SColin Percival * documentation and/or other materials provided with the distribution.
133590bb99SColin Percival *
143590bb99SColin Percival * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
153590bb99SColin Percival * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
163590bb99SColin Percival * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
173590bb99SColin Percival * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
183590bb99SColin Percival * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
193590bb99SColin Percival * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
203590bb99SColin Percival * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
213590bb99SColin Percival * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
223590bb99SColin Percival * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
233590bb99SColin Percival * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
243590bb99SColin Percival * SUCH DAMAGE.
2571ff2d08SDavid Schultz */
2671ff2d08SDavid Schultz
2771ff2d08SDavid Schultz #include <sys/cdefs.h>
283590bb99SColin Percival #include <stdio.h>
2947c524ddSColin Percival #include <syslog.h>
3071ff2d08SDavid Schultz #include <unistd.h>
3171ff2d08SDavid Schultz
3271ff2d08SDavid Schultz #define MESSAGE "This account is currently not available.\n"
3371ff2d08SDavid Schultz
3471ff2d08SDavid Schultz int
main(__unused int argc,__unused char * argv[])3551c86fb5SXin LI main(__unused int argc, __unused char *argv[])
3671ff2d08SDavid Schultz {
370dac67d6SXin LI const char *user, *tt;
3871ff2d08SDavid Schultz
3947c524ddSColin Percival if ((tt = ttyname(0)) == NULL)
4047c524ddSColin Percival tt = "UNKNOWN";
4147c524ddSColin Percival if ((user = getlogin()) == NULL)
4247c524ddSColin Percival user = "UNKNOWN";
4347c524ddSColin Percival openlog("nologin", LOG_CONS, LOG_AUTH);
4447c524ddSColin Percival syslog(LOG_CRIT, "Attempted login by %s on %s", user, tt);
4547c524ddSColin Percival closelog();
4647c524ddSColin Percival
473590bb99SColin Percival printf("%s", MESSAGE);
483590bb99SColin Percival return 1;
4971ff2d08SDavid Schultz }
50