/*- * This program is in the public domain. I couldn't bring myself to * declare Copyright on a variant of Hello World. */ #include __FBSDID("$FreeBSD: head/usr.sbin/nologin/nologin.c 126117 2004-02-22 10:03:24Z cperciva $"); #include #include #include #include #define MESSAGE "This account is currently not available.\n" int main(int argc, char *argv[]) { #ifndef NO_NOLOGIN_LOG char *user, *tt; if ((tt = ttyname(0)) == NULL) tt = "UNKNOWN"; if ((user = getlogin()) == NULL) user = "UNKNOWN"; openlog("nologin", LOG_CONS, LOG_AUTH); syslog(LOG_CRIT, "Attempted login by %s on %s", user, tt); closelog(); #endif /* NO_NOLOGIN_LOG */ write(STDOUT_FILENO, MESSAGE, sizeof(MESSAGE) - 1); _exit(1); }