Skip to content

Commit

Permalink
Merge pull request s3fs-fuse#594 from ggtakec/master
Browse files Browse the repository at this point in the history
Check bucket at public bucket and add nocopyapi option automatically
  • Loading branch information
ggtakec authored May 13, 2017
2 parents 551c6ac + d2ae14d commit caea087
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions doc/man/s3fs.1
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ If you specify this option for set "Content-Encoding" HTTP header, please take c
.TP
\fB\-o\fR public_bucket (default="" which means disabled)
anonymously mount a public bucket when set to 1, ignores the $HOME/.passwd-s3fs and /etc/passwd-s3fs files.
S3 does not allow copy object api for anonymous users, then s3fs sets nocopyapi option automatically when public_bucket=1 option is specified.
.TP
\fB\-o\fR connect_timeout (default="300" seconds)
time to wait for connection before giving up.
Expand Down
9 changes: 6 additions & 3 deletions src/s3fs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3419,9 +3419,7 @@ static void* s3fs_init(struct fuse_conn_info* conn)
}

// Check Bucket
// If the network is up, check for valid credentials and if the bucket
// exists. skip check if mounting a public bucket
if(!S3fsCurl::IsPublicBucket()){
{
int result;
if(EXIT_SUCCESS != (result = s3fs_check_service())){
s3fs_exit_fuseloop(result);
Expand Down Expand Up @@ -4569,6 +4567,11 @@ static int my_fuse_opt_proc(void* data, const char* arg, int key, struct fuse_ar
off_t pubbucket = s3fs_strtoofft(strchr(arg, '=') + sizeof(char));
if(1 == pubbucket){
S3fsCurl::SetPublicBucket(true);
// [NOTE]
// if bucket is public(without credential), s3 do not allow copy api.
// so s3fs sets nocopyapi mode.
//
nocopyapi = true;
}else if(0 == pubbucket){
S3fsCurl::SetPublicBucket(false);
}else{
Expand Down
6 changes: 5 additions & 1 deletion src/s3fs_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,11 @@ void show_help (void)
" file contents.\n"
"\n"
" public_bucket (default=\"\" which means disabled)\n"
" - anonymously mount a public bucket when set to 1\n"
" - anonymously mount a public bucket when set to 1, ignores the \n"
" $HOME/.passwd-s3fs and /etc/passwd-s3fs files.\n"
" S3 does not allow copy object api for anonymous users, then\n"
" s3fs sets nocopyapi option automatically when public_bucket=1\n"
" option is specified.\n"
"\n"
" passwd_file (default=\"\")\n"
" - specify which s3fs password file to use\n"
Expand Down

0 comments on commit caea087

Please sign in to comment.