diff options
| author | Volker Lendecke <vl@samba.org> | 2022-08-29 17:02:25 +0200 |
|---|---|---|
| committer | Ralph Boehme <slow@samba.org> | 2022-09-02 13:31:38 +0000 |
| commit | cb0381ddc692efdff7dd1d7007e161628b8132af (patch) | |
| tree | 854a4269c9a05dec5079c8595f9237d0324a87cf /python | |
| parent | 68ba30215da2623edd0bdb6b92e576d616cee0f3 (diff) | |
| download | samba-cb0381ddc692efdff7dd1d7007e161628b8132af.tar.gz samba-cb0381ddc692efdff7dd1d7007e161628b8132af.tar.bz2 samba-cb0381ddc692efdff7dd1d7007e161628b8132af.zip | |
pylibsmb: Add create_ex()
This is an extension of the create() function allowing smb2 create
contexts to be passed back and forth and also returning the
smb_create_returns. A new function seemed necessary for me because we
need to return not just the fnum. So I chose a 3-tuple, see the test
for an example how to use this.
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/libsmb.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/python/samba/tests/libsmb.py b/python/samba/tests/libsmb.py index 1acb5b12a16..2fe4386340f 100644 --- a/python/samba/tests/libsmb.py +++ b/python/samba/tests/libsmb.py @@ -140,6 +140,18 @@ class LibsmbTestCase(samba.tests.TestCase): except: pass + def test_libsmb_CreateContexts(self): + (lp,creds) = self.prep_creds() + c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", lp, creds) + cc_in = [(libsmb.SMB2_CREATE_TAG_MXAC, b'')] + fnum,cr,cc = c.create_ex("",CreateContexts=cc_in) + self.assertEqual( + cr['file_attributes'] & libsmb.FILE_ATTRIBUTE_DIRECTORY, + libsmb.FILE_ATTRIBUTE_DIRECTORY) + self.assertEqual(cc[0][0],libsmb.SMB2_CREATE_TAG_MXAC) + self.assertEqual(len(cc[0][1]),8) + c.close(fnum) + if __name__ == "__main__": import unittest unittest.main() |
