mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-23 21:30:17 +00:00
Remove printf escaping (we will realize it differently) and ensure we're using single quotes for strings (although double quotes are possible, too)
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
3fe43ce1d9
commit
b4ae142149
1 changed files with 6 additions and 6 deletions
|
@ -118,11 +118,11 @@ ProcessDomainList() {
|
|||
AddDomain() {
|
||||
local domain list num
|
||||
# Use printf to escape domain. %q prints the argument in a form that can be reused as shell input
|
||||
domain="$(printf "%q" "$1")"
|
||||
domain="$1"
|
||||
list="$2"
|
||||
|
||||
# Is the domain in the list we want to add it to?
|
||||
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = \"${domain}\";")"
|
||||
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = '${domain}';")"
|
||||
|
||||
if [[ "${num}" -ne 0 ]]; then
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
|
@ -138,17 +138,17 @@ AddDomain() {
|
|||
reload=true
|
||||
# Insert only the domain here. The enabled and date_added fields will be filled
|
||||
# with their default values (enabled = true, date_added = current timestamp)
|
||||
sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (domain) VALUES (\"${domain}\");"
|
||||
sqlite3 "${gravityDBfile}" "INSERT INTO ${list} (domain) VALUES ('${domain}');"
|
||||
}
|
||||
|
||||
RemoveDomain() {
|
||||
local domain list num
|
||||
# Use printf to escape domain. %q prints the argument in a form that can be reused as shell input
|
||||
domain="$(printf "%q" "$1")"
|
||||
domain="$1"
|
||||
list="$2"
|
||||
|
||||
# Is the domain in the list we want to remove it from?
|
||||
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = \"${domain}\";")"
|
||||
num="$(sqlite3 "${gravityDBfile}" "SELECT COUNT(*) FROM ${list} WHERE domain = '${domain}';")"
|
||||
|
||||
if [[ "${num}" -eq 0 ]]; then
|
||||
if [[ "${verbose}" == true ]]; then
|
||||
|
@ -163,7 +163,7 @@ RemoveDomain() {
|
|||
fi
|
||||
reload=true
|
||||
# Remove it from the current list
|
||||
sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE domain = \"${domain}\";"
|
||||
sqlite3 "${gravityDBfile}" "DELETE FROM ${list} WHERE domain = '${domain}';"
|
||||
}
|
||||
|
||||
Displaylist() {
|
||||
|
|
Loading…
Reference in a new issue