summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2011-07-07 04:57:27 +0000
committerVijay Bellur <vijay@gluster.com>2011-07-07 05:45:13 -0700
commitd53b07fef8be65763b5b03ecd99ac36c86f3a277 (patch)
tree2a3ec3bdf897d02d25e0af6d680d5cbeb7760bc1 /xlators
parentf935d0d25af51953919cc9a8732d0a545a5c3fbf (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
Diffstat (limited to 'xlators')
-rw-r--r--xlators/nfs/server/src/nfs-fops.c6
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.c15
-rw-r--r--xlators/nfs/server/src/nfs3-helpers.h3
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 0a0e01fc9..7150cc468 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 caeff9261..523fdaee9 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 73bb4b720..302d731d1 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