From 4fc69bcd399292e688d19dc3569c7e496419ecd6 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Sun, 8 Jul 2012 12:04:21 +0200 Subject: Fix match expression in ctrl_interface parsing (8021x) In bash built-in substring matching, '*' does not signify repetition of the previous character. --- src/8021x | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/8021x b/src/8021x index ce20c36..b3294d0 100644 --- a/src/8021x +++ b/src/8021x @@ -9,9 +9,12 @@ wpa_call() if [[ -n "$WPA_CTRL_DIR" ]]; then args+=("-p" "$WPA_CTRL_DIR") elif [[ -n "$WPA_CONF" ]] && grep -q "^[[:space:]]*ctrl_interface=" "$WPA_CONF"; then - WPA_CTRL_DIR=$(grep -m 1 "^[[:space:]]*ctrl_interface=" "$WPA_CONF" | cut -d= -f 2-) - WPA_CTRL_DIR=${WPA_CTRL_DIR#DIR=} - WPA_CTRL_DIR=${WPA_CTRL_DIR%% GROUP=.*} + WPA_CTRL_DIR=$(grep -m 1 "^[[:space:]]*ctrl_interface=" "$WPA_CONF") + WPA_CTRL_DIR=${WPA_CTRL_DIR#*ctrl_interface=} + if [[ "$WPA_CTRL_DIR" == DIR=* ]]; then + WPA_CTRL_DIR=${WPA_CTRL_DIR:4} + WPA_CTRL_DIR=${WPA_CTRL_DIR%% GROUP=*} + fi args+=("-p" "$WPA_CTRL_DIR") fi report_debug wpa_cli "${args[@]}" "$@" -- cgit v1.2.3-24-g4f1b