file=$testdir/$seq.file
user=`grep ':all=:all=' /etc/capability | tail -1 | $AWK_PROG -F: '{print $1}'`
-uid=`grep $user /etc/passwd | $AWK_PROG -F: '{print $3}'`
+uid=`_cat_passwd | grep $user | $AWK_PROG -F: '{print $3}'`
cat >$tmp.append <<EOF
#!/bin/bash
#
_acl_setup_ids()
{
- eval `cat /etc/passwd /etc/group | awk -F: '
+ eval `(_cat_passwd; _cat_group) | awk -F: '
{ ids[$3]=1 }
END {
j=1
$AWK_PROG '
BEGIN {
FS=":"
- while ( getline <"/etc/passwd" > 0 ) {
+ while ( "_cat_passwd" | getline > 0 ) {
idlist[$1] = $3
}
}
#
_require_nobody()
{
- grep -q '^nobody' /etc/passwd
- [ $? -ne 0 ] && _notrun "/etc/passwd does not contain user nobody."
+ _cat_passwd | grep -q '^nobody'
+ [ $? -ne 0 ] && _notrun "password file does not contain user nobody."
- egrep -q '^no(body|group)' /etc/group
- [ $? -ne 0 ] && _notrun "/etc/group does not contain nobody/nogroup."
+ _cat_group | egrep -q '^no(body|group)'
+ [ $? -ne 0 ] && _notrun "group file does not contain nobody/nogroup."
}
# create a file as a specific user (uid)
_choose_uid()
{
- grep '^nobody' /etc/passwd | perl -ne '@a = split(/:/); END { printf "id=%d name=%s\n", $a[2],$a[0] }'
+ _cat_passwd | grep '^nobody' | perl -ne '@a = split(/:/); END { printf "id=%d name=%s\n", $a[2],$a[0] }'
}
_choose_gid()
{
- egrep '^no(body|group)' /etc/group | perl -ne '@a = split(/:/); END { printf "id=%d name=%s\n", $a[2],$a[0] }'
+ _cat_group | egrep '^no(body|group)' | perl -ne '@a = split(/:/); END { printf "id=%d name=%s\n", $a[2],$a[0] }'
}
_choose_prid()
_notrun "External device testing in progress, skipped this test"
}
+# indicate whether YP/NIS is active or not
+#
+_yp_active()
+{
+ local dn
+ dn=$(domainname 2>/dev/null)
+ test -n "${dn}" -a "${dn}" != "(none)"
+}
+
+# cat the password file
+#
+_cat_passwd()
+{
+ [ _yp_active ] && ypcat passwd
+ cat /etc/passwd
+}
+
+# cat the group file
+#
+_cat_group()
+{
+ [ _yp_active ] && ypcat group
+ cat /etc/group
+}
+export -f _yp_active _cat_passwd _cat_group
+
# check for the fsgqa user on the machine
#
_require_user()
{
qa_user=fsgqa
- cat /etc/passwd | grep -q $qa_user
+ _cat_passwd | grep -q $qa_user
[ "$?" == "0" ] || _notrun "$qa_user user not defined."
}