Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!cmcl2!adm!xadmx!drears@ardec.arpa From: drears@ardec.arpa (Dennis G. Rears (FSAC)) Newsgroups: comp.unix.wizards Subject: script & lock Message-ID: <17972@adm.BRL.MIL> Date: 27 Dec 88 15:06:59 GMT Sender: news@adm.BRL.MIL Lines: 61 This happens on a VAX 8600 running ULTRIK but does not happen on Goulds or Pyramids. I have a lock program I wrote several years ago. When I run it on top of /usr/ucb/script I get a Bus Error when I type in my password. Any idea why? Here is the program lock: #include #include #include /* lock.c Author 1LT Dennis Rears 724-2474 This program locks the terminal until that person's password is typed in. This is in place of the system lock program. This must be compiled using the berekly universe. */ main() { struct passwd *pwd, *getpwent(); char *strcpy(); char *getpass(), *getlogin(), *uname, *oldpass, *pass, *crypt(); int endpwent(), tries = 0, wrong; (void)signal(SIGINT, SIG_IGN); (void)signal(SIGQUIT, SIG_IGN); (void)signal(SIGTSTP, SIG_IGN); /* This gets the password entry from the file */ uname = getlogin(); /* What happens if the UTMP file is screwed? */ while ((pwd = getpwent()) != NULL && strcmp (pwd->pw_name, uname) != 0) ; (void)endpwent(); /* This checks the response */ wrong = 1; while (wrong) { (void)printf("Enter Password"); (void)fflush(stdout); oldpass = getpass(""); pass = crypt(oldpass, pwd->pw_passwd); if (strcmp(pass, pwd->pw_passwd) == 0) wrong = 0; tries++; } if (tries > 1) (void)printf("There were %d tries at unlocking your terminal\n", tries); } Dennis -------------------------------------------------------------------------- Dennis G. Rears ARPA: drears@ardec-ac4.arpa UUCP: ...!uunet!ardec-ac4.arpa!drears AT&T: 201-724-6639 USPS: Box 210, Wharton, NJ 07885 Work: SMCAR-FSS-E, Bldg 94, Picatinny Ars, NJ 07806 --------------------------------------------------------------------------