Opened 7 years ago
Closed 7 years ago
#6380 closed enhancement (fixed)
Allow GDALDriverManager::AutoLoadDrivers to be compiled out
Reported by: | Kurt Schwehr | Owned by: | Kurt Schwehr |
---|---|---|---|
Priority: | normal | Milestone: | 2.1.0 |
Component: | default | Version: | svn-trunk |
Severity: | normal | Keywords: | |
Cc: |
Description
Some environments may want to prevent compiling in the driver autoloading system for drivers to help with security.
Going to add ifdef wrappers around the relevant code.
#ifndef GDAL_NO_AUTOLOAD /* AutoLoadDrivers code. */ #endif
I am not planning to add a configure option in the near term unless people ask for it. People wanting this feature can use USER_DEFS or modify their GDALmake.opt for now.
Change History (7)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
This will not change the normal compiled in driver behavior if you call GDALAllRegister. Only the stuff that would get loaded via GDAL_DRIVER_PATH or OGR_DRIVER_PATH. For most users, that would mean that compiling with GDAL_NO_AUTOLOAD would have no visible behavior changes. That define would block external plugins. That's why I think this removal should not be the default.
comment:3 by , 7 years ago
That sounds perfectly reasonable to me, my mistake. Thanks for the explanation Kurt.
comment:4 by , 7 years ago
Kyle, Thanks for asking. My current proposed patch:
-
frmts/gdalallregister.cpp
62 62 void CPL_STDCALL GDALAllRegister() 63 63 64 64 { 65 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined. 65 66 GetGDALDriverManager()->AutoLoadDrivers(); 66 67 67 68 #ifdef FRMT_vrt -
gcore/gdal_priv.h
1148 1148 int RegisterDriver( GDALDriver * ); 1149 1149 void DeregisterDriver( GDALDriver * ); 1150 1150 1151 // AutoLoadDrivers is a no-op if compiled with GDAL_NO_AUTOLOAD defined. 1151 1152 void AutoLoadDrivers(); 1152 1153 void AutoSkipDrivers(); 1153 1154 }; -
gcore/gdaldrivermanager.cpp
662 662 void GDALDriverManager::AutoLoadDrivers() 663 663 664 664 { 665 #ifdef GDAL_NO_AUTOLOAD 666 CPLDebug( "GDAL", "GDALDriverManager::AutoLoadDrivers() not compiled in." ); 667 #else 665 668 const char *pszGDAL_DRIVER_PATH = 666 669 CPLGetConfigOption( "GDAL_DRIVER_PATH", NULL ); 667 670 if( pszGDAL_DRIVER_PATH == NULL ) … … 815 818 } 816 819 817 820 CSLDestroy( papszSearchPath ); 821 822 #endif // GDAL_NO_AUTOLOAD 823 818 824 } 819 825 820 826 /************************************************************************/
comment:7 by , 7 years ago
Milestone: | → 2.1.0 |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Isn't this the same as not calling GDALAllRegister() and registering drivers explicitly? It seems like it could cause issues if the GDAL_NO_AUTOLOAD is set and someone calls GDALAllRegister() and it's a no-op. Just curious on the use case I guess.