aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWojciech Kosior <kwojtus@protonmail.com>2020-06-16 13:59:34 +0200
committerWojciech Kosior <kwojtus@protonmail.com>2020-06-16 13:59:34 +0200
commit64ce9667c4b55e22886191784db49260a40b417d (patch)
treeb67e41aeb467ec23d5f29eec4ecca3ada5b5dd00
parent108a2301f69763896e1a1f9eefefa30f91a4c945 (diff)
download0tdns-64ce9667c4b55e22886191784db49260a40b417d.tar.gz
0tdns-64ce9667c4b55e22886191784db49260a40b417d.zip
fix to not write records for vpns we don't handle
-rwxr-xr-xsrc/hourly.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/hourly.py b/src/hourly.py
index 0401bc1..f830bb7 100755
--- a/src/hourly.py
+++ b/src/hourly.py
@@ -69,6 +69,9 @@ def do_hourly_work(hour, logfile):
if handled_vpns:
logfile.write("Only handling vpns of ids {}\n".format(handled_vpns))
vpns = [vpn for vpn in vpns if vpn[0] in handled_vpns]
+ else:
+ # if not specfied in the config, all vpns are handled
+ hadled_vpns = [vpn[0] for vpn in vpns]
for vpn_id, config_hash in vpns:
config_path = "/var/lib/0tdns/{}.ovpn".format(config_hash)
@@ -124,8 +127,8 @@ def do_hourly_work(hour, logfile):
q.dns_id = r.dns_id AND
q.vpn_id = r.vpn_id AND
date = %s
- WHERE r.id IS NULL);
- ''', (hour, hour))
+ WHERE r.id IS NULL AND q.vpn_id = ANY(%s));
+ ''', (hour, hour, handled_vpns))
cursor.close()
connection.close()