mirror of
https://github.com/s3fs-fuse/s3fs-fuse.git
synced 2024-12-23 01:08:54 +00:00
Merge pull request #894 from gaul/default-mode
Default uid/gid/mode when object lacks permissions
This commit is contained in:
commit
25b49e1a2e
@ -802,11 +802,13 @@ mode_t get_mode(headers_t& meta, const char* path, bool checkdir, bool forcedir)
|
|||||||
|
|
||||||
if(meta.end() != (iter = meta.find("x-amz-meta-mode"))){
|
if(meta.end() != (iter = meta.find("x-amz-meta-mode"))){
|
||||||
mode = get_mode((*iter).second.c_str());
|
mode = get_mode((*iter).second.c_str());
|
||||||
}else{
|
}else if(meta.end() != (iter = meta.find("x-amz-meta-permissions"))){ // for s3sync
|
||||||
if(meta.end() != (iter = meta.find("x-amz-meta-permissions"))){ // for s3sync
|
|
||||||
mode = get_mode((*iter).second.c_str());
|
mode = get_mode((*iter).second.c_str());
|
||||||
isS3sync = true;
|
isS3sync = true;
|
||||||
}
|
}else{
|
||||||
|
// If another tool creates an object without permissions, default to owner
|
||||||
|
// read-write and group readable.
|
||||||
|
mode = path[strlen(path) - 1] == '/' ? 0750 : 0640;
|
||||||
}
|
}
|
||||||
// Checking the bitmask, if the last 3 bits are all zero then process as a regular
|
// Checking the bitmask, if the last 3 bits are all zero then process as a regular
|
||||||
// file type (S_IFDIR or S_IFREG), otherwise return mode unmodified so that S_IFIFO,
|
// file type (S_IFDIR or S_IFREG), otherwise return mode unmodified so that S_IFIFO,
|
||||||
@ -876,12 +878,13 @@ uid_t get_uid(const char *s)
|
|||||||
uid_t get_uid(headers_t& meta)
|
uid_t get_uid(headers_t& meta)
|
||||||
{
|
{
|
||||||
headers_t::const_iterator iter;
|
headers_t::const_iterator iter;
|
||||||
if(meta.end() == (iter = meta.find("x-amz-meta-uid"))){
|
if(meta.end() != (iter = meta.find("x-amz-meta-uid"))){
|
||||||
if(meta.end() == (iter = meta.find("x-amz-meta-owner"))){ // for s3sync
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return get_uid((*iter).second.c_str());
|
return get_uid((*iter).second.c_str());
|
||||||
|
}else if(meta.end() != (iter = meta.find("x-amz-meta-owner"))){ // for s3sync
|
||||||
|
return get_uid((*iter).second.c_str());
|
||||||
|
}else{
|
||||||
|
return geteuid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gid_t get_gid(const char *s)
|
gid_t get_gid(const char *s)
|
||||||
@ -892,12 +895,13 @@ gid_t get_gid(const char *s)
|
|||||||
gid_t get_gid(headers_t& meta)
|
gid_t get_gid(headers_t& meta)
|
||||||
{
|
{
|
||||||
headers_t::const_iterator iter;
|
headers_t::const_iterator iter;
|
||||||
if(meta.end() == (iter = meta.find("x-amz-meta-gid"))){
|
if(meta.end() != (iter = meta.find("x-amz-meta-gid"))){
|
||||||
if(meta.end() == (iter = meta.find("x-amz-meta-group"))){ // for s3sync
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return get_gid((*iter).second.c_str());
|
return get_gid((*iter).second.c_str());
|
||||||
|
}else if(meta.end() != (iter = meta.find("x-amz-meta-group"))){ // for s3sync
|
||||||
|
return get_gid((*iter).second.c_str());
|
||||||
|
}else{
|
||||||
|
return getegid();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
blkcnt_t get_blocks(off_t size)
|
blkcnt_t get_blocks(off_t size)
|
||||||
|
Loading…
Reference in New Issue
Block a user