diff mbox series

common/rc: fix check for yp

Message ID 20181012115055.15416-1-jthumshirn@suse.de (mailing list archive)
State New, archived
Headers show
Series common/rc: fix check for yp | expand

Commit Message

Johannes Thumshirn Oct. 12, 2018, 11:50 a.m. UTC
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@suse.de>
---
 common/rc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff mbox series

Patch

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 $?
 }