]> www.infradead.org Git - users/dwmw2/openconnect.git/commitdiff
LGTM recommendations: Except block handles 'BaseException'
authorDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Wed, 22 Sep 2021 13:55:39 +0000 (15:55 +0200)
committerDimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
Wed, 22 Sep 2021 13:55:39 +0000 (15:55 +0200)
Except block directly handles BaseException.

Signed-off-by: Dimitri Papadopoulos <3350651-DimitriPapadopoulos@users.noreply.gitlab.com>
trojans/tncc-emulate.py
trojans/tncc-wrapper.py

index 5ef15dc172104a7fabf81a873561c003109e752e..338aaa175bcdd2408e0490ddddde1b90f321139c 100755 (executable)
@@ -504,11 +504,11 @@ class tncc(object):
         else:
             try:
                 self.cj.set_cookie(dspreauth)
-            except:
+            except Exception:
                 self.set_cookie('DSPREAUTH', dspreauth)
             try:
                 self.cj.set_cookie(dssignin)
-            except:
+            except Exception:
                 self.set_cookie('DSSIGNIN', dssignin)
 
         inner = self.gen_policy_request()
@@ -580,7 +580,7 @@ class tncc(object):
                             else:
                                 logging.warning('Unknown DN type %s', str(dn_name))
                                 raise Exception()
-                        except:
+                        except Exception:
                             fail = True
                             break
                     if fail:
@@ -683,7 +683,7 @@ if __name__ == "__main__":
                     mac = netifaces.ifaddresses(iface)[netifaces.AF_LINK][0]['addr']
                     assert mac != '00:00:00:00:00:00'
                     mac_addrs.append(mac)
-                except:
+                except Exception:
                     pass
 
     hostname = os.environ.get('TNCC_HOSTNAME', socket.gethostname())
index 60b7bb0ffe18b64ca3fa3ebc636540af098785af..a86b975e2d7b78eea5851f54c4b6098190d2fe33 100755 (executable)
@@ -53,7 +53,7 @@ class Tncc:
         try:
             if zipfile.ZipFile(self.tncc_jar, 'r').testzip() is not None:
                 raise Exception()
-        except:
+        except Exception:
             print('Downloading tncc.jar...')
             os.makedirs(os.path.expanduser(TNCC_DIRECTORY), exist_ok=True)
             urllib.request.urlretrieve('https://' + self.vpn_host
@@ -65,7 +65,7 @@ class Tncc:
                     jar.getinfo(name.replace('.', '/') + '.class')
                     self.class_name = name
                     break
-                except:
+                except Exception:
                     pass
             else:
                 raise Exception('Could not find class name for', self.tncc_jar)