Commit d587b0b8 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

use UID==0 rather than username="root" to check if it's a privileged user.


git-svn-id: svn://bind10.isc.org/svn/bind10/branches/trac268@2670 e5f2f494-b856-4b98-b285-d166d9295462
parent dd3a1a96
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
// $Id$ // $Id$
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> // for getuid
#include <string> #include <string>
...@@ -49,8 +50,7 @@ TEST_F(ChangeUserTest, badUID) { ...@@ -49,8 +50,7 @@ TEST_F(ChangeUserTest, badUID) {
TEST_F(ChangeUserTest, promotionAttempt) { TEST_F(ChangeUserTest, promotionAttempt) {
// change to root should fail unless the running user is a super user. // change to root should fail unless the running user is a super user.
if (getuid() == 0) {
if (my_username == "root") {
cerr << "Already a super user, skipping the test" << endl; cerr << "Already a super user, skipping the test" << endl;
return; return;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment