[PATCH] common/rc: fix check for yp

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



Only testing if a domainname is set and ypcat is installed is not a
sufficient criteria to check if NIS is actually active.

Check for a running ypbind in rpcinfo as well.

Signed-off-by: Johannes Thumshirn <jthumshirn@xxxxxxx>
---
 common/rc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index d5bb1feee2c3..1882f970a508 100644
--- a/common/rc
+++ b/common/rc
@@ -1988,7 +1988,9 @@ _yp_active()
 	local dn
 	dn=$(domainname 2>/dev/null)
 	local ypcat=$(type -P ypcat)
-	test -n "${dn}" -a "${dn}" != "(none)" -a "${dn}" != "localdomain" -a -n "${ypcat}"
+	local rpcinfo=$(type -P rpcinfo)
+	test -n "${dn}" -a "${dn}" != "(none)" -a "${dn}" != "localdomain" -a -n "${ypcat}" -a -n "${rpcinfo}" && \
+		"${rpcinfo}" -p localhost 2>/dev/null | grep -q ypbind
 	echo $?
 }
 
-- 
2.16.4




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux