From 190f60319f1f741bc839cdb16d5fd3d7316dba07 Mon Sep 17 00:00:00 2001 From: covert Date: Tue, 18 Jul 2023 15:14:25 +0200 Subject: [PATCH] Small syntax fixes --- .../opt/bitnami/scripts/libvalidations.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/bitnami/keycloak/21/debian-11/prebuildfs/opt/bitnami/scripts/libvalidations.sh b/bitnami/keycloak/21/debian-11/prebuildfs/opt/bitnami/scripts/libvalidations.sh index e8b86f1f13994..ba4b246e09c97 100644 --- a/bitnami/keycloak/21/debian-11/prebuildfs/opt/bitnami/scripts/libvalidations.sh +++ b/bitnami/keycloak/21/debian-11/prebuildfs/opt/bitnami/scripts/libvalidations.sh @@ -198,13 +198,11 @@ validate_ip() { local ip="${1:?ip is missing}" local stat=1 - validate_ipv4 "$ip" - if [[ $? -eq 0 ]]; then - stat=0 - else - validate_ipv6 "$ip" - stat=$? - fi + if validate_ipv4 "$ip"; then + stat=0 + else + stat=$(validate_ipv6 "$ip") + fi return $stat } @@ -239,16 +237,13 @@ validate_ipv4() { validate_ipv6() { local ip="${1:?ip is missing}" local stat=1 - local full_address_regex='^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$' local short_address_regex='^((([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6}::(([0-9a-fA-F]{1,4}:){0,6}[0-9a-fA-F]{1,4}){0,6})$' - if [[ $ip =~ $full_address_regex || $ip =~ $short_address_regex || $ip == "::" ]]; then stat=0 fi - - echo $stat + return $stat } ########################