1#!/bin/ksh 2# 3# $OpenBSD: yppasswdd,v 1.6 2018/01/11 21:09:26 rpe Exp $ 4 5daemon="/usr/sbin/rpc.yppasswdd" 6 7. /etc/rc.d/rc.subr 8 9rc_reload=NO 10 11rc_pre() { 12 [[ -n $(domainname) && -d /var/yp/$(domainname) ]] || 13 return 1 14 _host1=$(ypwhich -m passwd 2> /dev/null) 15 _host2=$(hostname) 16 if [[ $(grep '^lookup' /etc/resolv.conf | grep yp | wc -c) -ne 0 ]]; then 17 _host1=$(ypmatch $_host1 hosts | cut -d' ' -f2) 18 _host2=$(ypmatch $_host2 hosts | cut -d' ' -f2 | head -1) 19 else 20 _host1=$(echo $_host1 | nslookup | grep '^Name: ' | 21 sed -e 's/^Name: //') 22 _host2=$(echo $_host2 | nslookup | grep '^Name: ' | 23 sed -e 's/^Name: //') 24 fi 25 [[ $_host2 == $_host1 ]] 26} 27 28rc_cmd $1 29