]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
tests/auth_log: Simplify isRemote()
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Tue, 23 May 2023 02:20:30 +0000 (14:20 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 24 May 2023 00:50:31 +0000 (00:50 +0000)
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
python/samba/tests/auth_log_base.py

index 2f9b13e4f445fa3bc08b4b6b6e1473699a211aac..ebe9c3a124ab310267160db8bc6753df1e55a4eb 100644 (file)
@@ -98,11 +98,13 @@ class AuthLogTestBase(samba.tests.TestCase):
             if self.remoteAddress is None:
                 return True
 
-            remote = None
-            if message["type"] == "Authorization":
-                remote = message["Authorization"]["remoteAddress"]
-            elif message["type"] == "Authentication":
-                remote = message["Authentication"]["remoteAddress"]
+            supported_types = {
+                "Authentication",
+                "Authorization",
+            }
+            message_type = message["type"]
+            if message_type in supported_types:
+                remote = message[message_type]["remoteAddress"]
             else:
                 return False