Commit e0b8e8b6 authored by Tim Shimmin's avatar Tim Shimmin Committed by Lachlan McIlroy

[XFS] remove restricted chown parameter from xfs linux

On Linux all filesystems are supposed to be operating under Posix'
restricted chown. Restricted chown means it restricts chown to the owner
unless you have CAP_FOWNER.

NOTE: that 2 files outside of fs/xfs have been modified too for this
change.
Reviewed-by: default avatarDave Chinner <david@fromorbit.com>

SGI-PV: 988919

SGI-Modid: xfs-linux-melb:xfs-kern:32413a
Signed-off-by: default avatarTim Shimmin <tes@sgi.com>
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarDavid Chinner <david@fromorbit.com>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent f3f0d7b0
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
*/ */
xfs_param_t xfs_params = { xfs_param_t xfs_params = {
/* MIN DFLT MAX */ /* MIN DFLT MAX */
.restrict_chown = { 0, 1, 1 },
.sgid_inherit = { 0, 0, 1 }, .sgid_inherit = { 0, 0, 1 },
.symlink_mode = { 0, 0, 1 }, .symlink_mode = { 0, 0, 1 },
.panic_mask = { 0, 0, 255 }, .panic_mask = { 0, 0, 255 },
......
...@@ -1103,10 +1103,6 @@ xfs_ioctl_setattr( ...@@ -1103,10 +1103,6 @@ xfs_ioctl_setattr(
/* /*
* Change file ownership. Must be the owner or privileged. * Change file ownership. Must be the owner or privileged.
* If the system was configured with the "restricted_chown"
* option, the owner is not permitted to give away the file,
* and can change the group id only to a group of which he
* or she is a member.
*/ */
if (mask & FSX_PROJID) { if (mask & FSX_PROJID) {
/* /*
......
...@@ -107,7 +107,6 @@ ...@@ -107,7 +107,6 @@
#undef HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */ #undef HAVE_PERCPU_SB /* per cpu superblock counters are a 2.6 feature */
#endif #endif
#define restricted_chown xfs_params.restrict_chown.val
#define irix_sgid_inherit xfs_params.sgid_inherit.val #define irix_sgid_inherit xfs_params.sgid_inherit.val
#define irix_symlink_mode xfs_params.symlink_mode.val #define irix_symlink_mode xfs_params.symlink_mode.val
#define xfs_panic_mask xfs_params.panic_mask.val #define xfs_panic_mask xfs_params.panic_mask.val
......
...@@ -55,17 +55,6 @@ xfs_stats_clear_proc_handler( ...@@ -55,17 +55,6 @@ xfs_stats_clear_proc_handler(
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
static ctl_table xfs_table[] = { static ctl_table xfs_table[] = {
{
.ctl_name = XFS_RESTRICT_CHOWN,
.procname = "restrict_chown",
.data = &xfs_params.restrict_chown.val,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = &proc_dointvec_minmax,
.strategy = &sysctl_intvec,
.extra1 = &xfs_params.restrict_chown.min,
.extra2 = &xfs_params.restrict_chown.max
},
{ {
.ctl_name = XFS_SGID_INHERIT, .ctl_name = XFS_SGID_INHERIT,
.procname = "irix_sgid_inherit", .procname = "irix_sgid_inherit",
......
...@@ -31,7 +31,6 @@ typedef struct xfs_sysctl_val { ...@@ -31,7 +31,6 @@ typedef struct xfs_sysctl_val {
} xfs_sysctl_val_t; } xfs_sysctl_val_t;
typedef struct xfs_param { typedef struct xfs_param {
xfs_sysctl_val_t restrict_chown;/* Root/non-root can give away files.*/
xfs_sysctl_val_t sgid_inherit; /* Inherit S_ISGID if process' GID is xfs_sysctl_val_t sgid_inherit; /* Inherit S_ISGID if process' GID is
* not a member of parent dir GID. */ * not a member of parent dir GID. */
xfs_sysctl_val_t symlink_mode; /* Link creat mode affected by umask */ xfs_sysctl_val_t symlink_mode; /* Link creat mode affected by umask */
...@@ -68,7 +67,7 @@ typedef struct xfs_param { ...@@ -68,7 +67,7 @@ typedef struct xfs_param {
enum { enum {
/* XFS_REFCACHE_SIZE = 1 */ /* XFS_REFCACHE_SIZE = 1 */
/* XFS_REFCACHE_PURGE = 2 */ /* XFS_REFCACHE_PURGE = 2 */
XFS_RESTRICT_CHOWN = 3, /* XFS_RESTRICT_CHOWN = 3 */
XFS_SGID_INHERIT = 4, XFS_SGID_INHERIT = 4,
XFS_SYMLINK_MODE = 5, XFS_SYMLINK_MODE = 5,
XFS_PANIC_MASK = 6, XFS_PANIC_MASK = 6,
......
...@@ -232,10 +232,6 @@ xfs_setattr( ...@@ -232,10 +232,6 @@ xfs_setattr(
/* /*
* Change file ownership. Must be the owner or privileged. * Change file ownership. Must be the owner or privileged.
* If the system was configured with the "restricted_chown"
* option, the owner is not permitted to give away the file,
* and can change the group id only to a group of which he
* or she is a member.
*/ */
if (mask & (ATTR_UID|ATTR_GID)) { if (mask & (ATTR_UID|ATTR_GID)) {
/* /*
...@@ -259,9 +255,8 @@ xfs_setattr( ...@@ -259,9 +255,8 @@ xfs_setattr(
* shall be equal to either the group ID or one of the * shall be equal to either the group ID or one of the
* supplementary group IDs of the calling process. * supplementary group IDs of the calling process.
*/ */
if (restricted_chown && if ((iuid != uid ||
(iuid != uid || (igid != gid && (igid != gid && !in_group_p((gid_t)gid))) &&
!in_group_p((gid_t)gid))) &&
!capable(CAP_CHOWN)) { !capable(CAP_CHOWN)) {
code = XFS_ERROR(EPERM); code = XFS_ERROR(EPERM);
goto error_return; goto error_return;
...@@ -455,10 +450,6 @@ xfs_setattr( ...@@ -455,10 +450,6 @@ xfs_setattr(
/* /*
* Change file ownership. Must be the owner or privileged. * Change file ownership. Must be the owner or privileged.
* If the system was configured with the "restricted_chown"
* option, the owner is not permitted to give away the file,
* and can change the group id only to a group of which he
* or she is a member.
*/ */
if (mask & (ATTR_UID|ATTR_GID)) { if (mask & (ATTR_UID|ATTR_GID)) {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment