mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
ZTS/rsend: receive into a '.' or '..' component must fail
Receive a snapshot into $POOL2/. and $POOL2/.. and check that both are rejected and that a name starting with a dot is still accepted. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Christos Longros <[email protected]> Closes #18975 Closes #19010
This commit is contained in:
1 parent
191a3939db
commit
b6c59d1597
3 files changed
+58
-2
No files matched your search
@@ -1004,8 +1004,9 @@ tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos']
|
||||
tags = ['functional', 'rootpool']
|
||||
|
||||
[tests/functional/rsend]
|
||||
tests = ['recv_dedup', 'recv_dedup_encrypted_zvol', 'rsend_001_pos',
|
||||
'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos', 'rsend_005_pos',
|
||||
tests = ['recv_dedup', 'recv_dedup_encrypted_zvol',
|
||||
'recv_dot_name_neg', 'rsend_001_pos', 'rsend_002_pos',
|
||||
'rsend_003_pos', 'rsend_004_pos', 'rsend_005_pos',
|
||||
'rsend_006_pos', 'rsend_007_pos', 'rsend_008_pos', 'rsend_009_pos',
|
||||
'rsend_010_pos', 'rsend_011_pos', 'rsend_012_pos', 'rsend_013_pos',
|
||||
'rsend_014_pos', 'rsend_016_neg', 'rsend_019_pos', 'rsend_020_pos',
|
||||
|
||||
@@ -2161,6 +2161,7 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
|
||||
functional/rsend/cleanup.ksh \
|
||||
functional/rsend/recv_dedup_encrypted_zvol.ksh \
|
||||
functional/rsend/recv_dedup.ksh \
|
||||
functional/rsend/recv_dot_name_neg.ksh \
|
||||
functional/rsend/recv_validate_001_neg.ksh \
|
||||
functional/rsend/rsend_001_pos.ksh \
|
||||
functional/rsend/rsend_002_pos.ksh \
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
#!/bin/ksh -p
|
||||
# SPDX-License-Identifier: CDDL-1.0
|
||||
#
|
||||
# This file and its contents are supplied under the terms of the
|
||||
# Common Development and Distribution License ("CDDL"), version 1.0.
|
||||
# You may only use this file in accordance with the terms of version
|
||||
# 1.0 of the CDDL.
|
||||
#
|
||||
# A full copy of the text of the CDDL should have accompanied this
|
||||
# source. A copy of the CDDL is also available via the Internet at
|
||||
# https://opensource.org/license/CDDL-1.0.
|
||||
#
|
||||
|
||||
#
|
||||
# Copyright (c) 2026, Christos Longros. All rights reserved.
|
||||
#
|
||||
|
||||
. $STF_SUITE/include/libtest.shlib
|
||||
. $STF_SUITE/tests/functional/rsend/rsend.kshlib
|
||||
|
||||
#
|
||||
# Description:
|
||||
# Verify that zfs receive rejects a target dataset that ends in a '.'
|
||||
# or '..' component. The received snapshot name is checked as a whole,
|
||||
# so the component ends at '@' rather than at the end of the name.
|
||||
#
|
||||
# Strategy:
|
||||
# 1. Receive a snapshot into $POOL2/. and $POOL2/.. and verify both fail
|
||||
# 2. Verify that neither dataset was created
|
||||
# 3. Verify that $POOL2 can still be listed recursively
|
||||
# 4. Receive the same snapshot into $POOL2/.dot and verify it succeeds
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
|
||||
function cleanup
|
||||
{
|
||||
cleanup_pool $POOL2
|
||||
}
|
||||
log_onexit cleanup
|
||||
|
||||
log_assert "zfs receive rejects a target ending in a '.' or '..' component"
|
||||
|
||||
typeset name
|
||||
for name in "$POOL2/." "$POOL2/.."; do
|
||||
log_mustnot eval "zfs send $POOL/$FS@final | zfs receive $name"
|
||||
log_mustnot eval "zfs list -H -o name -d 1 $POOL2 | grep -qxF '$name'"
|
||||
done
|
||||
log_must zfs list -r $POOL2
|
||||
|
||||
log_must eval "zfs send $POOL/$FS@final | zfs receive $POOL2/.dot"
|
||||
log_must datasetexists $POOL2/.dot
|
||||
|
||||
log_pass "zfs receive rejects a target ending in a '.' or '..' component"
|
||||
Reference in new issue
Block a user