mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Fix send:raw permission for send -w -I
When performing an incremental raw send with intermediates (-w -I), the standard 'send' permission was incorrectly required instead of allowing 'send:raw'. This was due to a strict boolean comparison on the 'rawok' flag in zfs_secpolicy_send() with non-boolean value. This change normalizes the 'rawok' variable to be strictly 0/1 and updates the test suite to properly verify delegated raw send behavior. Introduced-by: https://github.com/openzfs/zfs/pull/17543 Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Marc Sladek <marc@sladek.dev> Closes #18198 Closes #18193
This commit is contained in:
@@ -685,7 +685,7 @@ zfs_secpolicy_send(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
||||
dsl_dataset_t *ds;
|
||||
const char *cp;
|
||||
int error;
|
||||
boolean_t rawok = (zc->zc_flags & 0x8);
|
||||
boolean_t rawok = !!(zc->zc_flags & 0x8);
|
||||
|
||||
/*
|
||||
* Generate the current snapshot name from the given objsetid, then
|
||||
@@ -708,7 +708,7 @@ zfs_secpolicy_send(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
||||
|
||||
error = zfs_secpolicy_write_perms_ds(zc->zc_name, ds,
|
||||
ZFS_DELEG_PERM_SEND, cr);
|
||||
if (error != 0 && rawok == B_TRUE) {
|
||||
if (error != 0 && rawok) {
|
||||
error = zfs_secpolicy_write_perms_ds(zc->zc_name, ds,
|
||||
ZFS_DELEG_PERM_SEND_RAW, cr);
|
||||
}
|
||||
@@ -727,7 +727,7 @@ zfs_secpolicy_send_new(zfs_cmd_t *zc, nvlist_t *innvl, cred_t *cr)
|
||||
(void) innvl;
|
||||
error = zfs_secpolicy_write_perms(zc->zc_name,
|
||||
ZFS_DELEG_PERM_SEND, cr);
|
||||
if (error != 0 && rawok == B_TRUE) {
|
||||
if (error != 0 && rawok) {
|
||||
error = zfs_secpolicy_write_perms(zc->zc_name,
|
||||
ZFS_DELEG_PERM_SEND_RAW, cr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user