Skip to contentSkip to conversation

say FAIL not PASS when we failed

PATCH In review Serge E. Hallyn 2 participants 10 messages Jan 4, 2010 – Jan 6, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 say FAIL not PASS when we failed

---
 testcases/kernel/security/p9auth/p9priv.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +1 -1
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done
 touch $LTPTMP/childgo
 while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
 if [ -f $LTPTMP/d/childpass ]; then
-	echo "PASS: child could setuid from wrong source uid"
+	echo "FAIL: child could setuid from wrong source uid"
 	exit 1
 fi
 echo "PASS: child couldn't setuid from wrong source uid"
Signature · 13 lines
1.6.1.1


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 18 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/ renamed from testcases/kernel/security/p9auth/p9priv.sh +0 -0

kernel/security/p9auth/p9priv.sh
index ad2eead..c1a14d0 100755

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "PASS: child could setuid from wrong source uid"
+    echo "FAIL: child could setuid from wrong source uid"
   exit 1
Quoted 4 lines

fi
echo "PASS: child couldn't setuid from wrong source uid"

Signature · 1 line
1.6.1.1

Is there a reason why this isn't using tst_resm?
Thanks,
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#2 lore raw
Quoted 18 lines · Garrett Cooper
Quoted 16 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +0 -0
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then
- echo "PASS: child could setuid from wrong source uid"

Quoted 8 lines
Quoted 6 lines

+ echo "FAIL: child could setuid from wrong source uid"
exit 1
fi
echo "PASS: child couldn't setuid from wrong source uid"

Signature · 1 line
1.6.1.1

Is there a reason why this isn't using tst_resm?

No good reason

thanks,
-serge

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#3 lore raw
Quoted 29 lines · Serge E. Hallyn
Quoted 19 lines · Garrett Cooper
Quoted 16 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +0 -0
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then
- echo "PASS: child could setuid from wrong source uid"

Quoted 8 lines
Quoted 6 lines

+ echo "FAIL: child could setuid from wrong source uid"
exit 1
fi
echo "PASS: child couldn't setuid from wrong source uid"

Signature · 1 line
1.6.1.1

Is there a reason why this isn't using tst_resm?

Quoted 1 line

No good reason

Could this be converted then :)?
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#4 lore raw
Quoted 31 lines · Garrett Cooper
Quoted 29 lines · Serge E. Hallyn
Quoted 27 lines · Garrett Cooper
Quoted 17 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +0 -0
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "PASS: child could setuid from wrong source uid"
+    echo "FAIL: child could setuid from wrong source uid"
Quoted 5 lines

exit 1
fi
echo "PASS: child couldn't setuid from wrong source uid"

Signature · 1 line
1.6.1.1

Is there a reason why this isn't using tst_resm?

Quoted 3 lines
Quoted 1 line

No good reason

Could this be converted then :)?

This appears to work.

thanks,
-serge

From 05713db9e0db910fa2fdfa85c452f0be8d820e8c Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

---
 testcases/kernel/security/p9auth/p9priv.sh   |   25 ++++++++++++++++---------
 testcases/kernel/security/p9auth/p9unpriv.sh |    2 +-
 2 files changed, 17 insertions(+), 10 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +16 -9
index c1a14d0..0f3ea7e 100755
@@ -19,7 +19,12 @@
 ##                                                                            ##
 ################################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export LTPTMP=/tmp/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+
 rm -rf $LTPTMP
 mkdir $LTPTMP
 chmod 755 $LTPTMP
@@ -37,14 +42,14 @@ cleanup() {
 }
 
 if [ `id -u` -ne 0 ]; then
-	echo "Must start p9auth tests as root"
+	tst_resm TBROK "Must start p9auth tests as root"
 	exit 1
 fi
 
 ltpuid=`grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '}`
 ret=$?
 if [ $? -ne 0 ]; then
-	echo "Failed to find ltp userid"
+	tst_resm TCONF "Failed to find ltp userid"
 	exit 1
 fi
 
@@ -57,12 +62,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done
 touch $LTPTMP/childgo
 while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
 if [ -f $LTPTMP/d/childpass ]; then
-	echo "FAIL: child could setuid with bad hash"
+	tst_resm TFAIL "FAIL: child could setuid with bad hash"
 	exit 1
 fi
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "PASS: child couldn't setuid with bad hash"
 
 # TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2
 
 # create the hash.  randstr doesn't have to be int, but it's ok
 cleanup
@@ -80,12 +86,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done
 touch $LTPTMP/childgo
 while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
 if [ -f $LTPTMP/d/childfail ]; then
-	echo "FAIL: child couldn't setuid with good hash"
+	tst_resm TFAIL "FAIL: child couldn't setuid with good hash"
 	exit 1
 fi
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "PASS: child could setuid with good hash"
 
 # TEST 3: 0 setuids to 0 with hash valid for ltp user
+export TST_COUNT=3
 cleanup
 randstr=$RANDOM
 txt="0@0"
@@ -101,10 +108,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done
 touch $LTPTMP/childgo
 while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
 if [ -f $LTPTMP/d/childpass ]; then
-	echo "FAIL: child could setuid from wrong source uid"
+	tst_resm TFAIL "FAIL: child could setuid from wrong source uid"
 	exit 1
 fi
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "PASS: child couldn't setuid from wrong source uid"
 
 touch $LTPTMP/childexit
 
testcases/kernel/security/p9auth/p9unpriv.sh +1 -1
index 077b8ac..894b3c4 100755
@@ -27,7 +27,7 @@ echo ltptmp is $LTPTMP
 
 myuid=`id -u`
 if [ "$myuid" -eq 0 ]; then
-	echo "Unprivileged child was started as root!"
+	tst_resm TBROK "Unprivileged child was started as root!"
 	exit 1
 fi
 
Signature · 13 lines
1.6.1.1


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#5 lore raw

Sent from my iPhone

Quoted 159 lines · Serge E. Hallyn
Quoted 33 lines · Garrett Cooper
Quoted 30 lines · Serge E. Hallyn
Quoted 28 lines · Garrett Cooper
Quoted 18 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +0 -0
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ]; do :;  

done
touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "PASS: child could setuid from wrong source uid"
+    echo "FAIL: child could setuid from wrong source uid"
Quoted 5 lines

exit 1
fi
echo "PASS: child couldn't setuid from wrong source uid"

Signature · 1 line
1.6.1.1

Is there a reason why this isn't using tst_resm?

Quoted 3 lines
Quoted 1 line

No good reason

Could this be converted then :)?

This appears to work.

thanks,
-serge

From 05713db9e0db910fa2fdfa85c452f0be8d820e8c Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

---
testcases/kernel/security/p9auth/p9priv.sh | 25 +++++++++++++++

+---------
testcases/kernel/security/p9auth/p9unpriv.sh |    2 +-
2 files changed, 17 insertions(+), 10 deletions(-)
testcases/ renamed from testcases/kernel/security/p9auth/p9priv.sh +0 -0

kernel/security/p9auth/p9priv.sh
index c1a14d0..0f3ea7e 100755

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -19,7 +19,12 @@
 ##  
 
 
 
 ##
 ### 
 ### 

###
###
####################################################################

testcases/kernel/security/p9auth/p9priv.sh +6 -1
-LTPTMP=/tmp/p9auth_ltp
+export LTPTMP=/tmp/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+

rm -rf $LTPTMP
mkdir $LTPTMP
chmod 755 $LTPTMP

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -37,14 +42,14 @@ cleanup() {
 }
 

if [ id -u -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Must start p9auth tests as root"
+    tst_resm TBROK "Must start p9auth tests as root"
   exit 1

fi

ltpuid=grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '} ret=$?
if [ $? -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Failed to find ltp userid"
+    tst_resm TCONF "Failed to find ltp userid"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -57,12 +62,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid with bad hash"
+    tst_resm TFAIL "FAIL: child could setuid with bad hash"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "PASS: child couldn't setuid with bad hash"

# TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2

# create the hash.  randstr doesn't have to be int, but it's ok
cleanup
testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -80,12 +86,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childfail ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child couldn't setuid with good hash"
+    tst_resm TFAIL "FAIL: child couldn't setuid with good hash"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "PASS: child could setuid with good hash"

# TEST 3: 0 setuids to 0 with hash valid for ltp user +export TST_COUNT=3
cleanup
randstr=$RANDOM
txt="0@0"

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -101,10 +108,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid from wrong source uid"
+    tst_resm TFAIL "FAIL: child could setuid from wrong source uid"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "PASS: child couldn't setuid from wrong source uid"

touch $LTPTMP/childexit

(quoted diff) renamed from testcases/kernel/security/p9auth/p9unpriv.sh +0 -0

testcases/kernel/security/p9auth/p9unpriv.sh
index 077b8ac..894b3c4 100755

testcases/kernel/security/p9auth/p9unpriv.sh +0 -0
@@ -27,7 +27,7 @@ echo ltptmp is $LTPTMP
 

myuid=id -u
if [ "$myuid" -eq 0 ]; then

testcases/kernel/security/p9auth/p9unpriv.sh +1 -1
-    echo "Unprivileged child was started as root!"
+    tst_resm TBROK "Unprivileged child was started as root!"
   exit 1
Quoted 4 lines

fi

Signature · 1 line
1.6.1.1

The patch is very close. /tmp -> TMPDIR=${TMPDIR:-/tmp} will do the trick.
Also, eith the new changes PASS: / FAIL: shouldn't be required because the result is inline with the printout.
Thanks!
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#6 lore raw
Quoted 159 lines · Garrett Cooper

Sent from my iPhone

Quoted 155 lines · Serge E. Hallyn
Quoted 33 lines · Garrett Cooper
Quoted 30 lines · Serge E. Hallyn
Quoted 28 lines · Garrett Cooper
Quoted 18 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +0 -0
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ];

do :; done
touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "PASS: child could setuid from wrong source uid"
+    echo "FAIL: child could setuid from wrong source uid"
Quoted 5 lines

exit 1
fi
echo "PASS: child couldn't setuid from wrong source uid"

Signature · 1 line
1.6.1.1

Is there a reason why this isn't using tst_resm?

Quoted 3 lines
Quoted 1 line

No good reason

Could this be converted then :)?

This appears to work.

thanks,
-serge

From 05713db9e0db910fa2fdfa85c452f0be8d820e8c Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

---
testcases/kernel/security/p9auth/p9priv.sh | 25
++++++++++++++++---------
testcases/kernel/security/p9auth/p9unpriv.sh | 2 +-

2 files changed, 17 insertions(+), 10 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +6 -1
index c1a14d0..0f3ea7e 100755
@@ -19,7 +19,12 @@
 ##
 ##
 ############
 ####################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export LTPTMP=/tmp/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+

rm -rf $LTPTMP
mkdir $LTPTMP
chmod 755 $LTPTMP

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -37,14 +42,14 @@ cleanup() {
 }
 

if [ id -u -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Must start p9auth tests as root"
+    tst_resm TBROK "Must start p9auth tests as root"
  exit 1

fi

ltpuid=grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '} ret=$?
if [ $? -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Failed to find ltp userid"
+    tst_resm TCONF "Failed to find ltp userid"
  exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -57,12 +62,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid with bad hash"
+    tst_resm TFAIL "FAIL: child could setuid with bad hash"
  exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "PASS: child couldn't setuid with bad hash"

# TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2

# create the hash.  randstr doesn't have to be int, but it's ok
cleanup
testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -80,12 +86,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childfail ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child couldn't setuid with good hash"
+    tst_resm TFAIL "FAIL: child couldn't setuid with good hash"
  exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "PASS: child could setuid with good hash"

# TEST 3: 0 setuids to 0 with hash valid for ltp user +export TST_COUNT=3
cleanup
randstr=$RANDOM
txt="0@0"

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -101,10 +108,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid from wrong source uid"
+    tst_resm TFAIL "FAIL: child could setuid from wrong source uid"
  exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "PASS: child couldn't setuid from wrong source uid"

touch $LTPTMP/childexit

(quoted diff) renamed from testcases/kernel/security/p9auth/p9unpriv.sh +0 -0

testcases/kernel/security/p9auth/p9unpriv.sh
index 077b8ac..894b3c4 100755

testcases/kernel/security/p9auth/p9unpriv.sh +0 -0
@@ -27,7 +27,7 @@ echo ltptmp is $LTPTMP
 

myuid=id -u
if [ "$myuid" -eq 0 ]; then

testcases/kernel/security/p9auth/p9unpriv.sh +1 -1
-    echo "Unprivileged child was started as root!"
+    tst_resm TBROK "Unprivileged child was started as root!"
  exit 1

fi

Quoted 9 lines
Quoted 2 lines
Signature · 1 line
1.6.1.1

The patch is very close. /tmp -> TMPDIR=${TMPDIR:-/tmp} will do the trick.
Also, eith the new changes PASS: / FAIL: shouldn't be required because the result is inline with the printout.
Thanks!
-Garrett

New version. (Hope I understood what you meant with tmpdir correctly - and you don't mind me using a subdir of it)

thanks,
-serge

From 85401ac7279276eb46852ba828dc9f0ef2d62873 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

Changelog:
Jan 5: Use ltp's TMPDIR, and don't print redundant 'PASS/FAIL'

---
 testcases/kernel/security/p9auth/p9priv.sh   |   26 +++++++++++++++++---------
 testcases/kernel/security/p9auth/p9unpriv.sh |    5 +++--
 2 files changed, 20 insertions(+), 11 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +17 -9
index c1a14d0..6738600 100755
@@ -19,7 +19,13 @@
 ##                                                                            ##
 ################################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export TMPDIR=${TMPDIR:-/tmp}
+export LTPTMP=${TMPDIR}/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+
 rm -rf $LTPTMP
 mkdir $LTPTMP
 chmod 755 $LTPTMP
@@ -37,14 +43,14 @@ cleanup() {
 }
 
 if [ `id -u` -ne 0 ]; then
-	echo "Must start p9auth tests as root"
+	tst_resm TBROK "Must start p9auth tests as root"
 	exit 1
 fi
 
 ltpuid=`grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '}`
 ret=$?
 if [ $? -ne 0 ]; then
-	echo "Failed to find ltp userid"
+	tst_resm TCONF "Failed to find ltp userid"
 	exit 1
 fi
 
@@ -57,12 +63,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done
 touch $LTPTMP/childgo
 while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
 if [ -f $LTPTMP/d/childpass ]; then
-	echo "FAIL: child could setuid with bad hash"
+	tst_resm TFAIL "child could setuid with bad hash"
 	exit 1
 fi
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "child couldn't setuid with bad hash"
 
 # TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2
 
 # create the hash.  randstr doesn't have to be int, but it's ok
 cleanup
@@ -80,12 +87,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done
 touch $LTPTMP/childgo
 while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
 if [ -f $LTPTMP/d/childfail ]; then
-	echo "FAIL: child couldn't setuid with good hash"
+	tst_resm TFAIL "child couldn't setuid with good hash"
 	exit 1
 fi
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "child could setuid with good hash"
 
 # TEST 3: 0 setuids to 0 with hash valid for ltp user
+export TST_COUNT=3
 cleanup
 randstr=$RANDOM
 txt="0@0"
@@ -101,10 +109,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done
 touch $LTPTMP/childgo
 while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
 if [ -f $LTPTMP/d/childpass ]; then
-	echo "FAIL: child could setuid from wrong source uid"
+	tst_resm TFAIL "child could setuid from wrong source uid"
 	exit 1
 fi
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "child couldn't setuid from wrong source uid"
 
 touch $LTPTMP/childexit
 
testcases/kernel/security/p9auth/p9unpriv.sh +3 -2
index 077b8ac..d42ee8e 100755
@@ -19,7 +19,8 @@
 ##                                                                            ##
 ################################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export TMPDIR=${TMPDIR:-/tmp}
+export LTPTMP=${TMPDIR}/p9auth_ltp
 
 TOUCH=`which touch`
 ID=`which id`
@@ -27,7 +28,7 @@ echo ltptmp is $LTPTMP
 
 myuid=`id -u`
 if [ "$myuid" -eq 0 ]; then
-	echo "Unprivileged child was started as root!"
+	tst_resm TBROK "Unprivileged child was started as root!"
 	exit 1
 fi
 
Signature · 13 lines
1.6.1.1


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#7 lore raw

Sent from my iPhone

Quoted 318 lines · Serge E. Hallyn
Quoted 163 lines · Garrett Cooper

Sent from my iPhone

Quoted 158 lines · Serge E. Hallyn
Quoted 34 lines · Garrett Cooper
Quoted 31 lines · Serge E. Hallyn
Quoted 29 lines · Garrett Cooper
Quoted 19 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +0 -0
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ];

do :; done
touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/ childpass ]; do
:; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "PASS: child could setuid from wrong source uid"
+    echo "FAIL: child could setuid from wrong source uid"
Quoted 5 lines

exit 1
fi
echo "PASS: child couldn't setuid from wrong source uid"

Signature · 1 line
1.6.1.1

Is there a reason why this isn't using tst_resm?

Quoted 3 lines
Quoted 1 line

No good reason

Could this be converted then :)?

This appears to work.

thanks,
-serge

From 05713db9e0db910fa2fdfa85c452f0be8d820e8c Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

---
testcases/kernel/security/p9auth/p9priv.sh | 25
++++++++++++++++---------
testcases/kernel/security/p9auth/p9unpriv.sh | 2 +-

2 files changed, 17 insertions(+), 10 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +6 -1
index c1a14d0..0f3ea7e 100755
@@ -19,7 +19,12 @@
 ##
 ##
 ############
 ####################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export LTPTMP=/tmp/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+

rm -rf $LTPTMP
mkdir $LTPTMP
chmod 755 $LTPTMP

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -37,14 +42,14 @@ cleanup() {
 }
 

if [ id -u -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Must start p9auth tests as root"
+    tst_resm TBROK "Must start p9auth tests as root"
 exit 1

fi

ltpuid=grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '} ret=$?
if [ $? -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Failed to find ltp userid"
+    tst_resm TCONF "Failed to find ltp userid"
 exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -57,12 +62,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid with bad hash"
+    tst_resm TFAIL "FAIL: child could setuid with bad hash"
 exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "PASS: child couldn't setuid with bad hash"

# TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2

# create the hash.  randstr doesn't have to be int, but it's ok
cleanup
testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -80,12 +86,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childfail ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child couldn't setuid with good hash"
+    tst_resm TFAIL "FAIL: child couldn't setuid with good hash"
 exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "PASS: child could setuid with good hash"

# TEST 3: 0 setuids to 0 with hash valid for ltp user +export TST_COUNT=3
cleanup
randstr=$RANDOM
txt="0@0"

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -101,10 +108,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :;  

done
touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid from wrong source uid"
+    tst_resm TFAIL "FAIL: child could setuid from wrong source uid"
 exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "PASS: child couldn't setuid from wrong source uid"

touch $LTPTMP/childexit

(quoted diff) renamed from testcases/kernel/security/p9auth/p9unpriv.sh +0 -0

testcases/kernel/security/p9auth/p9unpriv.sh
index 077b8ac..894b3c4 100755

testcases/kernel/security/p9auth/p9unpriv.sh +0 -0
@@ -27,7 +27,7 @@ echo ltptmp is $LTPTMP
 

myuid=id -u
if [ "$myuid" -eq 0 ]; then

testcases/kernel/security/p9auth/p9unpriv.sh +1 -1
-    echo "Unprivileged child was started as root!"
+    tst_resm TBROK "Unprivileged child was started as root!"
 exit 1

fi

Quoted 9 lines
Quoted 2 lines
Signature · 1 line
1.6.1.1

The patch is very close. /tmp -> TMPDIR=${TMPDIR:-/tmp} will do the trick.
Also, eith the new changes PASS: / FAIL: shouldn't be required because the result is inline with the printout.
Thanks!
-Garrett

New version. (Hope I understood what you meant with tmpdir correctly - and you don't mind me using a subdir of it)

thanks,
-serge

From 85401ac7279276eb46852ba828dc9f0ef2d62873 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

Changelog:
Jan 5: Use ltp's TMPDIR, and don't print redundant 'PASS/FAIL'

---
testcases/kernel/security/p9auth/p9priv.sh | 26 ++++++++++++++++

+---------
testcases/kernel/security/p9auth/p9unpriv.sh |    5 +++--
2 files changed, 20 insertions(+), 11 deletions(-)
testcases/ renamed from testcases/kernel/security/p9auth/p9priv.sh +0 -0

kernel/security/p9auth/p9priv.sh
index c1a14d0..6738600 100755

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -19,7 +19,13 @@
 ##  
 
 
 
 ##
 ### 
 ### 

###
###
####################################################################

testcases/kernel/security/p9auth/p9priv.sh +7 -1
-LTPTMP=/tmp/p9auth_ltp
+export TMPDIR=${TMPDIR:-/tmp}
+export LTPTMP=${TMPDIR}/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+

rm -rf $LTPTMP
mkdir $LTPTMP
chmod 755 $LTPTMP

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -37,14 +43,14 @@ cleanup() {
 }
 

if [ id -u -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Must start p9auth tests as root"
+    tst_resm TBROK "Must start p9auth tests as root"
   exit 1

fi

ltpuid=grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '} ret=$?
if [ $? -ne 0 ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "Failed to find ltp userid"
+    tst_resm TCONF "Failed to find ltp userid"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -57,12 +63,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid with bad hash"
+    tst_resm TFAIL "child could setuid with bad hash"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "child couldn't setuid with bad hash"

# TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2

# create the hash.  randstr doesn't have to be int, but it's ok
cleanup
testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -80,12 +87,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childfail ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child couldn't setuid with good hash"
+    tst_resm TFAIL "child couldn't setuid with good hash"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "child could setuid with good hash"

# TEST 3: 0 setuids to 0 with hash valid for ltp user +export TST_COUNT=3
cleanup
randstr=$RANDOM
txt="0@0"

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -101,10 +109,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-    echo "FAIL: child could setuid from wrong source uid"
+    tst_resm TFAIL "child could setuid from wrong source uid"
   exit 1

fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "child couldn't setuid from wrong source uid"

touch $LTPTMP/childexit

(quoted diff) renamed from testcases/kernel/security/p9auth/p9unpriv.sh +0 -0

testcases/kernel/security/p9auth/p9unpriv.sh
index 077b8ac..d42ee8e 100755

testcases/kernel/security/p9auth/p9unpriv.sh +0 -0
@@ -19,7 +19,8 @@
 ##  
 
 
 
 ##
 ### 
 ### 

###
###
####################################################################

testcases/kernel/security/p9auth/p9unpriv.sh +2 -1
-LTPTMP=/tmp/p9auth_ltp
+export TMPDIR=${TMPDIR:-/tmp}
+export LTPTMP=${TMPDIR}/p9auth_ltp

TOUCH=which touch
ID=which id

testcases/kernel/security/p9auth/p9unpriv.sh +0 -0
@@ -27,7 +28,7 @@ echo ltptmp is $LTPTMP
 

myuid=id -u
if [ "$myuid" -eq 0 ]; then

testcases/kernel/security/p9auth/p9unpriv.sh +1 -1
-    echo "Unprivileged child was started as root!"
+    tst_resm TBROK "Unprivileged child was started as root!"
   exit 1
Quoted 1 line

fi

Perfect -- I'll commit this once I get back home in a few hours! Thanks,
-Garrett

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#8 lore raw
Quoted 304 lines · Garrett Cooper

Sent from my iPhone

Quoted 300 lines · Serge E. Hallyn
Quoted 162 lines · Garrett Cooper

Sent from my iPhone

Quoted 157 lines · Serge E. Hallyn
Quoted 35 lines · Garrett Cooper
Quoted 31 lines · Serge E. Hallyn
Quoted 29 lines · Garrett Cooper
Quoted 15 lines · Serge E. Hallyn

---
testcases/kernel/security/p9auth/p9priv.sh |    2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +0 -0
index ad2eead..c1a14d0 100755
@@ -101,7 +101,7 @@ while [ ! -f $LTPTMP/d/childready ];

do :; done
touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;

Quoted 8 lines

if [ -f $LTPTMP/d/childpass ]; then
-    echo "PASS: child could setuid from wrong source uid"
+    echo "FAIL: child could setuid from wrong source uid" exit 1
fi
echo "PASS: child couldn't setuid from wrong source uid" --
1.6.1.1

Is there a reason why this isn't using tst_resm?

Quoted 3 lines
Quoted 1 line

No good reason

Could this be converted then :)?

This appears to work.

thanks,
-serge

From 05713db9e0db910fa2fdfa85c452f0be8d820e8c Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

---
testcases/kernel/security/p9auth/p9priv.sh   |   25
++++++++++++++++---------
testcases/kernel/security/p9auth/p9unpriv.sh |    2 +-

2 files changed, 17 insertions(+), 10 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +6 -1
index c1a14d0..0f3ea7e 100755
@@ -19,7 +19,12 @@
 ##
 ##
 ############
 ####################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export LTPTMP=/tmp/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+

rm -rf $LTPTMP
mkdir $LTPTMP
chmod 755 $LTPTMP

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -37,14 +42,14 @@ cleanup() {
 }
 

if [ id -u -ne 0 ]; then
-    echo "Must start p9auth tests as root"
+    tst_resm TBROK "Must start p9auth tests as root" exit 1
fi

ltpuid=grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '} ret=$?
if [ $? -ne 0 ]; then
-    echo "Failed to find ltp userid"
+    tst_resm TCONF "Failed to find ltp userid"
 exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -57,12 +62,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then
-    echo "FAIL: child could setuid with bad hash"
+    tst_resm TFAIL "FAIL: child could setuid with bad hash" exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "PASS: child couldn't setuid with bad hash"

# TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2

# create the hash.  randstr doesn't have to be int, but it's ok
cleanup
testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -80,12 +86,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childfail ]; then
-    echo "FAIL: child couldn't setuid with good hash"
+    tst_resm TFAIL "FAIL: child couldn't setuid with good hash" exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "PASS: child could setuid with good hash"

# TEST 3: 0 setuids to 0 with hash valid for ltp user +export TST_COUNT=3
cleanup
randstr=$RANDOM
txt="0@0"

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -101,10 +108,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then
-    echo "FAIL: child could setuid from wrong source uid"
+    tst_resm TFAIL "FAIL: child could setuid from wrong source uid" exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "PASS: child couldn't setuid from wrong source uid"

touch $LTPTMP/childexit

(quoted diff) renamed from testcases/kernel/security/p9auth/p9unpriv.sh +0 -0

testcases/kernel/security/p9auth/p9unpriv.sh
index 077b8ac..894b3c4 100755

testcases/kernel/security/p9auth/p9unpriv.sh +0 -0
@@ -27,7 +27,7 @@ echo ltptmp is $LTPTMP
 

myuid=id -u
if [ "$myuid" -eq 0 ]; then
-    echo "Unprivileged child was started as root!"
+    tst_resm TBROK "Unprivileged child was started as root!" exit 1
fi

Quoted 9 lines
Quoted 2 lines

--
1.6.1.1

The patch is very close. /tmp -> TMPDIR=${TMPDIR:-/tmp} will do the trick.
Also, eith the new changes PASS: / FAIL: shouldn't be required because the result is inline with the printout.
Thanks!
-Garrett

New version.  (Hope I understood what you meant with tmpdir correctly - and you don't mind me using a subdir of it)

thanks,
-serge

From 85401ac7279276eb46852ba828dc9f0ef2d62873 Mon Sep 17 00:00:00 2001
From: Serge E. Hallyn <[email protected]>
Date: Tue, 5 Jan 2010 10:30:11 -0500
Subject: [PATCH 1/1] p9auth: use tst_resm

Changelog:
  Jan 5: Use ltp's TMPDIR, and don't print redundant 'PASS/FAIL'

---
testcases/kernel/security/p9auth/p9priv.sh   |   26
+++++++++++++++++---------
testcases/kernel/security/p9auth/p9unpriv.sh |    5 +++--

2 files changed, 20 insertions(+), 11 deletions(-)
testcases/kernel/security/p9auth/p9priv.sh +7 -1
index c1a14d0..6738600 100755
@@ -19,7 +19,13 @@
 ##
 ##
 
 ################################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export TMPDIR=${TMPDIR:-/tmp}
+export LTPTMP=${TMPDIR}/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+

rm -rf $LTPTMP
mkdir $LTPTMP
chmod 755 $LTPTMP

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -37,14 +43,14 @@ cleanup() {
 }
 

if [ id -u -ne 0 ]; then
-    echo "Must start p9auth tests as root"
+    tst_resm TBROK "Must start p9auth tests as root" exit 1
fi

ltpuid=grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '} ret=$?
if [ $? -ne 0 ]; then
-    echo "Failed to find ltp userid"
+    tst_resm TCONF "Failed to find ltp userid"
  exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -57,12 +63,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then
-    echo "FAIL: child could setuid with bad hash"
+    tst_resm TFAIL "child could setuid with bad hash" exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "child couldn't setuid with bad hash"

# TEST 2: ltp setuids to 0 with valid hash
+export TST_COUNT=2

# create the hash.  randstr doesn't have to be int, but it's ok
cleanup
testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -80,12 +87,13 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childfail ]; then
-    echo "FAIL: child couldn't setuid with good hash"
+    tst_resm TFAIL "child couldn't setuid with good hash" exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "child could setuid with good hash"

# TEST 3: 0 setuids to 0 with hash valid for ltp user +export TST_COUNT=3
cleanup
randstr=$RANDOM
txt="0@0"

testcases/kernel/security/p9auth/p9priv.sh +0 -0
@@ -101,10 +109,10 @@ while [ ! -f $LTPTMP/d/childready ]; do :; done

touch $LTPTMP/childgo
while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then
-    echo "FAIL: child could setuid from wrong source uid"
+    tst_resm TFAIL "child could setuid from wrong source uid" exit 1
fi

testcases/kernel/security/p9auth/p9priv.sh +1 -1
-echo "PASS: child couldn't setuid from wrong source uid"
+tst_resm TPASS "child couldn't setuid from wrong source uid"

touch $LTPTMP/childexit

testcases/kernel/security/p9auth/p9unpriv.sh +2 -1
index 077b8ac..d42ee8e 100755
@@ -19,7 +19,8 @@
 ##
 ##
 
 ################################################################################
 
-LTPTMP=/tmp/p9auth_ltp
+export TMPDIR=${TMPDIR:-/tmp}
+export LTPTMP=${TMPDIR}/p9auth_ltp
 

TOUCH=which touch
ID=which id

testcases/kernel/security/p9auth/p9unpriv.sh +0 -0
@@ -27,7 +28,7 @@ echo ltptmp is $LTPTMP
 
Quoted 9 lines
Quoted 6 lines

myuid=id -u
if [ "$myuid" -eq 0 ]; then
-    echo "Unprivileged child was started as root!"
+    tst_resm TBROK "Unprivileged child was started as root!" exit 1
fi

Perfect -- I'll commit this once I get back home in a few hours! Thanks,

Ok, so before I commit I just want to make sure that this makes sense with you:

The differences are:
1. The id -?r?u use.
2. The while [ ! ... -a ... ] vs until [ ... -o ... ] logic (is more clear in my mind because it better describes the desired end-state)
3. Removing the which calls (because which doesn't exist on busybox from what I've heard) and replacing them with non-absolute commands (because it's the same thing...).

Thanks!
-Garrett

Index: testcases/kernel/security/p9auth/p9priv.sh
===================================================================
RCS file: /cvsroot/ltp/ltp/testcases/kernel/security/p9auth/p9priv.sh,v retrieving revision 1.1
diff -u -r1.1 p9priv.sh
--- testcases/kernel/security/p9auth/p9priv.sh 21 Sep 2009 15:48:09
-0000 1.1
+++ testcases/kernel/security/p9auth/p9priv.sh 6 Jan 2010 02:50:09 -0000 @@ -19,32 +19,32 @@
##

        ##

################################################################################

-LTPTMP=/tmp/p9auth_ltp
+export TMPDIR=${TMPDIR:-/tmp}
+export LTPTMP=${TMPDIR}/p9auth_ltp
+export TST_TOTAL=3
+export TCID="p9auth"
+
+export TST_COUNT=1
+
rm -rf $LTPTMP
mkdir $LTPTMP
chmod 755 $LTPTMP

comms="$LTPTMP/childgo $LTPTMP/d/childready $LTPTMP/d/childfail
$LTPTMP/d/childpass $LTPTMP/childexit"

-RM=which rm
-MKDIR=which mkdir
-CHOWN=which chown
-
cleanup() {

-       $RM -rf $LTPTMP/d $comms
-       $MKDIR -p $LTPTMP/d
-       $CHOWN -R ltp $LTPTMP/d
+       rm -rf $LTPTMP/d $comms
+       mkdir -p $LTPTMP/d
+       chown -R ltp $LTPTMP/d

}

-if [ id -u -ne 0 ]; then
- echo "Must start p9auth tests as root"
+if [ "$(id -ru)" -ne 0 ]; then
+ tst_resm TBROK "Must start p9auth tests as root"
exit 1
fi

-ltpuid=grep ltp /etc/passwd | head -1 | awk -F: '{ print $3 '} -ret=$?
-if [ $? -ne 0 ]; then
- echo "Failed to find ltp userid"
+if ! ltpuid=$(id -u ltp); then
+ tst_resm TCONF "Failed to find ltp userid"
exit 1
fi

@@ -55,12 +55,12 @@
su ltp p9unpriv.sh &
while [ ! -f $LTPTMP/d/childready ]; do :; done
touch $LTPTMP/childgo
-while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done; +until [ -f $LTPTMP/d/childfail -o -f $LTPTMP/d/childpass ]; do :; done
if [ -f $LTPTMP/d/childpass ]; then
- echo "FAIL: child could setuid with bad hash"
+ tst_resm TFAIL "child could setuid with bad hash"
exit 1
fi
-echo "PASS: child couldn't setuid with bad hash"
+tst_resm TPASS "child couldn't setuid with bad hash"

# TEST 2: ltp setuids to 0 with valid hash

@@ -78,12 +78,12 @@
su ltp p9unpriv.sh &
while [ ! -f $LTPTMP/d/childready ]; do :; done
touch $LTPTMP/childgo
-while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done; +until [ -f $LTPTMP/d/childfail -o -f $LTPTMP/d/childpass ]; do :; done
if [ -f $LTPTMP/d/childfail ]; then
- echo "FAIL: child couldn't setuid with good hash"
+ tst_resm TFAIL "child couldn't setuid with good hash"
exit 1
fi
-echo "PASS: child could setuid with good hash"
+tst_resm TPASS "child could setuid with good hash"

# TEST 3: 0 setuids to 0 with hash valid for ltp user
cleanup
@@ -99,12 +99,12 @@
su ltp p9unpriv.sh &
while [ ! -f $LTPTMP/d/childready ]; do :; done
touch $LTPTMP/childgo
-while [ ! -f $LTPTMP/d/childfail -a ! -f $LTPTMP/d/childpass ]; do :; done; +until [ -f $LTPTMP/d/childfail -o -f $LTPTMP/d/childpass ]; do :; done;
if [ -f $LTPTMP/d/childpass ]; then
- echo "PASS: child could setuid from wrong source uid"
+ tst_resm TFAIL "child could setuid from wrong source uid"
exit 1
fi
-echo "PASS: child couldn't setuid from wrong source uid" +tst_resm TPASS "child couldn't setuid from wrong source uid"

touch $LTPTMP/childexit

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#9 lore raw
Quoted 4 lines · Garrett Cooper

Ok, so before I commit I just want to make sure that this makes sense with you:

The differences are:
1. The id -?r?u use.

Either one can be fooled, neither should be...

Quoted 5 lines

2. The while [ ! ... -a ... ] vs until [ ... -o ... ] logic (is more clear in my mind because it better describes the desired end-state)
3. Removing the which calls (because which doesn't exist on busybox from what I've heard) and replacing them with non-absolute commands (because it's the same thing...).

All look fine to me.

thanks,
-serge

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community Take advantage of Verizon's best-in-class app development support A streamlined, 14 day to market process makes app distribution fast and easy Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list