2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 06:16:03 +00:00

Add quotes around several variables

Note that $PARSER_OPTS has to stay without quotes because it can
sometimes be empty, and would (if quoted) be interpreted as empty
filename by apparmor_parser
This commit is contained in:
Christian Boltz
2019-03-18 19:30:37 +01:00
parent 5f46dedd6e
commit 7b68d820ea

View File

@@ -147,7 +147,7 @@ __parse_profiles_dir() {
return 1
fi
if [ -z "$(ls $profile_dir/)" ]; then
if [ -z "$(ls "$profile_dir"/)" ]; then
aa_log_failure_msg "No profiles found in $profile_dir"
return 1
fi
@@ -156,12 +156,12 @@ __parse_profiles_dir() {
# when we pass it a directory, but not when we pass it an individual
# profile. So we need to use skip_profile only in the latter case,
# as long as the parser is in sync' with skip_profile().
"$PARSER" $PARSER_OPTS $parser_cmd -- "$profile_dir" || {
"$PARSER" $PARSER_OPTS "$parser_cmd" -- "$profile_dir" || {
# FIXME: once the parser properly handles broken profiles
# (LP: #1377338), remove the following code and the
# skip_profile() function. For now, if the parser returns
# an error, just run it again separately on each profile.
for profile in $profile_dir/*; do
for profile in "$profile_dir"/*; do
skip_profile "${profile}"
skip=$?
if [ "$skip" -eq 2 ]; then
@@ -179,8 +179,8 @@ __parse_profiles_dir() {
echo "$profile"
done | \
# Use xargs to parallelize calls to the parser over all CPUs
xargs -n1 -d"\n" --max-procs=$(getconf _NPROCESSORS_ONLN) \
"$PARSER" $PARSER_OPTS $parser_cmd --
xargs -n1 -d"\n" --max-procs="$(getconf _NPROCESSORS_ONLN)" \
"$PARSER" $PARSER_OPTS "$parser_cmd" --
if [ $? -ne 0 ]; then
status=1
aa_log_failure_msg "At least one profile failed to load"
@@ -235,7 +235,7 @@ profiles_names_list() {
continue
fi
for profile in $profile_dir/*; do
for profile in "$profile_dir"/*; do
if skip_profile "${profile}" && [ -f "${profile}" ] ; then
LIST_ADD=$($PARSER -N "$profile" )
if [ $? -eq 0 ]; then
@@ -248,7 +248,7 @@ profiles_names_list() {
failstop_system() {
level=$(runlevel | cut -d" " -f2)
if [ $level -ne "1" ] ; then
if [ "$level" -ne "1" ] ; then
aa_log_failure_msg "- could not start AppArmor. Changing to runlevel 1"
telinit 1;
return 255;