mirror of
https://github.com/pi-hole/web.git
synced 2026-04-24 18:59:48 +01:00
Execute pihole through wrapper
All different exec() calls basically just calls sudo pihole, with various different syntaxes. Using a wrapper function allows sanitization of arguments for better safety. Signed-off-by: Samu Voutilainen <smar@smar.fi>
This commit is contained in:
@@ -81,7 +81,7 @@
|
||||
if (get_ip_type($entry->ip) == $ipType)
|
||||
return errorJsonResponse("This domain already has a custom DNS entry for an IPv" . $ipType);
|
||||
|
||||
exec("sudo pihole -a addcustomdns ".$ip." ".$domain);
|
||||
pihole_execute("-a addcustomdns ".$ip." ".$domain);
|
||||
|
||||
return successJsonResponse();
|
||||
}
|
||||
@@ -117,7 +117,7 @@
|
||||
if (!$found)
|
||||
return errorJsonResponse("This domain/ip association does not exist");
|
||||
|
||||
exec("sudo pihole -a removecustomdns ".$ip." ".$domain);
|
||||
pihole_execute("-a removecustomdns ".$ip." ".$domain);
|
||||
|
||||
return successJsonResponse();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user