1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 06:48:07 +00:00

Merge pull request #4178 from pi-hole/fix/custom_dns_removal

Add missing sed anchors when deleting lines.
This commit is contained in:
Adam Warner 2021-07-04 00:35:00 +01:00 committed by GitHub
commit a1d85155fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -716,7 +716,7 @@ RemoveCustomDNSAddress() {
host="${args[3]}" host="${args[3]}"
if valid_ip "${ip}" || valid_ip6 "${ip}" ; then if valid_ip "${ip}" || valid_ip6 "${ip}" ; then
sed -i "/${ip} ${host}/d" "${dnscustomfile}" sed -i "/^${ip} ${host}$/d" "${dnscustomfile}"
else else
echo -e " ${CROSS} Invalid IP has been passed" echo -e " ${CROSS} Invalid IP has been passed"
exit 1 exit 1
@ -748,7 +748,7 @@ RemoveCustomCNAMERecord() {
if [[ -n "${validDomain}" ]]; then if [[ -n "${validDomain}" ]]; then
validTarget="$(checkDomain "${target}")" validTarget="$(checkDomain "${target}")"
if [[ -n "${validDomain}" ]]; then if [[ -n "${validDomain}" ]]; then
sed -i "/cname=${validDomain},${validTarget}/d" "${dnscustomcnamefile}" sed -i "/cname=${validDomain},${validTarget}$/d" "${dnscustomcnamefile}"
else else
echo " ${CROSS} Invalid Target Passed!" echo " ${CROSS} Invalid Target Passed!"
exit 1 exit 1