Check bucket at public bucket and add nocopyapi option automatically

This commit is contained in:
Takeshi Nakatani
2017-05-13 07:35:55 +00:00
parent 551c6acf67
commit 7115835834
3 changed files with 25 additions and 1 deletions

View File

@ -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.

View File

@ -3419,6 +3419,8 @@ static void* s3fs_init(struct fuse_conn_info* conn)
}
// Check Bucket
//TEST
/*****************
// If the network is up, check for valid credentials and if the bucket
// exists. skip check if mounting a public bucket
if(!S3fsCurl::IsPublicBucket()){
@ -3428,6 +3430,16 @@ static void* s3fs_init(struct fuse_conn_info* conn)
return NULL;
}
}
***************/
{
int result;
if(EXIT_SUCCESS != (result = s3fs_check_service())){
s3fs_exit_fuseloop(result);
return NULL;
}
}
//TEST
// Investigate system capabilities
#ifndef __APPLE__
@ -4569,6 +4581,13 @@ 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);
//TEST
// [NOTE]
// if bucket is public(without credential), s3 do not allow copy api.
// so s3fs sets nocopyapi mode.
//
nocopyapi = true;
//TEST
}else if(0 == pubbucket){
S3fsCurl::SetPublicBucket(false);
}else{

View File

@ -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"