From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: jorgeanton@gmail.com Received: from krantz.zx2c4.com (localhost [127.0.0.1]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id 390850a1 for ; Sat, 25 Aug 2018 01:28:51 +0000 (UTC) Received: from mail-io0-x22e.google.com (mail-io0-x22e.google.com [IPv6:2607:f8b0:4001:c06::22e]) by krantz.zx2c4.com (ZX2C4 Mail Server) with ESMTP id fea45a37 for ; Sat, 25 Aug 2018 01:28:51 +0000 (UTC) Received: by mail-io0-x22e.google.com with SMTP id e12-v6so8561003iok.12 for ; Fri, 24 Aug 2018 18:42:04 -0700 (PDT) MIME-Version: 1.0 From: Jorge AC Date: Sat, 25 Aug 2018 03:41:51 +0200 Message-ID: Subject: [PATCH 1012/1012] Support for unicode interface names: only '%', ':' and '/' must be avoided To: wireguard@lists.zx2c4.com Content-Type: text/plain; charset="UTF-8" List-Id: Development discussion of WireGuard List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , --- src/tools/wg-quick/linux.bash | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/wg-quick/linux.bash b/src/tools/wg-quick/linux.bash index 48ce163..4317907 100755 --- a/src/tools/wg-quick/linux.bash +++ b/src/tools/wg-quick/linux.bash @@ -39,9 +39,9 @@ die() { parse_options() { local interface_section=0 line key value stripped CONFIG_FILE="$1" - [[ $CONFIG_FILE =~ ^[a-zA-Z0-9_=+.-]{1,15}$ ]] && CONFIG_FILE="/etc/wireguard/$CONFIG_FILE.conf" + [[ -e $CONFIG_FILE ]] || CONFIG_FILE="/etc/wireguard/$CONFIG_FILE.conf" [[ -e $CONFIG_FILE ]] || die "\`$CONFIG_FILE' does not exist" - [[ $CONFIG_FILE =~ (^|/)([a-zA-Z0-9_=+.-]{1,15})\.conf$ ]] || die "The config file must be a valid interface name, followed by .conf" + [[ $CONFIG_FILE =~ (^|/)([^%:/]+)\.conf$ ]] || die "The config file must be a valid interface name, followed by .conf" CONFIG_FILE="$(readlink -f "$CONFIG_FILE")" ((($(stat -c '0%#a' "$CONFIG_FILE") & $(stat -c '0%#a' "${CONFIG_FILE%/*}") & 0007) == 0)) || echo "Warning: \`$CONFIG_FILE' is world accessible" >&2 INTERFACE="${BASH_REMATCH[2]}" -- 2.11.0