From daveho@infocom.com  Thu Nov 30 09:02:56 1995
Received: from infocom.com (tye.infocom.com [199.120.185.1])
          by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id JAA03148
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 30 Nov 1995 09:02:53 -0800
Received: (from daveho@localhost) by infocom.com (8.6.12/8.6.12) id LAA03354; Thu, 30 Nov 1995 11:59:56 -0500
Message-Id: <199511301659.LAA03354@infocom.com>
Date: Thu, 30 Nov 1995 11:59:56 -0500
From: daveho@infocom.com
Reply-To: daveho@infocom.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: NIS server problem
X-Send-Pr-Version: 3.2

>Number:         853
>Category:       bin
>Synopsis:       NIS map services.byname not exported to clients correctly
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Nov 30 09:10:02 PST 1995
>Closed-Date:    Sat Dec 9 11:25:19 PST 1995
>Last-Modified:  Sat Dec  9 11:28:21 PST 1995
>Originator:     David Hovemeyer
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
Nerd Central
>Environment:

	2.1.0-951020-SNAP
	2.1.0-RELEASE
	(problem affects both)

>Description:

	The FreeBSD box is being used as an NIS server.  The problem is
	with the services.byname map: for services with both a tcp and
	udp version, only the udp version is visible through NIS.  This
	causes problems for clients looking for the tcp service.

>How-To-Repeat:

	On a client, do

	$ ypcat services.byname|grep telnet

	telnet/tcp is not shown.

>Fix:
	
	The problem seems to be that the services.byname database
	is being created with only the service name as a key: the
	effect being that when the upd service is added, it overwrites
	the tcp service with the same name.  I don't know enough about
	NIS to fix this myself, but it sounds like upd or tcp need
	to be encoded in the database key.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: wpaul 
State-Changed-When: Sat Dec 9 11:25:19 PST 1995 
State-Changed-Why:  
Fixed in latest version of /usr/src/gnu/usr.sbin/ypserv/Makefile.yp. 
Here is a quick patch for the benefit of the bug filer: 

4c4 
< # $Id: Makefile.yp,v 1.12 1995/10/26 18:00:35 wpaul Exp $ 
--- 
> # $Id: Makefile.yp,v 1.13 1995/12/09 19:25:00 wpaul Exp $ 
296,298c296,297 
< 	   '$$1 !~ "#"  { print $$1"t"$$0;  
< 			  for (n=3; n<=NF && $$n !~ "#"; n++)  
< 			      print $$n"t"$$0  
--- 
> 	   '$$1 !~ "#"  { if (index($$2,"udp")) { printf("%s/udp",$$1) }  
> 			  else { printf("%s/tcp",$$1) }; print "t"$$0  
>Unformatted:
David Hovemeyer
