# HG changeset patch # User Franz Glasner # Date 1661090101 -7200 # Node ID 4d7e00b500a1270e1c2d0f1189695cc2ff456f4b # Parent 1b176ccd41b9b5fc6c8a4162b4c6feb1aaae12f5 Implement a sanity and consistency check when doing "natural" mounts diff -r 1b176ccd41b9 -r 4d7e00b500a1 sbin/fjail --- a/sbin/fjail Sun Aug 21 15:18:20 2022 +0200 +++ b/sbin/fjail Sun Aug 21 15:55:01 2022 +0200 @@ -446,6 +446,19 @@ _relative_mp="${_relative_mp%/}" # The real effective full mountpoint _real_mp="${_mountpoint}${_relative_mp}" + + # + # Consistency and sanity check: computed real mountpoint must + # be equal to the configured mountpoint when no custom mountpoint + # is given. + # + if [ "${_mount_natural}" = "yes" ]; then + if [ "${_real_mp}" != "${_mp}" ]; then + echo "ERROR: mountpoint mismatch" >&2 + return 1 + fi + fi + if [ "${_dry_run}" = "yes" ]; then echo "Would mount ${_name} on ${_real_mp}" else