Skip to content

Commit

Permalink
db2: avoid eval with unsanitized values (ClusterLabs#1838)
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Varkoly <[email protected]>
  • Loading branch information
varkoly and Peter Varkoly committed Jan 25, 2023
1 parent baddb06 commit fcda917
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions heartbeat/db2
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,11 @@ db2_get_cfg() {
/First active log file/ {printf "FIRST_ACTIVE_LOG='%s'\n", $NF;}
/HADR_PEER_WINDOW/ {printf "HADR_PEER_WINDOW='%s'\n", $NF;}')


# sets HADR_ROLE HADR_TIMEOUT HADR_PEER_WINDOW
eval $hadr_vars
HADR_ROLE=$(echo "$output" | awk '/HADR database role/ {print $NF;}')
HADR_TIMEOUT=$(echo "$output" | awk '/HADR_TIMEOUT/ {print $NF;}')
FIRST_ACTIVE_LOG=$(echo "$output" | awk '/First active log file/ {print $NF;}')
HADR_PEER_WINDOW=$(echo "$output" | awk '/HADR_PEER_WINDOW/ {print $NF;}')

# HADR_PEER_WINDOW comes with V9 and is checked later
if [ -z "$HADR_ROLE" -o -z "$HADR_TIMEOUT" ]
Expand Down

0 comments on commit fcda917

Please sign in to comment.