mirror of
https://github.com/eclipse-mosquitto/mosquitto.git
synced 2026-02-05 18:50:06 +08:00
Add MOSQUITTO_UNSAFE_ALLOW_SYMLINKS env var
Setting this environment variable allows sensitive files to be read through symlinks. Closes #3461. Thanks to Jeff Cutsinger
This commit is contained in:
@@ -166,7 +166,10 @@ FILE *mosquitto_fopen(const char *path, const char *mode, bool restrict_read)
|
||||
|
||||
old_mask = umask(0077);
|
||||
|
||||
int open_flags = O_NOFOLLOW;
|
||||
int open_flags = 0;
|
||||
if(!getenv("MOSQUITTO_UNSAFE_ALLOW_SYMLINKS")){
|
||||
open_flags |= O_NOFOLLOW;
|
||||
}
|
||||
for(size_t i = 0; i<strlen(mode); i++){
|
||||
if(mode[i] == 'r'){
|
||||
open_flags |= O_RDONLY;
|
||||
|
||||
Reference in New Issue
Block a user