script & lock
Dennis G. Rears FSAC
drears at ardec.arpa
Wed Dec 28 01:06:59 AEST 1988
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 <stdio.h>
#include <pwd.h>
#include <signal.h>
/* lock.c Author 1LT Dennis Rears 724-2474 <drears at ardc>
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 at 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
--------------------------------------------------------------------------
More information about the Comp.unix.wizards
mailing list