diff options
author | shishir gowda <shishirng@gluster.com> | 2011-07-13 03:32:53 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-07-13 03:00:34 -0700 |
commit | e103ab41f3fd917e9a6df3d6113e2c4c3603b29b (patch) | |
tree | b6e4b9275de6a7daafd0912d38af9ca6f66829ef /xlators/nfs | |
parent | 9388760b9aad1ae2512eb108a4ca6b5c8638ea07 (diff) |
NFS access control list: Decode the NFS requests into mode format
Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Vijay Bellur <vijay@gluster.com>
BUG: 3057 ()
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3057
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 3057 (acl permissions don't work on nfs mount)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=3057
Diffstat (limited to 'xlators/nfs')
-rw-r--r-- | xlators/nfs/server/src/nfs-fops.c | 6 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.c | 15 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs3-helpers.h | 3 |
3 files changed, 22 insertions, 2 deletions
diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index 0a0e01fc9ec..7150cc46887 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -31,7 +31,7 @@ #include "nfs-fops.h" #include "inode.h" #include "nfs-common.h" - +#include "nfs3-helpers.h" #include <libgen.h> #include <semaphore.h> @@ -375,6 +375,7 @@ nfs_fop_access (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, call_frame_t *frame = NULL; int ret = -EFAULT; struct nfs_fop_local *nfl = NULL; + uint32_t accessbits = 0; if ((!xl) || (!loc) || (!nfu)) return ret; @@ -384,8 +385,9 @@ nfs_fop_access (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *loc, nfs_fop_handle_local_init (frame, nfsx, nfl, cbk, local, ret, err); nfs_fop_save_root_ino (nfl, loc); + accessbits = nfs3_request_to_accessbits (accesstest); STACK_WIND_COOKIE (frame, nfs_fop_access_cbk, xl, xl, xl->fops->access, - loc, accesstest); + loc, accessbits); ret = 0; err: if (ret < 0) { diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index caeff9261de..523fdaee9e3 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -586,7 +586,22 @@ nfs3_accessbits (int32_t accbits) return accresult; } +uint32_t +nfs3_request_to_accessbits (int32_t accbits) +{ + uint32_t acc_request = 0; + + if (accbits & (ACCESS3_READ | ACCESS3_LOOKUP)) + acc_request |= POSIX_READ; + if (accbits & (ACCESS3_MODIFY | ACCESS3_EXTEND)) + acc_request |= POSIX_WRITE; + + if (accbits & ACCESS3_EXECUTE) + acc_request |= POSIX_EXEC; + + return acc_request; +} void nfs3_fill_access3res (access3res *res, nfsstat3 status, int32_t accbits) { diff --git a/xlators/nfs/server/src/nfs3-helpers.h b/xlators/nfs/server/src/nfs3-helpers.h index 73bb4b720b1..302d731d1e7 100644 --- a/xlators/nfs/server/src/nfs3-helpers.h +++ b/xlators/nfs/server/src/nfs3-helpers.h @@ -344,4 +344,7 @@ nfs3_fdcache_remove (struct nfs3_state *nfs3, fd_t *fd); extern int nfs3_is_parentdir_entry (char *entry); + +uint32_t +nfs3_request_to_accessbits (int32_t accbits); #endif |