From mboxrd@z Thu Jan 1 00:00:00 1970 From: Niraj Kumar Subject: [PATCH] unrestricted_chown : userspace part Date: Tue, 9 Dec 2008 10:02:52 +0530 Message-ID: <20081209043252.GB31729@niraj-laptop> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: hch@lst.de, nick.couchman@seakr.com To: util-linux-ng@vger.kernel.org, linux-fsdevel@vger.kernel.org Return-path: Received: from ti-out-0910.google.com ([209.85.142.186]:30655 "EHLO ti-out-0910.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751839AbYLIEdF (ORCPT ); Mon, 8 Dec 2008 23:33:05 -0500 Received: by ti-out-0910.google.com with SMTP id b6so865507tic.23 for ; Mon, 08 Dec 2008 20:33:03 -0800 (PST) Content-Disposition: inline Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Unrestricted chown: Userspace patch for mount program This patch adds "unrestricted_chown" option to mount program. This option is used to disable the Posix _POSIX_CHOWN_RESTRICTED chown option on a given filesystem which forbids non-privilegued users to give away files. This is currently implemented by XFS as a sysctl, but making it per filesystem and available not just for XFS makes more sense. This has also been requested in http://oss.sgi.com/bugzilla/show_bug.cgi?id=768. See http://www.opengroup.org/onlinepubs/009695399/functions/chown.html for details. Another patch for kernel changes is also being posted. Signed-off-by: Niraj Kumar diff -Naurp util-linux-ng-2.14.1.orig/mount/mount.c util-linux-ng-2.14.1/mount/mount.c --- util-linux-ng-2.14.1.orig/mount/mount.c 2008-09-10 14:32:43.000000000 +0530 +++ util-linux-ng-2.14.1/mount/mount.c 2008-12-09 09:37:19.000000000 +0530 @@ -132,6 +132,7 @@ static const struct opt_map opt_map[] = { "sync", 0, 0, MS_SYNCHRONOUS}, /* synchronous I/O */ { "async", 0, 1, MS_SYNCHRONOUS}, /* asynchronous I/O */ { "dirsync", 0, 0, MS_DIRSYNC}, /* synchronous directory modifications */ + { "unrestricted_chown", 0, 0, MS_UNRESTRICTED_CHOWN},/* Unrestricted Chown */ { "remount", 0, 0, MS_REMOUNT}, /* Alter flags of mounted FS */ { "bind", 0, 0, MS_BIND }, /* Remount part of tree elsewhere */ { "rbind", 0, 0, MS_BIND|MS_REC }, /* Idem, plus mounted subtrees */ diff -Naurp util-linux-ng-2.14.1.orig/mount/mount_constants.h util-linux-ng-2.14.1/mount/mount_constants.h --- util-linux-ng-2.14.1.orig/mount/mount_constants.h 2008-05-29 04:31:02.000000000 +0530 +++ util-linux-ng-2.14.1/mount/mount_constants.h 2008-12-09 09:37:19.000000000 +0530 @@ -22,6 +22,9 @@ #ifndef MS_DIRSYNC #define MS_DIRSYNC 128 /* Directory modifications are synchronous */ #endif +#ifndef MS_UNRESTRICTED_CHOWN +#define MS_UNRESTRICTED_CHOWN 256 /* Unrestricted chown */ +#endif #ifndef MS_NOATIME #define MS_NOATIME 0x400 /* 1024: Do not update access times. */ #endif