[ypbind] Fixed ypbind-post-waitbind to stop the service when binding is not success

Jan Horak hhorak at fedoraproject.org
Mon Nov 21 07:18:14 UTC 2011


commit fe120cda2f3ffab5622a120143a0d4bd99e0f3b5
Author: Honza HorĂ¡k <hhorak at redhat.com>
Date:   Wed Nov 16 17:26:25 2011 +0100

    Fixed ypbind-post-waitbind to stop the service when binding is not success

 ypbind-post-waitbind |   22 +++++++++++++++++-----
 ypbind.spec          |    5 ++++-
 2 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/ypbind-post-waitbind b/ypbind-post-waitbind
index 1c3787c..7f803b0 100755
--- a/ypbind-post-waitbind
+++ b/ypbind-post-waitbind
@@ -16,12 +16,14 @@ logger -t ypbind $"Binding NIS service"
 
 timeout=$NISTIMEOUT
 firsttime=1
+rpcbound=0
 SECONDS=0
 retval=0
 while [ $SECONDS -lt $timeout ] || [ $firsttime -eq 1 ] ; do
+firsttime=0
 if /usr/sbin/rpcinfo -p | LC_ALL=C fgrep -q ypbind
 then
-    firsttime=0
+    rpcbound=1
     /usr/bin/ypwhich > /dev/null 2>&1
     retval=$?
     if [ $retval -eq 0 ]; then
@@ -34,10 +36,20 @@ done
 logger -t ypbind "Binding took $SECONDS seconds"
 
 if [ $retval -eq 0 ]; then
-logger -t ypbind \
-    "NIS domain: `domainname`, NIS server: `ypwhich 2> /dev/null`"
+    if [ $rpcbound -eq 0 ]; then
+        logger -t ypbind \
+            "NIS domain: `domainname`, ypbind not registered with rpcbind."
+    else
+        logger -t ypbind \
+            "NIS domain: `domainname`, NIS server: `ypwhich 2> /dev/null`"
+fi
 else
-logger -t ypbind \
-    "NIS server for domain `domainname` is not responding."
+    logger -t ypbind \
+        "NIS server for domain `domainname` is not responding."
+    logger -t ypbind \
+        "Killing ypbind with PID $MAINPID."
+    kill SIGTERM $MAINPID
 fi
 
+exit $retval
+
diff --git a/ypbind.spec b/ypbind.spec
index 4838326..cdcbed6 100644
--- a/ypbind.spec
+++ b/ypbind.spec
@@ -1,7 +1,7 @@
 Summary: The NIS daemon which binds NIS clients to an NIS domain
 Name: ypbind
 Version: 1.33
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPLv2
 Group: System Environment/Daemons
 Source0: ftp://ftp.us.kernel.org/pub/linux/utils/net/NIS/ypbind-mt-%{version}.tar.bz2
@@ -117,6 +117,9 @@ fi
 %doc README NEWS COPYING
 
 %changelog
+* Wed Nov 16 2011 Honza Horak <hhorak at redhat.com> - 3:1.33-9
+- Fixed ypbind-post-waitbind to stop the service when binding is not success
+
 * Tue Nov 15 2011 Honza Horak <hhorak at redhat.com> - 3:1.33-8
 - Fixed ypbind-post-waitbind to handle long rpcinfo requests
   Resolves: #624688


More information about the scm-commits mailing list