Skip to contentSkip to conversation

chown03: fix the effective user when do cleanup

PATCH In review Wei Yongjun 2 participants 2 messages Jun 11, 2009 – Jun 15, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 chown03: fix the effective user when do cleanup

The TESTDIR is created by root user, but when we do cleanup, the effective user had been changed to nobody, so the cleanup will be failed when the TESTDIR is removed.

  chown03     1  PASS  :  chown() on testfile succeeds, clears setuid/gid bits
  chown03     0  WARN  :  tst_rmdir(): rmobj(/tmp/choYm1VHD) failed: \

remove(/tmp/choYm1VHD) failed; errno=1: Operation not permitted

This patch fixed the problem by reset the effective user to root.

---
 testcases/kernel/syscalls/chown/chown03.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
testcases/kernel/syscalls/chown/chown03.c +3 -0
index f27cb6f..d2eecd1 100644
@@ -267,6 +267,9 @@ void cleanup()
 	 */
 	TEST_CLEANUP;
 
+	setegid(0);
+	seteuid(0);
+
 	/* Remove tmp dir and all files in it */
 	tst_rmdir();
 
Signature · 16 lines
1.6.0.2.530.g67faa





------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
#1 lore raw
Quoted 11 lines · Wei Yongjun

The TESTDIR is created by root user, but when we do cleanup, the effective user had been changed to nobody, so the cleanup will be failed when the TESTDIR is removed.

  chown03     1  PASS  :  chown() on testfile succeeds, clears setuid/gid bits
  chown03     0  WARN  :  tst_rmdir(): rmobj(/tmp/choYm1VHD) failed: \

remove(/tmp/choYm1VHD) failed; errno=1: Operation not permitted

This patch fixed the problem by reset the effective user to root.

Thanks.

Regards--
Subrata

Quoted 9 lines
---
 testcases/kernel/syscalls/chown/chown03.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
testcases/kernel/syscalls/chown/chown03.c +0 -0
index f27cb6f..d2eecd1 100644

testcases/kernel/syscalls/chown/chown03.c void cleanup() · line 275

Quoted 9 lines
testcases/kernel/syscalls/chown/chown03.c +3 -0
@@ -267,6 +267,9 @@ void cleanup()
 	 */
 	TEST_CLEANUP;
 
+	setegid(0);
+	seteuid(0);
+
 	/* Remove tmp dir and all files in it */
 	tst_rmdir();
 

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited royalty-free distribution of the report engine for externally facing server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list