[PATCH] common/rc: fix group detection regex to strictly match required name

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]



_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@xxxxxxxx>
---
 common/rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/rc b/common/rc
index b3289de985d8..73f484bd8be2 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."
 }
 
-- 
2.34.1




[Index of Archives]     [Linux Filesystems Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux