Skip to content

Commit

Permalink
/vsis3/: honour CPL_VSIL_CURL_ALLOWED_EXTENSIONS configuration option (
Browse files Browse the repository at this point in the history
…fixes OSGeo#995)
  • Loading branch information
rouault committed Oct 10, 2018
1 parent cdbba83 commit 67ba5c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gdal/port/cpl_vsil_curl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2585,7 +2585,7 @@ const char* VSICurlFilesystemHandler::GetOptions()
/* IsAllowedFilename() */
/************************************************************************/

static bool IsAllowedFilename( const char* pszFilename )
bool VSICurlFilesystemHandler::IsAllowedFilename( const char* pszFilename )
{
const char* pszAllowedFilename =
CPLGetConfigOption("CPL_VSIL_CURL_ALLOWED_FILENAME", nullptr);
Expand Down
2 changes: 2 additions & 0 deletions gdal/port/cpl_vsil_curl_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ class VSICurlFilesystemHandler : public VSIFilesystemHandler

static const char* GetOptionsStatic();

static bool IsAllowedFilename( const char* pszFilename );

public:
VSICurlFilesystemHandler();
~VSICurlFilesystemHandler() override;
Expand Down
4 changes: 4 additions & 0 deletions gdal/port/cpl_vsil_s3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1414,6 +1414,10 @@ int IVSIS3LikeFSHandler::Stat( const char *pszFilename, VSIStatBufL *pStatBuf,
if( !STARTS_WITH_CI(pszFilename, GetFSPrefix()) )
return -1;

memset(pStatBuf, 0, sizeof(VSIStatBufL));
if( !IsAllowedFilename( pszFilename ) )
return -1;

CPLString osFilename(pszFilename);
if( osFilename.find('/', GetFSPrefix().size()) == std::string::npos )
osFilename += "/";
Expand Down

0 comments on commit 67ba5c6

Please sign in to comment.