Merge pull request #119 from s3fs-fuse/issue#107

Added new mp_umask option about issue#107, pr#110
This commit is contained in:
Takeshi Nakatani 2015-02-08 02:19:54 +09:00
commit 5bf2b46fa3
3 changed files with 23 additions and 1 deletions

View File

@ -159,6 +159,12 @@ So s3fs can know the correct region name, because s3fs can find it in an error f
\fB\-o\fR sigv2 (default is signature version 4) \fB\-o\fR sigv2 (default is signature version 4)
sets signing AWS requests by sing Signature Version 2. sets signing AWS requests by sing Signature Version 2.
.TP .TP
\fB\-o\fR mp_umask (default is "0000")
sets umask for the mount point directory.
If allow_other option is not set, s3fs allows access to the mount point only to the owner.
In the opposite case s3fs allows access to all users as the default.
But if you set the allow_other with this option, you can controll the permission permissions of the mount point by this option like umask.
.TP
\fB\-o\fR nomultipart - disable multipart uploads \fB\-o\fR nomultipart - disable multipart uploads
.TP .TP
\fB\-o\fR enable_content_md5 ( default is disable ) \fB\-o\fR enable_content_md5 ( default is disable )

View File

@ -97,6 +97,8 @@ std::string endpoint = "us-east-1";
static uid_t mp_uid = 0; // owner of mount point(only not specified uid opt) static uid_t mp_uid = 0; // owner of mount point(only not specified uid opt)
static gid_t mp_gid = 0; // group of mount point(only not specified gid opt) static gid_t mp_gid = 0; // group of mount point(only not specified gid opt)
static mode_t mp_mode = 0; // mode of mount point static mode_t mp_mode = 0; // mode of mount point
static mode_t mp_umask = 0; // umask for mount point
static bool is_mp_umask = false;// default does not set.
static std::string mountpoint; static std::string mountpoint;
static std::string passwd_file = ""; static std::string passwd_file = "";
static bool utility_mode = false; static bool utility_mode = false;
@ -3474,7 +3476,7 @@ static int set_moutpoint_attribute(struct stat& mpst)
{ {
mp_uid = geteuid(); mp_uid = geteuid();
mp_gid = getegid(); mp_gid = getegid();
mp_mode = S_IFDIR | (allow_other ? (S_IRWXU | S_IRWXG | S_IRWXO) : S_IRWXU); mp_mode = S_IFDIR | (allow_other ? (is_mp_umask ? (~mp_umask & (S_IRWXU | S_IRWXG | S_IRWXO)) : (S_IRWXU | S_IRWXG | S_IRWXO)) : S_IRWXU);
FPRNNN("PROC(uid=%u, gid=%u) - MountPoint(uid=%u, gid=%u, mode=%04o)", FPRNNN("PROC(uid=%u, gid=%u) - MountPoint(uid=%u, gid=%u, mode=%04o)",
(unsigned int)mp_uid, (unsigned int)mp_gid, (unsigned int)(mpst.st_uid), (unsigned int)(mpst.st_gid), mpst.st_mode); (unsigned int)mp_uid, (unsigned int)mp_gid, (unsigned int)(mpst.st_uid), (unsigned int)(mpst.st_gid), mpst.st_mode);
@ -3612,6 +3614,12 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
allow_other = true; allow_other = true;
return 1; // continue for fuse option return 1; // continue for fuse option
} }
if(0 == STR2NCMP(arg, "mp_umask=")){
mp_umask = strtol(strchr(arg, '=') + sizeof(char), NULL, 0);
mp_umask &= (S_IRWXU | S_IRWXG | S_IRWXO);
is_mp_umask = true;
return 0;
}
if(0 == STR2NCMP(arg, "default_acl=")){ if(0 == STR2NCMP(arg, "default_acl=")){
const char* acl = strchr(arg, '=') + sizeof(char); const char* acl = strchr(arg, '=') + sizeof(char);
S3fsCurl::SetDefaultAcl(acl); S3fsCurl::SetDefaultAcl(acl);

View File

@ -989,6 +989,14 @@ void show_help (void)
" sigv2 (default is signature version 4)\n" " sigv2 (default is signature version 4)\n"
" - sets signing AWS requests by sing Signature Version 2\n" " - sets signing AWS requests by sing Signature Version 2\n"
"\n" "\n"
" mp_umask (default is \"0000\")\n"
" - sets umask for the mount point directory.\n"
" If allow_other option is not set, s3fs allows access to the mount\n"
" point only to the owner. In the opposite case s3fs allows access\n"
" to all users as the default. But if you set the allow_other with\n"
" this option, you can controll the permission permissions of the\n"
" mount point by this option like umask.\n"
"\n"
" nomultipart (disable multipart uploads)\n" " nomultipart (disable multipart uploads)\n"
"\n" "\n"
" enable_content_md5 (default is disable)\n" " enable_content_md5 (default is disable)\n"