Print this page
*** NO COMMENTS ***

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/zfs_ioctl.c
          +++ new/usr/src/uts/common/fs/zfs/zfs_ioctl.c
↓ open down ↓ 677 lines elided ↑ open up ↑
 678  678  /*
 679  679   * Destroying snapshots with delegated permissions requires
 680  680   * descendent mount and destroy permissions.
 681  681   * Reassemble the full filesystem@snap name so dsl_deleg_access()
 682  682   * can do the correct permission check.
 683  683   *
 684  684   * Since this routine is used when doing a recursive destroy of snapshots
 685  685   * and destroying snapshots requires descendent permissions, a successfull
 686  686   * check of the top level snapshot applies to snapshots of all descendent
 687  687   * datasets as well.
      688 + *
      689 + * The target snapshot may not exist when doing a recursive destroy.
      690 + * In this case fallback to permissions of the parent dataset.
 688  691   */
 689  692  static int
 690  693  zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
 691  694  {
 692  695          int error;
 693  696          char *dsname;
 694  697  
 695  698          dsname = kmem_asprintf("%s@%s", zc->zc_name, zc->zc_value);
 696  699  
 697  700          error = zfs_secpolicy_destroy_perms(dsname, cr);
 698  701  
      702 +        if (error == ENOENT)
      703 +                error = zfs_secpolicy_destroy_perms(zc->zc_name, cr);
      704 +
 699  705          strfree(dsname);
 700  706          return (error);
 701  707  }
 702  708  
 703  709  int
 704  710  zfs_secpolicy_rename_perms(const char *from, const char *to, cred_t *cr)
 705  711  {
 706  712          char    parentname[MAXNAMELEN];
 707  713          int     error;
 708  714  
↓ open down ↓ 4414 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX