summaryrefslogtreecommitdiffstats
path: root/sshuttle
diff options
context:
space:
mode:
authorBrian May <brian@linuxpenguins.xyz>2022-04-24 17:50:05 +1000
committerBrian May <brian@linuxpenguins.xyz>2022-04-24 17:50:05 +1000
commitd6fa0c1462ea2fbaa70fde49a20de01035fafd98 (patch)
treeb7b8bae6a64380bf7d85e5fb48423e9148f2166d /sshuttle
parent9e3209e93146ceea943d4a993ac6a285babe0f75 (diff)
Replace BaseException with Exception
BaseException includes exceptions like SystemExit, KeyboardInterrupt and GeneratorExit that we should not be catching.
Diffstat (limited to 'sshuttle')
-rw-r--r--sshuttle/firewall.py24
-rw-r--r--sshuttle/hostwatch.py2
2 files changed, 13 insertions, 13 deletions
diff --git a/sshuttle/firewall.py b/sshuttle/firewall.py
index 90522c4..9108e96 100644
--- a/sshuttle/firewall.py
+++ b/sshuttle/firewall.py
@@ -199,8 +199,8 @@ def main(method_name, syslog):
break
try:
(family, width, exclude, ip, fport, lport) = \
- line.strip().split(',', 5)
- except BaseException:
+ line.strip().split(',', 5)
+ except Exception:
raise Fatal('expected route or NSLIST but got %r' % line)
subnets.append((
int(family),
@@ -222,7 +222,7 @@ def main(method_name, syslog):
break
try:
(family, ip) = line.strip().split(',', 1)
- except BaseException:
+ except Exception:
raise Fatal('expected nslist or PORTS but got %r' % line)
nslist.append((int(family), ip))
debug2('Got partial nslist: %r' % nslist)
@@ -317,46 +317,46 @@ def main(method_name, syslog):
finally:
try:
debug1('undoing changes.')
- except BaseException:
+ except Exception:
debug2('An error occurred, ignoring it.')
try:
if subnets_v6 or nslist_v6:
debug2('undoing IPv6 changes.')
method.restore_firewall(port_v6, socket.AF_INET6, udp, user)
- except BaseException:
+ except Exception:
try:
debug1("Error trying to undo IPv6 firewall.")
debug1(traceback.format_exc())
- except BaseException:
+ except Exception:
debug2('An error occurred, ignoring it.')
try:
if subnets_v4 or nslist_v4:
debug2('undoing IPv4 changes.')
method.restore_firewall(port_v4, socket.AF_INET, udp, user)
- except BaseException:
+ except Exception:
try:
debug1("Error trying to undo IPv4 firewall.")
debug1(traceback.format_exc())
- except BaseException:
+ except Exception:
debug2('An error occurred, ignoring it.')
try:
# debug2() message printed in restore_etc_hosts() function.
restore_etc_hosts(hostmap, port_v6 or port_v4)
- except BaseException:
+ except Exception:
try:
debug1("Error trying to undo /etc/hosts changes.")
debug1(traceback.format_exc())
- except BaseException:
+ except Exception:
debug2('An error occurred, ignoring it.')
try:
flush_systemd_dns_cache()
- except BaseException:
+ except Exception:
try:
debug1("Error trying to flush systemd dns cache.")
debug1(traceback.format_exc())
- except BaseException:
+ except Exception:
debug2("An error occurred, ignoring it.")
diff --git a/sshuttle/hostwatch.py b/sshuttle/hostwatch.py
index a016f4f..35ab2cc 100644
--- a/sshuttle/hostwatch.py
+++ b/sshuttle/hostwatch.py
@@ -55,7 +55,7 @@ def write_host_cache():
try:
os.unlink(tmpname)
- except BaseException:
+ except Exception:
pass