Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!att!occrsh!uokmax!noel From: noel@uokmax.UUCP (Bamf) Newsgroups: alt.sources Subject: The Worlds Smallest T-lock Keywords: Cut the Chat. Less blab, more code. Message-ID: <3457@uokmax.UUCP> Date: 30 Jun 89 21:49:44 GMT Reply-To: noel@uokmax.UUCP (Bamf) Distribution: alt Organization: Big Blue Box Lines: 32 /* Always one for minimalistic code, and to break up all the chatting thats been going on in this froup... I present to you, the worlds smallest T-Lock. (For those of you in non-academic envrionments, T-Lock means terminal lock. We don't all get our own.) Thats right, 4, count'em 4, lines of code. 7 if you count funny. */ /* No muss, no fuss, no trust. No backdoors, no alarms, and no LINT. */ /* It uses YOUR login password, and laughs at julian fries. */ /* Works for me, (On a Encore Muiltimax and SUN3 (4.2BSD)), YMMV. */ /* Oh, and yes, I know that gotos are a sin, but thats the kind of */ /* world we live in. Use it in good health. Bamf-Ware In-C, (c)1989 */ #include main() { char *crypt(),*getpass(),*xpass=getpwuid(getuid())->pw_passwd; (void)sigsetmask(-1); A: (void)printf("\nTerminal locked by %s\n",getpwuid(getuid())->pw_name); if (strcmp(crypt(getpass("Login password:"),xpass),xpass)) goto A; } -- /* "Can you do something out of this world?" -- Supertramp ----You want it should sing too?------| noel@uokmax | csm9a!bgphp1!ngorelic | "Beam me up Scotty, we're outta beer" */