Bug 751427 - ypinit incorrectly identifies domainname when none is set.
Summary: ypinit incorrectly identifies domainname when none is set.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: ypserv
Version: 15
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Honza Horak
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-11-04 17:16 UTC by Shannon Petry
Modified: 2011-12-10 19:45 UTC (History)
2 users (show)

Fixed In Version: ypserv-2.26-8.fc16
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-12-10 19:39:09 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
Modified ypinit script (4.04 KB, patch)
2011-11-04 17:59 UTC, Shannon Petry
no flags Details | Diff

Description Shannon Petry 2011-11-04 17:16:59 UTC
Description of problem: ypinit does not properly detect cases where a domainname is not set.  


Version-Release number of selected component (if applicable):ypbind-1.32-8.fc15.1


How reproducible: do not set domain name, or unset domain name.  run "ypinit -m".  Directory structure called "(none)" shows in /var/yp, domainname returns "(none)"


Steps to Reproduce:
1.  Vanilla System
2.  Run "ypinit -m"
3.  Test "domainname" and directory structure in /var/yp
  
Actual results: domainname returns "(none)", maps will attempt to be built under "(none)" directory in /var/yp.


Expected results:  ypinit should exit with the proper message of "Domain Name not set"


Additional info:  Will submit updated script to package owner possibly correcting the issue.

Comment 1 Shannon Petry 2011-11-04 17:51:25 UTC
[spetry@nyfinhost1 ~]$ git diff ypinit ./ypinit
diff --git a/ypinit b/ypinit
index 3c0dc1c..c76c849 100755
--- a/ypinit
+++ b/ypinit
@@ -149,15 +149,14 @@ then
        exit 1
 fi

-DOMAIN=`domainname`
-if [ $? -ne 0 ]
-then
-       echo "Can't find domainname. Please fix your PATH"
+if [ -x /bin/domainname ] ; then
+       DOMAIN=`domainname`
+else
+       echo "'domainname' command not found. Exiting."
        exit 1
 fi

-if [ -z "$DOMAIN" ]
-then
+if [ "${DOMAIN}x" = "x" ] || [ "${DOMAIN}" = "(none)" ] ; then
        echo "The local host's domain name hasn't been set.  Please set it."
        exit 1
 fi

Comment 2 Shannon Petry 2011-11-04 17:59:22 UTC
Created attachment 531826 [details]
Modified ypinit script

diff is included in comments.

Comment 3 Shannon Petry 2011-11-04 22:48:01 UTC
It would be relatively easy for me to change the ypinit script to read in /etc/sysconfig/network to determine if NISDOMAIN or YPDOMAIN is set.  An option of setting the domain name inside the script could be presented to the user.

In addition, I would also be able to add functionality to the ypinit script to update the NISDOMAIN in /etc/sysconfig/network, similar to Sun's original functionality with ypinit where an /etc/defaultdomain is created.  This would record the settings for next boot without manual intervention.

Please let me know if you want me to proceed with the additions.

Comment 4 Honza Horak 2011-11-25 14:48:04 UTC
Hi Shannon, 

thanks for the suggested fix. I've already applied the following change into Rawhide and will update it in f16 soon:

-if [ -z "$DOMAIN" ]
+if [ "${DOMAIN}x" = "x" ] || [ "${DOMAIN}" = "(none)" ]

However, I don't think it is really necessary to apply the other one, since I don't see any use case when it should help something. If you do, describe the use case a bit, please.

Comment 5 Fedora Update System 2011-11-28 09:53:33 UTC
ypserv-2.26-7.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/ypserv-2.26-7.fc16

Comment 6 Fedora Update System 2011-11-28 11:15:24 UTC
ypserv-2.24-6.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/ypserv-2.24-6.fc15

Comment 7 Fedora Update System 2011-11-28 11:47:46 UTC
ypserv-2.26-8.fc16 has been submitted as an update for Fedora 16.
https://admin.fedoraproject.org/updates/ypserv-2.26-8.fc16

Comment 8 Fedora Update System 2011-11-29 00:08:25 UTC
Package ypserv-2.26-8.fc16:
* should fix your issue,
* was pushed to the Fedora 16 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ypserv-2.26-8.fc16'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2011-16503/ypserv-2.26-8.fc16
then log in and leave karma (feedback).

Comment 9 Fedora Update System 2011-12-10 19:39:09 UTC
ypserv-2.24-6.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 10 Fedora Update System 2011-12-10 19:45:29 UTC
ypserv-2.26-8.fc16 has been pushed to the Fedora 16 stable repository.  If problems still persist, please make note of it in this bug report.


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