# HG changeset patch # User Franz Glasner # Date 1727462134 -7200 # Node ID cd4aea87dbfadbc7290322292d78746b6b510267 # Parent b0e8b5cf5d3396e836590998e6a74a425acb5986 common.subr: Enhance parameter check for "_get_jail_from_path()". Now checks for absolute paths are done and trailing slashes are handled. diff -r b0e8b5cf5d33 -r cd4aea87dbfa share/local-bsdtools/common.subr --- a/share/local-bsdtools/common.subr Fri Sep 27 19:17:21 2024 +0200 +++ b/share/local-bsdtools/common.subr Fri Sep 27 20:35:34 2024 +0200 @@ -321,7 +321,30 @@ local _name _path _dying _location="${1-}" - [ -z "${_location}" ] && { echo "ERROR: no mountpoint given" 1>&2; return 1; } + case "${_location}" in + '') + err "no mountpoint given" + return 1 + ;; + /) + true + ;; + *//*) + err "given directory must not contain consequtive slashes" + return 1 + ;; + /*/) + # Remove trailing slash + _location="${_location%/}" + ;; + /*) + true + ;; + *) + err "given directory path must be an absolute path" + return 1 + ;; + esac if [ -x "${JQ}" ]; then /usr/sbin/jls --libxo=json,no-locale -d dying name path \