Blame SOURCES/libcgroup-0.41-infinite-loop.patch

308897
From 1078505afde08447226d9439d2ec1fd822afba82 Mon Sep 17 00:00:00 2001
308897
From: =?UTF-8?q?Nikola=20Forr=C3=B3?= <nforro@redhat.com>
308897
Date: Wed, 9 Dec 2015 11:00:30 +0100
308897
Subject: [PATCH] api.c: fix infinite loop
308897
308897
If getgrnam or getpwuid functions failed, the program entered
308897
an infinite loop, because the rule pointer was never advanced.
308897
This is now fixed by updating the pointer before continuing
308897
to the next iteration.
308897
---
308897
 src/api.c | 8 ++++++--
308897
 1 file changed, 6 insertions(+), 2 deletions(-)
308897
308897
diff --git a/src/api.c b/src/api.c
308897
index e9500e0..aa912b6 100644
308897
--- a/src/api.c
308897
+++ b/src/api.c
308897
@@ -2699,13 +2699,17 @@ static struct cgroup_rule *cgroup_find_matching_rule_uid_gid(uid_t uid,
308897
 			/* Get the group data. */
308897
 			sp = &(rule->username[1]);
308897
 			grp = getgrnam(sp);
308897
-			if (!grp)
308897
+			if (!grp) {
308897
+				rule = rule->next;
308897
 				continue;
308897
+			}
308897
 
308897
 			/* Get the data for UID. */
308897
 			usr = getpwuid(uid);
308897
-			if (!usr)
308897
+			if (!usr) {
308897
+				rule = rule->next;
308897
 				continue;
308897
+			}
308897
 
308897
 			/* If UID is a member of group, we matched. */
308897
 			for (i = 0; grp->gr_mem[i]; i++) {
308897
-- 
308897
2.13.6
308897