Bug 636992 - /etc/init.d/ypbind script fails to determine NIS domain if there are multiple lines placed in /etc/yp.conf by DHCP
Summary: /etc/init.d/ypbind script fails to determine NIS domain if there are multiple...
Keywords:
Status: CLOSED DUPLICATE of bug 601296
Alias: None
Product: Fedora
Classification: Fedora
Component: ypbind
Version: 13
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Karel Klíč
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2010-09-23 21:40 UTC by Jonathan Abbey
Modified: 2013-03-03 23:01 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-11-19 20:46:27 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Fixed version of /etc/init.d/ypbind (4.68 KB, text/plain)
2010-09-23 21:54 UTC, Jonathan Abbey
no flags Details

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 ***


Note You need to log in before you can comment on or make changes to this bug.