Blob Blame History Raw
From 3107894285164a3d25ca215a76593ebb6d4bc84c Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Tue, 14 Jul 2020 15:07:32 -0400
Subject: [PATCH 09/11] pesign-authorize: shellcheck

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 src/pesign-authorize | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/pesign-authorize b/src/pesign-authorize
index a496f601ab4..55cd5c4e55b 100755
--- a/src/pesign-authorize
+++ b/src/pesign-authorize
@@ -12,21 +12,21 @@ set -u
 # License: GPLv2
 declare -a fileusers=()
 declare -a dirusers=()
-for user in $(cat /etc/pesign/users); do
+while read -r user ; do
 	dirusers[${#dirusers[@]}]=-m
 	dirusers[${#dirusers[@]}]="u:$user:rwx"
 	fileusers[${#fileusers[@]}]=-m
 	fileusers[${#fileusers[@]}]="u:$user:rw"
-done
+done </etc/pesign/users
 
 declare -a filegroups=()
 declare -a dirgroups=()
-for group in $(cat /etc/pesign/groups); do
+while read -r group ; do
 	dirgroups[${#dirgroups[@]}]=-m
 	dirgroups[${#dirgroups[@]}]="g:$group:rwx"
 	filegroups[${#filegroups[@]}]=-m
 	filegroups[${#filegroups[@]}]="g:$group:rw"
-done
+done </etc/pesign/groups
 
 update_subdir() {
 	subdir=$1 && shift
@@ -35,12 +35,12 @@ update_subdir() {
 	setfacl "${dirusers[@]}" "${dirgroups[@]}" "${subdir}"
 	for x in "${subdir}"* ; do
 		if [ -d "${x}" ]; then
-			setfacl -bk ${x}
-			setfacl "${dirusers[@]}" "${dirgroups[@]}" ${x}
+			setfacl -bk "${x}"
+			setfacl "${dirusers[@]}" "${dirgroups[@]}" "${x}"
 			update_subdir "${x}/"
 		elif [ -e "${x}" ]; then
-			setfacl -bk ${x}
-			setfacl "${fileusers[@]}" "${filegroups[@]}" ${x}
+			setfacl -bk "${x}"
+			setfacl "${fileusers[@]}" "${filegroups[@]}" "${x}"
 		else
 			:;
 		fi
-- 
2.26.2