config access, don't try to open config.xml in write mode when file is not writeable. closes https://github.com/opnsense/core/issues/3241

This commit is contained in:
Ad Schellevis 2019-02-19 16:28:00 +01:00
parent dd1d8cba05
commit 5123277a85

View File

@ -351,7 +351,12 @@ class Config extends Singleton
}
if (!is_resource($this->config_file_handle)) {
$this->config_file_handle = fopen($this->config_file, "r+");
if (is_writable($this->config_file)) {
$this->config_file_handle = fopen($this->config_file, "r+");
} else {
// open in read-only mode
$this->config_file_handle = fopen($this->config_file, "r");
}
}
$this->simplexml = $this->loadFromStream($this->config_file_handle);