Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 6 Nov 1996 10:56:10 -0500 (EST)
From:      Bill Paul <wpaul@skynet.ctr.columbia.edu>
To:        nik@blueberry.co.uk
Cc:        bugs@freebsd.org
Subject:   Re: bin/1964: finger(1) and NIS failure
Message-ID:  <199611061556.KAA05414@skynet.ctr.columbia.edu>
In-Reply-To: <199611051755.RAA06381@coconut.blueberry.co.uk> from "Nik Clayton" at Nov 5, 96 05:55:06 pm

next in thread | previous in thread | raw e-mail | index | archive | help
Of all the gin joints in all the towns in all the world, Nik Clayton had 
to walk into mine and say:
> 
> 	In an otherwise working NIS installation, finger fails to find users
> 	who are not in /etc/passwd.
> 
> 	For my NIS installation, I've chosen to keep a skeleton passwd file
> 	in /etc, (which I can rdist around multiple machines), and keep
> 	the real passwd file in /var/yp/master.passwd.
> 
> 	Take two users, 'root' and 'nik'. 'root' appears in /etc/passwd,
> 	'nik' appears in /var/yp/master.passwd.
> 
> 	A finger(1) on 'root' will turn up the correct information. Doing
> 	the same to 'nik' fails with the message 'no such user'.
> 
> 	Repeating this with the '-m' flag to finger works.
> 
> 	% finger root
> 	Login: root			Name: Charlie Root
> 	...
> 
> 	% finger nik
> 	finger: nik: no such user
> 
> 	% finger -m root
> 	Login: root			Name: Charlie Root
> 
> 	% finger -m nik
> 	Login: nik			Name: Nik Clayton
> 	...
> 
> 	In every other respect, NIS appears to be working correctly --
> 	usernames are being looked up correctly, password changes are
> 	propogating around the network and so on.

Hm. Well, in order to test this properly, I need to install 2.1.5 on my
test machine in my office, which is running the last 2.2 SNAP at the
moment. (Switching it over is easy; I just need to find a spare few
minutes. :)

As it happens, the getpwent(3) code should be the same in 2.1.5 and 2.2.x
since I synchronized them shortly before 2.1.5 was frozen. As it is right
now, the finger(1) command on my test box seems to work fine. (Mind you,
this is with a SunOS NIS server, but that shouldn't matter.) I will load
2.1.5 and try to reproduce the problem, but I suspect a small configuration
problem.

Check the following for me:

- Make sure your passwd maps don't have any usernames that are longer
  than 8 characters. The getpwent(3) code should be able to handle longer
  than normal username fields read from NIS but individual applications
  may not handle the condition as gracefully and could behave weirdly.

- Check that you don't have any empty lines in any of the passwd maps.
  The yp_mkdb(8) command is supposed to prevent this sort of thing, but
  something may have slipped by. Use ypcat to check the passwd.by* and
  master.passwd.by* maps and make sure no empty lines go by.

- Check the state of your system, in particular the shared libraries,
  the /usr/bin/finger executable, and /usr/sbin/pwd_mkdb. According to
  the 21.5 live filesystem CD, they should look like this:

  # ls -l usr/bin/finger
  -r-xr-xr-x  1 bin  bin  20480 Jul 16 15:29 usr/bin/finger
  # ls -l usr/lib/libc.so*
  -r--r--r--  1 bin  bin  435727 Jul 16 15:11 usr/lib/libc.so.2.2
  # ls -l usr/sbin/pwd_mkdb
  -r-xr-xr-x  1 bin  bin  12288 Jul 16 15:34 usr/sbin/pwd_mkdb

  The reason I say this is that the getpwent(3) code did change a
  little bit from 2.1.0. The change is in the way NIS '+' and '-'
  entries are encoded in the /etc/pwd.db and /etc/spwd.db local
  user databases (which are generated from /etc/master.passwd).
  FreeBSD 2.1.5 can sucessfully read older databases from 2.1.0
  and get the NIS support right. But 2.1.0 will not be able to
  detect the NIS '+' entries from 2.1.5 databases properly, which
  will make it appear that NIS is not running. If you upgraded your
  system from 2.1.0 to 2.1.5 rather than installing fresh, you may
  have somehow ended up with an old finger(1) executable and an
  old copy of libc.so which can't see that NIS is turned on, and
  consequently cause finger(1) to fail to consult NIS. I've seen
  a couple of reports of problems due to this change and a not-quite
  perfect upgrade. It may also happen if you loaded one of the compat
  distributions for compatibility with older versions of FreeBSD; the
  compat dists include older shared library versions. It would be a
  little strange for only the finger(1) command to be affected, but 
  weirder things have happened.

Again, the finger(1) command that you're running should be loading
libc.so.2.2. You can use the ldd command to check if this is the case
(i.e. ldd /usr/bin/finger). Also, check that you don't perhaps have
an older copy of finger(1) somewhere else in your path which is
overriding the one in /usr/bin.

-Bill

-- 
=============================================================================
-Bill Paul            (212) 854-6020 | System Manager, Master of Unix-Fu
Work:         wpaul@ctr.columbia.edu | Center for Telecommunications Research
Home:  wpaul@skynet.ctr.columbia.edu | Columbia University, New York City
=============================================================================
 "If you're ever in trouble, go to the CTR. Ask for Bill. He will help you."
=============================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611061556.KAA05414>