mirror of
https://github.com/RaspAP/raspap-webgui.git
synced 2024-11-22 07:30:23 +00:00
Escape arguments to shell functions
This commit is contained in:
parent
77eb23b0e8
commit
78d587c5a1
1 changed files with 3 additions and 3 deletions
|
@ -65,12 +65,12 @@ if (isset($_POST['interface'])) {
|
||||||
// check for an existing rule and delete lines with same MAC or same VID/PID
|
// check for an existing rule and delete lines with same MAC or same VID/PID
|
||||||
if (!empty($vid) && !empty($pid)) {
|
if (!empty($vid) && !empty($pid)) {
|
||||||
$rule = '^.*ATTRS{idVendor}==\"' . $vid . '\".*ATTRS{idProduct}==\"' . $pid . '\".*$';
|
$rule = '^.*ATTRS{idVendor}==\"' . $vid . '\".*ATTRS{idProduct}==\"' . $pid . '\".*$';
|
||||||
exec('sudo sed -i "/'.$rule.'/Id" '.$udevfile); // clear all entries with this VID/PID
|
exec('sudo sed -i "/'.escapeshellarg($rule).'/Id" '.escapeshellarg($udevfile)); // clear all entries with this VID/PID
|
||||||
$rule = '^.*ATTRS{idProduct}==\"' . $pid . '\".*ATTRS{idVendor}==\"' . $vid . '\".*$';
|
$rule = '^.*ATTRS{idProduct}==\"' . $pid . '\".*ATTRS{idVendor}==\"' . $vid . '\".*$';
|
||||||
exec('sudo sed -i "/'.$rule.'/Id" '.$udevfile); // clear all entries with this VID/PID
|
exec('sudo sed -i "/'.escapeshellarg($rule).'/Id" '.escapeshellarg($udevfile)); // clear all entries with this VID/PID
|
||||||
}
|
}
|
||||||
if (!empty($mac)) {
|
if (!empty($mac)) {
|
||||||
exec('sudo sed -i "/^.*'.$mac.'.*$/d" '.$udevfile); // clear all entries with same MAC
|
exec('sudo sed -i "/^.*'.escapeshellarg($mac).'.*$/d" '.escapeshellarg($udevfile)); // clear all entries with same MAC
|
||||||
}
|
}
|
||||||
// create new entry
|
// create new entry
|
||||||
if ( ($type != $newtype) || !empty($name) ) { // new device type or new name
|
if ( ($type != $newtype) || !empty($name) ) { // new device type or new name
|
||||||
|
|
Loading…
Reference in a new issue