From b65c3e195eadfb61d07c68777f74c94d965fc4c2 Mon Sep 17 00:00:00 2001 From: "ggtakec@gmail.com" Date: Tue, 18 Jun 2013 01:17:32 +0000 Subject: [PATCH] Fixed Issue 346 1) Not recognizing group permissions( Issue 346 ) Fixed umask option which works correctly. git-svn-id: http://s3fs.googlecode.com/svn/trunk@448 df820570-a93a-0410-bd06-b72b767a4274 --- src/s3fs.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/s3fs.cpp b/src/s3fs.cpp index 3941d83..741d861 100644 --- a/src/s3fs.cpp +++ b/src/s3fs.cpp @@ -109,6 +109,8 @@ static bool content_md5 = false; static bool allow_other = false; static uid_t s3fs_uid = 0; // default = root. static gid_t s3fs_gid = 0; // default = root. +static bool is_s3fs_umask = false;// default does not set. +static mode_t s3fs_umask = 0; static bool dns_cache = true; // default = true // if .size()==0 then local file cache is disabled @@ -481,6 +483,10 @@ static int check_object_access(const char *path, int mask, struct stat* pstbuf) if(1 == is_uid_inculde_group(pcxt->uid, obj_gid)){ base_mask |= S_IRWXG; } + if(is_s3fs_umask){ + // If umask is set, all object attributes set ~umask. + mode |= ((S_IRWXU | S_IRWXG | S_IRWXO) & ~s3fs_umask); + } mode &= base_mask; if(X_OK == (mask & X_OK)){ @@ -4180,6 +4186,12 @@ static int my_fuse_opt_proc(void *data, const char *arg, int key, struct fuse_ar s3fs_gid = strtoul(strchr(arg, '=') + 1, 0, 10); return 1; // continue for fuse option } + if(strstr(arg, "umask=") != 0){ + s3fs_umask = (mode_t)strtoul(strchr(arg, '=') + 1, 0, 8); + s3fs_umask &= (S_IRWXU | S_IRWXG | S_IRWXO); + is_s3fs_umask = true; + return 1; // continue for fuse option + } if(strstr(arg, "allow_other") != 0){ allow_other = true; return 1; // continue for fuse option