Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Jul 1998 14:46:53 -0700 (PDT)
From:      Tom <tom@uniserve.com>
To:        Stefan Eggers <seggers@semyam.dinoco.de>
Cc:        freebsd-stable@FreeBSD.ORG
Subject:   Re: Finger and getpwent 
Message-ID:  <Pine.BSF.3.96.980710144247.2887C-100000@shell.uniserve.ca>
In-Reply-To: <199807102027.WAA27602@semyam.dinoco.de>

next in thread | previous in thread | raw e-mail | index | archive | help

On Fri, 10 Jul 1998, Stefan Eggers wrote:

> > > FBSD 2.2.2 to FBSD 2.2.6-stable something moved. In my /etc/passwd file
> > > there are lots of coments "#" and getpwent() return 0 after read this
> > > line. I have some scripts in perl that stops when getpwent() return 0.
> > > In FBSD 2.2.2 when getpwent() returned 0 meant end of file /etc/passwd.
> > 
> >   I hope you realize that /etc/passwd isn't used for anything.  All users
> > should be listed in /etc/master.passwd.  You should used vipw to edit
> > /etc/master.passwd
> 
> And how do you expect non-root/SUID-root programs to get at any
> information on users if not via /etc/passwd and (the actually used
> database version thereof) /etc/pwd.db?  getpwent() uses it if one
> isn't root.  For accesses by root it uses the shadow password file's
> database version.  See the source to -stable.

  Non-suid programs use /etc/pwd.db, not /etc/passwd.  You've answered
your own question.  /etc/passwd is USELESS.  In fact, I don't even have a
/etc/passwd on my systems.

  /etc/pwd.db is not a database version of /etc/passwd.  Both /etc/pwd.db
and /etc/spwd.db are generated from the raw infomration in
/etc/master.passwd.  pwd_mkdb likes to waste your time and spit out a text
version too.

> Using vipw is a good idea, though as that will keep both in sync.  Not
> doing so might eventually lead to interesting problems like root
> seeing something differing from what a user can see.  Besides the
> difference with the password, of course.  ;-)

  /etc/passwd is generated by pwd_mkdb when called with the "-p" switch.
If you don't use "-p" you will not get a /etc/passwd.

> Stefan.
> -- 
> Stefan Eggers                 Lu4 yao2 zhi1 ma3 li4,
> Max-Slevogt-Str. 1            ri4 jiu3 jian4 ren2 xin1.
> 51109 Koeln
> Federal Republic of Germany

Tom


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.980710144247.2887C-100000>