* [PATCH] xfstests: fix NIS detection damage
@ 2010-08-06 1:18 Dave Chinner
2010-08-06 13:03 ` Christoph Hellwig
2010-08-10 13:44 ` Kinzel, David
0 siblings, 2 replies; 4+ messages in thread
From: Dave Chinner @ 2010-08-06 1:18 UTC (permalink / raw)
To: xfs
From: Dave Chinner <dchinner@redhat.com>
NIS detection wasn't tested on machines without NIS enabled, so many tests are
failing on non-NIS machines. the _yp_active function has no specific return
value so always evaluates as 0 (active) and the "_cat_passwd" function is
called from within an awk script which is not valid as the shell may run with a
sanitised environment. Hence the functions do not need specific export calls,
either, as unsanitised subshells will automatically inherit the parent's
environment.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
common.attr | 9 +++++++--
common.rc | 6 +++---
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/common.attr b/common.attr
index 51616bc..6ba0b32 100644
--- a/common.attr
+++ b/common.attr
@@ -90,10 +90,14 @@ _create_n_aces()
#
_filter_aces()
{
- $AWK_PROG '
+ tmp_file=`mktemp /tmp/ace.XXXXXX`
+
+ (_cat_passwd; _cat_group) > $tmp_file
+
+ $AWK_PROG -v tmpfile=$tmp_file '
BEGIN {
FS=":"
- while ( "_cat_passwd" | getline > 0 ) {
+ while ( getline <tmpfile > 0 ) {
idlist[$1] = $3
}
}
@@ -102,6 +106,7 @@ _filter_aces()
/^default:user/ { if ($3 in idlist) sub($3, idlist[$3]); print; next}
{print}
'
+ rm -f $tmp_file
}
_filter_aces_notypes()
diff --git a/common.rc b/common.rc
index e0cdfe6..08d4f71 100644
--- a/common.rc
+++ b/common.rc
@@ -800,13 +800,14 @@ _yp_active()
local dn
dn=$(domainname 2>/dev/null)
test -n "${dn}" -a "${dn}" != "(none)"
+ echo $?
}
# cat the password file
#
_cat_passwd()
{
- [ _yp_active ] && ypcat passwd
+ [ $(_yp_active) -eq 0 ] && ypcat passwd
cat /etc/passwd
}
@@ -814,10 +815,9 @@ _cat_passwd()
#
_cat_group()
{
- [ _yp_active ] && ypcat group
+ [ $(_yp_active) -eq 0 ] && ypcat group
cat /etc/group
}
-export -f _yp_active _cat_passwd _cat_group
# check for the fsgqa user on the machine
#
--
1.7.1
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] xfstests: fix NIS detection damage
2010-08-06 1:18 [PATCH] xfstests: fix NIS detection damage Dave Chinner
@ 2010-08-06 13:03 ` Christoph Hellwig
2010-08-10 13:44 ` Kinzel, David
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2010-08-06 13:03 UTC (permalink / raw)
To: Dave Chinner; +Cc: xfs
On Fri, Aug 06, 2010 at 11:18:39AM +1000, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> NIS detection wasn't tested on machines without NIS enabled, so many tests are
> failing on non-NIS machines. the _yp_active function has no specific return
> value so always evaluates as 0 (active) and the "_cat_passwd" function is
> called from within an awk script which is not valid as the shell may run with a
> sanitised environment. Hence the functions do not need specific export calls,
> either, as unsanitised subshells will automatically inherit the parent's
> environment.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
Looks good,
Reviewed-by: Christoph Hellwig <hch@lst.de>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] xfstests: fix NIS detection damage
2010-08-06 1:18 [PATCH] xfstests: fix NIS detection damage Dave Chinner
2010-08-06 13:03 ` Christoph Hellwig
@ 2010-08-10 13:44 ` Kinzel, David
2010-08-10 23:19 ` Dave Chinner
1 sibling, 1 reply; 4+ messages in thread
From: Kinzel, David @ 2010-08-10 13:44 UTC (permalink / raw)
To: xfs
Dave Chinner <dchinner@redhat.com> said,
>
>NIS detection wasn't tested on machines without NIS enabled,
>so many tests are
>failing on non-NIS machines. the _yp_active function has no
>specific return
>value so always evaluates as 0 (active) and the "_cat_passwd"
>function is
>called from within an awk script which is not valid as the
>shell may run with a
>sanitised environment. Hence the functions do not need
>specific export calls,
>either, as unsanitised subshells will automatically inherit
>the parent's
>environment.
>
Is there any reason why getent passwd/group cannot be used for these, as
it would get local and nss defined accounts? This would add support for
people using LDAP as well.
>Signed-off-by: Dave Chinner <dchinner@redhat.com>
>---
> common.attr | 9 +++++++--
> common.rc | 6 +++---
> 2 files changed, 10 insertions(+), 5 deletions(-)
>
>diff --git a/common.attr b/common.attr
>index 51616bc..6ba0b32 100644
>--- a/common.attr
>+++ b/common.attr
>@@ -90,10 +90,14 @@ _create_n_aces()
> #
> _filter_aces()
> {
>- $AWK_PROG '
>+ tmp_file=`mktemp /tmp/ace.XXXXXX`
>+
>+ (_cat_passwd; _cat_group) > $tmp_file
>+
>+ $AWK_PROG -v tmpfile=$tmp_file '
> BEGIN {
> FS=":"
>- while ( "_cat_passwd" | getline > 0 ) {
>+ while ( getline <tmpfile > 0 ) {
> idlist[$1] = $3
> }
> }
>@@ -102,6 +106,7 @@ _filter_aces()
> /^default:user/ { if ($3 in idlist) sub($3,
>idlist[$3]); print; next}
> {print}
> '
>+ rm -f $tmp_file
> }
>
> _filter_aces_notypes()
>diff --git a/common.rc b/common.rc
>index e0cdfe6..08d4f71 100644
>--- a/common.rc
>+++ b/common.rc
>@@ -800,13 +800,14 @@ _yp_active()
> local dn
> dn=$(domainname 2>/dev/null)
> test -n "${dn}" -a "${dn}" != "(none)"
>+ echo $?
> }
>
> # cat the password file
> #
> _cat_passwd()
> {
>- [ _yp_active ] && ypcat passwd
>+ [ $(_yp_active) -eq 0 ] && ypcat passwd
> cat /etc/passwd
> }
>
>@@ -814,10 +815,9 @@ _cat_passwd()
> #
> _cat_group()
> {
>- [ _yp_active ] && ypcat group
>+ [ $(_yp_active) -eq 0 ] && ypcat group
> cat /etc/group
> }
>-export -f _yp_active _cat_passwd _cat_group
>
> # check for the fsgqa user on the machine
> #
>--
>1.7.1
>
>_______________________________________________
>xfs mailing list
>xfs@oss.sgi.com
>http://oss.sgi.com/mailman/listinfo/xfs
>
This email communication and any files transmitted with it may contain confidential and or proprietary information and is provided for the use of the intended recipient only. Any review, retransmission or dissemination of this information by anyone other than the intended recipient is prohibited. If you receive this email in error, please contact the sender and delete this communication and any copies immediately. Thank you.
http://www.encana.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] xfstests: fix NIS detection damage
2010-08-10 13:44 ` Kinzel, David
@ 2010-08-10 23:19 ` Dave Chinner
0 siblings, 0 replies; 4+ messages in thread
From: Dave Chinner @ 2010-08-10 23:19 UTC (permalink / raw)
To: Kinzel, David; +Cc: xfs
On Tue, Aug 10, 2010 at 07:44:10AM -0600, Kinzel, David wrote:
> Dave Chinner <dchinner@redhat.com> said,
> >
> >NIS detection wasn't tested on machines without NIS enabled,
> >so many tests are
> >failing on non-NIS machines. the _yp_active function has no
> >specific return
> >value so always evaluates as 0 (active) and the "_cat_passwd"
> >function is
> >called from within an awk script which is not valid as the
> >shell may run with a
> >sanitised environment. Hence the functions do not need
> >specific export calls,
> >either, as unsanitised subshells will automatically inherit
> >the parent's
> >environment.
> >
>
> Is there any reason why getent passwd/group cannot be used for these, as
> it would get local and nss defined accounts? This would add support for
> people using LDAP as well.
If you want your test box to use this stuff, then feel free to
submit patches that support this.
In general, though, I think that running anything other than a
single user account on a filesystem test box is not necessary - you
don't want random users to be able to log in to the machine you are
running potentially destructive tests on.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-08-10 23:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 1:18 [PATCH] xfstests: fix NIS detection damage Dave Chinner
2010-08-06 13:03 ` Christoph Hellwig
2010-08-10 13:44 ` Kinzel, David
2010-08-10 23:19 ` Dave Chinner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox