Zbigniew Jędrzejewski-Szmek 27bd1b
From 8864ff594b43a34e5a593da42336f28e2f30b9f5 Mon Sep 17 00:00:00 2001
Zbigniew Jędrzejewski-Szmek 27bd1b
From: Felipe Sateler <fsateler@users.noreply.github.com>
Zbigniew Jędrzejewski-Szmek 27bd1b
Date: Wed, 19 Jul 2017 20:48:23 -0400
Zbigniew Jędrzejewski-Szmek 27bd1b
Subject: [PATCH] test-condition: don't assume that all non-root users are
Zbigniew Jędrzejewski-Szmek 27bd1b
 normal users (#6409)
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
Automated builders may run under a dedicated system user, and this test would fail that
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
Fixes #6366
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
(cherry picked from commit 708d423915c4ea48d408b5a3395c11055247b9bc)
Zbigniew Jędrzejewski-Szmek 27bd1b
---
Zbigniew Jędrzejewski-Szmek 27bd1b
 src/test/test-condition.c | 2 +-
Zbigniew Jędrzejewski-Szmek 27bd1b
 1 file changed, 1 insertion(+), 1 deletion(-)
Zbigniew Jędrzejewski-Szmek 27bd1b
Zbigniew Jędrzejewski-Szmek 27bd1b
diff --git a/src/test/test-condition.c b/src/test/test-condition.c
Zbigniew Jędrzejewski-Szmek 27bd1b
index 121345cfd1..b15f1b98c0 100644
Zbigniew Jędrzejewski-Szmek 27bd1b
--- a/src/test/test-condition.c
Zbigniew Jędrzejewski-Szmek 27bd1b
+++ b/src/test/test-condition.c
Zbigniew Jędrzejewski-Szmek 27bd1b
@@ -390,7 +390,7 @@ static void test_condition_test_user(void) {
Zbigniew Jędrzejewski-Szmek 27bd1b
         assert_se(condition);
Zbigniew Jędrzejewski-Szmek 27bd1b
         r = condition_test(condition);
Zbigniew Jędrzejewski-Szmek 27bd1b
         log_info("ConditionUser=@system → %i", r);
Zbigniew Jędrzejewski-Szmek 27bd1b
-        if (geteuid() == 0)
Zbigniew Jędrzejewski-Szmek 27bd1b
+        if (getuid() < SYSTEM_UID_MAX || geteuid() < SYSTEM_UID_MAX)
Zbigniew Jędrzejewski-Szmek 27bd1b
                 assert_se(r > 0);
Zbigniew Jędrzejewski-Szmek 27bd1b
         else
Zbigniew Jędrzejewski-Szmek 27bd1b
                 assert_se(r == 0);