1#!/bin/ksh -p 2# SPDX-License-Identifier: CDDL-1.0 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# https://opensource.org/license/CDDL-1.0. 12# 13 14# 15# Copyright (c) 2026, TrueNAS. 16# 17 18. $STF_SUITE/tests/functional/delegate/delegate_common.kshlib 19 20verify_runnable "both" 21 22log_assert "Verify send sub-permissions correctly limit send options." 23log_onexit restore_root_datasets 24 25for dtst in $DATASETS; do 26 27 for enc in '' 'y' ; do 28 # full 'send' permission can do it all 29 log_must restore_root_datasets $enc 30 log_must zfs allow $STAFF1 "send" $dtst 31 log_must verify_perm $dtst "send" $STAFF1 32 log_must verify_perm $dtst "send_raw" $STAFF1 33 34 # 'send:raw' can only do raw send 35 log_must restore_root_datasets $enc 36 log_must zfs allow $STAFF1 "send:raw" $dtst 37 log_must verify_noperm $dtst "send" $STAFF1 38 log_must verify_perm $dtst "send_raw" $STAFF1 39 done 40 41 # 'send:encrypted' cannot do anything on unencrypted datasets 42 log_must restore_root_datasets 43 log_must zfs allow $STAFF1 "send:encrypted" $dtst 44 log_must verify_noperm $dtst "send" $STAFF1 45 log_must verify_noperm $dtst "send_raw" $STAFF1 46 47 # 'send:encrypted' can do raw send only on encrypted datasets 48 log_must restore_root_datasets 'y' 49 log_must zfs allow $STAFF1 "send:encrypted" $dtst 50 log_must verify_noperm $dtst "send" $STAFF1 51 log_must verify_perm $dtst "send_raw" $STAFF1 52 53done 54 55log_must restore_root_datasets 56 57log_pass "Verify send-permissions correctly limit send options." 58