[svn] commit: r2670 - /branches/trac268/src/bin/auth/tests/change_user_unittest.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Mon Aug 9 21:23:33 UTC 2010


Author: jinmei
Date: Mon Aug  9 21:23:33 2010
New Revision: 2670

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

Modified:
    branches/trac268/src/bin/auth/tests/change_user_unittest.cc

Modified: branches/trac268/src/bin/auth/tests/change_user_unittest.cc
==============================================================================
--- branches/trac268/src/bin/auth/tests/change_user_unittest.cc (original)
+++ branches/trac268/src/bin/auth/tests/change_user_unittest.cc Mon Aug  9 21:23:33 2010
@@ -15,6 +15,7 @@
 // $Id$
 
 #include <stdlib.h>
+#include <unistd.h>             // for getuid
 
 #include <string>
 
@@ -49,8 +50,7 @@
 
 TEST_F(ChangeUserTest, promotionAttempt) {
     // change to root should fail unless the running user is a super user.
-
-    if (my_username == "root") {
+    if (getuid() == 0) {
         cerr << "Already a super user, skipping the test" << endl;
         return;
     }




More information about the bind10-changes mailing list