*BSD News Article 27345


Return to BSD News archive

Newsgroups: comp.os.386bsd.questions
Path: sserve!newshost.anu.edu.au!munnari.oz.au!ariel.ucs.unimelb.EDU.AU!werple.apana.org.au!zikzak.apana.org.au!harbinger.cc.monash.edu.au!yeshua.marcam.com!usc!elroy.jpl.nasa.gov!swrinde!sgiblab!cs.uoregon.edu!news.uoregon.edu!netnews.nwnet.net!ns1.nodak.edu!plains.NoDak.edu!tinguely
From: tinguely@plains.NoDak.edu (Mark Tinguely)
Subject: Re: FreeBSD: /var/log/lastlog ?
Sender: usenet@ns1.nodak.edu (Usenet login)
Message-ID: <CL811r.nqw@ns1.nodak.edu>
Date: Mon, 14 Feb 1994 15:44:15 GMT
References: <2jfp0a$aop@pdq.coe.montana.edu> <1994Feb11.235107.16781@emba.uvm.edu> <CL60rF.53G@jester.GUN.de>
Nntp-Posting-Host: plains.nodak.edu
Organization: North Dakota State University
Lines: 30

In article <CL60rF.53G@jester.GUN.de> michael@jester.GUN.de (Michael Gerhards) writes:
>
>Hm, then something is wrong with it. My /var/adm/lastlog was ~ 960 KB
>big. And my system has ~ 10 users !
>

an entry is made for ALL UIDs whether they are used or not. here is a program
to look at your entries:
			===== looklastlog.c =====
#include <sys/types.h>
#include <utmp.h>
#include <sys/fcntl.h>
#include <time.h>
#include <pwd.h>

main()
{

	struct passwd *pwd;
	struct lastlog last;
	int i, fd;

	fd = open ("/var/log/lastlog",O_RDONLY);
	for (i=0; read(fd, &last, sizeof(last)) > 0; i++) 
		if (pwd = getpwuid(i))
		
		printf("%s %s %s %s\n",pwd->pw_name,ctime(&last.ll_time), last.ll_line,last.ll_host);
		else
		printf("%d %s %s %s\n",i,ctime(&last.ll_time), last.ll_line,last.ll_host);
}