diff options
| author | Mike Karels <karels@FreeBSD.org> | 2024-05-20 13:43:34 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-08-21 17:13:22 +0000 |
| commit | 0ebe6df086f3bac96945415965a8e0ea1431259a (patch) | |
| tree | 17b4c17feb38d0f81231f3c83f668ce90a43432f /usr.sbin | |
| parent | 9b945635c147feb4ac6ebf84bd19e149e9a10227 (diff) | |
Diffstat (limited to 'usr.sbin')
| -rw-r--r-- | usr.sbin/adduser/adduser.sh | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.sbin/adduser/adduser.sh b/usr.sbin/adduser/adduser.sh index 7c3fdb418179..ecac7478befd 100644 --- a/usr.sbin/adduser/adduser.sh +++ b/usr.sbin/adduser/adduser.sh @@ -474,7 +474,7 @@ get_homeperm() { # so, enable ZFS home dataset creation. # get_zfs_home() { - local _prefix= + local _prefix= _tmp= # check if zfs kernel module is loaded before attempting to run zfs to # prevent loading the kernel module on systems that don't use ZFS @@ -487,6 +487,13 @@ get_zfs_home() { Zcreate="no" return fi + # Make sure that _prefix is not a subdirectory within a dataset. If it + # is, the containing dataset will be the same for it and its parent. + _tmp=$(${ZFSCMD} list -Ho name "$(dirname "${homeprefix}")" 2>/dev/null) + if [ "${_tmp}" = "${_prefix}" ]; then + Zcreate="no" + return + fi zhome="${_prefix}/${username}" } |
