Merge pull request #594 from ggtakec/master

Check bucket at public bucket and add nocopyapi option automatically
This commit is contained in:
Takeshi Nakatani 2017-05-13 17:01:21 +09:00 committed by GitHub
commit caea087aec
3 changed files with 12 additions and 4 deletions

View File

@ -135,6 +135,7 @@ If you specify this option for set "Content-Encoding" HTTP header, please take c
.TP .TP
\fB\-o\fR public_bucket (default="" which means disabled) \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. 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 .TP
\fB\-o\fR connect_timeout (default="300" seconds) \fB\-o\fR connect_timeout (default="300" seconds)
time to wait for connection before giving up. time to wait for connection before giving up.

View File

@ -3419,9 +3419,7 @@ static void* s3fs_init(struct fuse_conn_info* conn)
} }
// Check Bucket // 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; int result;
if(EXIT_SUCCESS != (result = s3fs_check_service())){ if(EXIT_SUCCESS != (result = s3fs_check_service())){
s3fs_exit_fuseloop(result); s3fs_exit_fuseloop(result);
@ -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)); off_t pubbucket = s3fs_strtoofft(strchr(arg, '=') + sizeof(char));
if(1 == pubbucket){ if(1 == pubbucket){
S3fsCurl::SetPublicBucket(true); 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){ }else if(0 == pubbucket){
S3fsCurl::SetPublicBucket(false); S3fsCurl::SetPublicBucket(false);
}else{ }else{

View File

@ -1036,7 +1036,11 @@ void show_help (void)
" file contents.\n" " file contents.\n"
"\n" "\n"
" public_bucket (default=\"\" which means disabled)\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" "\n"
" passwd_file (default=\"\")\n" " passwd_file (default=\"\")\n"
" - specify which s3fs password file to use\n" " - specify which s3fs password file to use\n"