lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  1 Feb 2010 11:05:04 +0530
From:	"Aneesh Kumar K.V" <aneesh.kumar@...ux.vnet.ibm.com>
To:	sfrench@...ibm.com, ffilz@...ibm.com, agruen@...e.de,
	adilger@....com, sandeen@...hat.com, tytso@....edu,
	staubach@...hat.com, bfields@...i.umich.edu, jlayton@...hat.com
Cc:	aneesh.kumar@...ux.vnet.ibm.com, linux-fsdevel@...r.kernel.org,
	nfsv4@...ux-nfs.org, linux-ext4@...r.kernel.org
Subject: [PATCH 22/23] nfsd: Add support for reading rich acl from file system

With this patch nfsd will check whether exported file system
use richacl format. If yes it will read richacl format and
map it to NFSv4acl. Richacl can be better mapped to NFSv4
acl format.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@...ux.vnet.ibm.com>
---
 fs/nfsd/vfs.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index 3046ecd..ce727a5 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -23,6 +23,7 @@
 #include <linux/quotaops.h>
 #include <linux/fsnotify.h>
 #include <linux/posix_acl_xattr.h>
+#include <linux/richacl_xattr.h>
 #include <linux/xattr.h>
 #include <linux/jhash.h>
 #include <linux/ima.h>
@@ -588,6 +589,40 @@ nfsd4_get_posix_acl(struct dentry *dentry)
 	return acl;
 }
 
+static struct richacl *
+__get_richacl(struct dentry *dentry)
+{
+	int buflen;
+	void *buf = NULL;
+	struct richacl *racl;
+
+	buflen = nfsd_getxattr(dentry, RICHACL_XATTR, &buf);
+	if (!buflen)
+		buflen = -ENODATA;
+	if (buflen <= 0)
+		return ERR_PTR(buflen);
+
+	racl = richacl_from_xattr(buf, buflen);
+	kfree(buf);
+	return racl;
+}
+
+static struct nfs4_acl *
+nfsd4_get_richacl(struct dentry *dentry)
+{
+	struct nfs4_acl *acl;
+	struct richacl *racl;
+	racl = __get_richacl(dentry);
+	if (IS_ERR(racl) && PTR_ERR(racl) == -ENODATA)
+		racl = richacl_from_mode(dentry->d_inode->i_mode);
+	if (IS_ERR(racl))
+		return ERR_PTR(PTR_ERR(racl));
+	acl = nfs4_acl_richacl_to_nfsv4(racl);
+
+	richacl_put(racl);
+	return acl;
+}
+
 int
 nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_acl **acl)
 {
@@ -596,6 +631,8 @@ nfsd4_get_nfs4_acl(struct svc_rqst *rqstp, struct dentry *dentry, struct nfs4_ac
 
 	if (IS_POSIXACL(inode))
 		*acl = nfsd4_get_posix_acl(dentry);
+	else if (IS_RICHACL(inode))
+		*acl = nfsd4_get_richacl(dentry);
 	else {
 		*acl = NULL;
 		error = -EOPNOTSUPP;
-- 
1.7.0.rc0.48.gdace5

--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ