aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Iliopoulos <ailiop@suse.com>2022-01-21 14:58:01 +0100
committerEryu Guan <guaneryu@gmail.com>2022-02-14 00:39:28 +0800
commit6bd65c707208afdc3d81d3146ac171d7621c26ee (patch)
tree10dc22152b73b00c9c37f2329d3ce5ab1a61df57
parent67f35c96a2d181b5b44ef9dfac309518dff7bb66 (diff)
downloadxfstests-dev-6bd65c707208afdc3d81d3146ac171d7621c26ee.tar.gz
common/rc: fix group detection regex to strictly match required name
_require_group greps for the required group string in /etc/group but this can partially match other groups or group member names and falsely return success where it should fail. Make the regex more specific so that it can unambigiously match only the exact group name rather than any other group that happens to match as a substring or any matching username from the group member list field. Signed-off-by: Anthony Iliopoulos <ailiop@suse.com> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rw-r--r--common/rc2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/rc b/common/rc
index b3289de985..73f484bd8b 100644
--- a/common/rc
+++ b/common/rc
@@ -2428,7 +2428,7 @@ _require_group()
if [ -n "$1" ];then
qa_group=$1
fi
- _cat_group | grep -q $qa_group
+ _cat_group | grep -q "^$qa_group:"
[ "$?" == "0" ] || _notrun "$qa_group group not defined."
}