Bug 636992

Summary: /etc/init.d/ypbind script fails to determine NIS domain if there are multiple lines placed in /etc/yp.conf by DHCP
Product: [Fedora] Fedora Reporter: Jonathan Abbey <jonabbey>
Component: ypbindAssignee: Karel Klíč <kklic>
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 13CC: kklic, rvokal
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-11-19 20:46:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Fixed version of /etc/init.d/ypbind none

Description Jonathan Abbey 2010-09-23 21:40:37 UTC
Description of problem:

The /etc/init.d/ypbind script fails if there are multiple lines placed
in /etc/yp.conf by DHCP, as when there are multiple NIS servers on the network,
when DOMAINNAME is not specified in /etc/sysconfig/network.

Version-Release number of selected component (if applicable):

ypbind-1.31-3.fc13.x86_64


How reproducible:

Let's say we have an /etc/yp.conf that looks like this:

# generated by /sbin/dhclient-script
domain arlut server 10.4.1.6
domain arlut server 10.4.1.23

The /etc/init.d/ypbind script has this excerpt:

NISDOMAIN=`grep "domain" /etc/yp.conf | grep -v ^# | \
  awk '{print $2}'`

the problem with this is that when yp.conf has multiple NIS server lines as above, NISDOMAIN is set to

"arlut
arlut"

which is invalid.  The domain name is not set to anything sensible, and ypbind
fails on boot.


Steps to Reproduce:
1. Set up a system without letting firstboot set up NIS at first (I needed to
boot the system once under Fedora to get access to the ethernet MAC address before I could actually connect the system to our network).
2. Neglect to set NISDOMAIN in /etc/sysconfig/network
3. Expect to have the /etc/init.d/ypbind script determine the domain name from /etc/yp.conf as a fall-back
  
Actual results:

The /etc/init.d/ypbind script fails to extract a proper domain name, and thus fails to bring up the system with NIS correctly.

Expected results:

/etc/init.d/ypbind will successfully extract the domain name from the /etc/yp.conf server and bring up the system with NIS correctly

Additional info:

The line that attempts to determine the NIS domain name can be fixed by changing

NISDOMAIN=`grep "domain" /etc/yp.conf | grep -v ^# | \
  awk '{print $2}'`

to

NISDOMAIN=`grep "domain" /etc/yp.conf | grep -v ^# | \
  awk '{print $2}' | head -1`

Comment 1 Jonathan Abbey 2010-09-23 21:49:54 UTC
Alternately, perhaps /etc/init.d/ypbind could give up attempting to determine the NIS domain itself entirely?  The current version tries to work without DOMAINNAME in /etc/sysconfig/network and fails in the attempt.

Comment 2 Jonathan Abbey 2010-09-23 21:54:31 UTC
Created attachment 449312 [details]
Fixed version of /etc/init.d/ypbind

Comment 3 Karel Klíč 2010-11-19 20:46:27 UTC

*** This bug has been marked as a duplicate of bug 601296 ***