summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-08-26 16:29:32 +0200
committerRalph Boehme <slow@samba.org>2022-09-02 13:31:38 +0000
commit51f99b7f191b18c4aabc632e4e32bfa8fc8a3ee7 (patch)
treebc411decf3eb8f48360f2ada24d2b7985b17e4e6 /python
parentb833431b5ca40d6c6b9a46f93a625aff02415113 (diff)
downloadsamba-51f99b7f191b18c4aabc632e4e32bfa8fc8a3ee7.tar.gz
samba-51f99b7f191b18c4aabc632e4e32bfa8fc8a3ee7.tar.bz2
samba-51f99b7f191b18c4aabc632e4e32bfa8fc8a3ee7.zip
tests: Test invalid smb3 unix negotiate contexts
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
Diffstat (limited to 'python')
-rw-r--r--python/samba/tests/smb3unix.py35
1 files changed, 34 insertions, 1 deletions
diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py
index d45b77a7c26..04c451b251d 100644
--- a/python/samba/tests/smb3unix.py
+++ b/python/samba/tests/smb3unix.py
@@ -17,7 +17,7 @@
from samba.samba3 import libsmb_samba_internal as libsmb
from samba.samba3 import param as s3param
-from samba import (credentials,NTSTATUSError)
+from samba import (credentials,NTSTATUSError,ntstatus)
import samba.tests
import os
@@ -68,3 +68,36 @@ class Smb3UnixTests(samba.tests.TestCase):
self.creds,
posix=True)
self.assertFalse(c.have_posix())
+
+ def test_negotiate_context_posix_invalid_length(self):
+ try:
+ self.enable_smb3unix()
+
+ with self.assertRaises(NTSTATUSError) as cm:
+ c = libsmb.Conn(
+ os.getenv("SERVER_IP"),
+ "tmp",
+ self.lp,
+ self.creds,
+ negotiate_contexts=[(0x100, b'01234')])
+
+ e = cm.exception
+ self.assertEqual(e.args[0], ntstatus.NT_STATUS_INVALID_PARAMETER)
+
+ finally:
+ self.disable_smb3unix()
+
+ def test_negotiate_context_posix_invalid_blob(self):
+ try:
+ self.enable_smb3unix()
+
+ c = libsmb.Conn(
+ os.getenv("SERVER_IP"),
+ "tmp",
+ self.lp,
+ self.creds,
+ negotiate_contexts=[(0x100, b'0123456789012345')])
+ self.assertFalse(c.have_posix())
+
+ finally:
+ self.disable_smb3unix()