The branch, master has been updated via 6f1a9ef2072 lib:replace: Require bool from C99 via ae86c620aad lib:replace: Fix trailing whitespace in wscript via 3de61dc6773 wafsamba: Add -Werror=implicit-int via 0e8949bde01 wafsamba: Add -Werror=old-style-definition via b787692b5e9 s3:utils: Fix old-style function definition via 81f4335dfb8 s3:client: Fix old-style function definition via 80dc3bc2b80 s3:param: Fix old-style function definition via 7e29e70fd98 pylibsmb: Simplify py_cli_create_returns() via 6d552b1e3e0 pylibsmb: Simplify py_cli_create_contexts() via fa7ad454860 smbd: Apply some const to a variable that's never changed via 9d4ac46ea80 tests: Use samba.tests.libsmb.LibsmbTests in smb3unix.py via ab2c3859d62 tests: Use samba.tests.libsmb.LibsmbTests in libsmb-basic.py via 6be2d465704 tests: Factor out libsmb environment setup via 4638eebae8a tests: Rename python/samba/tests/libsmb.py via 51e65fa9cb4 lib: Whitespace fixes via 6d334fe2d40 ntvfs: Remove orphans from 2006 via 15f958d76e4 rpc_server: Remove an unneeded #include via 23ba1dabf5d lib: Avoid an #include includes.h via eaf38a445dc lib: Avoid an #include includes.h via 167bc2cfc5d librpc: Avoid an else via 8971f2ae0f6 librpc: Align integer types via b0d321f8332 librpc: Fix a typo via e287dfe9ed5 librpc: Add a pair of {} via 53d1b188e8b pyrpc4: Simplify py_ndr_syntax_id() with GUID_buf_string() via a91ff509fd0 lib: Avoid an includes.h via 12a556bded1 lib: Remove two unused macros via 653bcbc1f48 gensec: Align an integer type via f3eeb922c41 torture3: Fix an error message via 6404c3f64be smbd: Cut long lines via 801731b60fd smbd: Remove "link_depth" parameter from non_widelink_open() via 80856941bff smbd: Remove a comment left by copy&paste via 8b55dabf553 winbind: Add smbconf fallback for gpupdate_callback via ea1f53fc8be winbind: Fix user gpupdate called with NULL smb.conf from 0a66c739532 s3-lib: restore truncating behavior of push_ascii_nstring()
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 6f1a9ef2072621a22cd0f38c89afc5c7598682e3 Author: Andreas Schneider <a...@samba.org> Date: Thu Oct 27 08:32:20 2022 +0200 lib:replace: Require bool from C99 https://fedoraproject.org/wiki/Changes/PortingToModernC We define True to true from stdbool.h and the same for false. So we don't have to do a cleanup now. Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Thu Oct 27 19:11:30 UTC 2022 on sn-devel-184 commit ae86c620aadea19e47e3f7967b4770d496d4bc02 Author: Andreas Schneider <a...@samba.org> Date: Thu Oct 27 10:45:40 2022 +0200 lib:replace: Fix trailing whitespace in wscript Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 3de61dc6773c67f44477f889deadf92656f3379e Author: Andreas Schneider <a...@samba.org> Date: Thu Oct 27 08:27:13 2022 +0200 wafsamba: Add -Werror=implicit-int https://fedoraproject.org/wiki/Changes/PortingToModernC Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 0e8949bde01b5007612c1c0a17e10d2c5bbb1846 Author: Andreas Schneider <a...@samba.org> Date: Thu Oct 27 08:43:39 2022 +0200 wafsamba: Add -Werror=old-style-definition See https://fedoraproject.org/wiki/Changes/PortingToModernC Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit b787692b5e915031d4653bf375995320ed1aca07 Author: Andreas Schneider <a...@samba.org> Date: Thu Oct 27 08:47:32 2022 +0200 s3:utils: Fix old-style function definition Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 81f4335dfb847c041bfd3d6110fc8f1d5741d41f Author: Andreas Schneider <a...@samba.org> Date: Thu Oct 27 08:46:39 2022 +0200 s3:client: Fix old-style function definition Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 80dc3bc2b80634ab7c6c71fa1f9b94f0216322b2 Author: Andreas Schneider <a...@samba.org> Date: Thu Oct 27 08:44:58 2022 +0200 s3:param: Fix old-style function definition Signed-off-by: Andreas Schneider <a...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 7e29e70fd98c11f988d2941df0f999710cd2e700 Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 26 14:19:43 2022 +0200 pylibsmb: Simplify py_cli_create_returns() Py_BuildValue() can create dictionaries. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6d552b1e3e00e5aee0a006df439668175a694ffc Author: Volker Lendecke <v...@samba.org> Date: Thu Oct 20 16:46:18 2022 +0200 pylibsmb: Simplify py_cli_create_contexts() Py_BuildValue() can create tuples. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit fa7ad454860fb6866fff2f7e075f9c8f64afa0c1 Author: Volker Lendecke <v...@samba.org> Date: Fri Oct 7 11:55:18 2022 +0200 smbd: Apply some const to a variable that's never changed Probably doesn't do much in compiled code, but looks cleaner to me Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 9d4ac46ea80ff214ce8055565f1268caa16a59ad Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 19 09:38:36 2022 +0000 tests: Use samba.tests.libsmb.LibsmbTests in smb3unix.py Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ab2c3859d62eb46aab1465e928f46aeb4c84b1b7 Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 19 11:34:40 2022 +0200 tests: Use samba.tests.libsmb.LibsmbTests in libsmb-basic.py Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6be2d465704b5c41863d490310735dccc3465b1c Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 19 11:32:22 2022 +0200 tests: Factor out libsmb environment setup Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 4638eebae8af6a1348ab7534d00a81789694bda5 Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 19 10:59:17 2022 +0200 tests: Rename python/samba/tests/libsmb.py samba/libsmb.py will become a common file to do the library initialization for our tests. We already have two copies in smb3unix.py and libsmb.py, and there might be more soon. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 51e65fa9cb4711194e494d3001addc947ec9597a Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 12 21:16:34 2022 +0200 lib: Whitespace fixes Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6d334fe2d401d1754e255f21cc48e2d050060b2b Author: Volker Lendecke <v...@samba.org> Date: Thu Mar 17 19:33:36 2022 +0100 ntvfs: Remove orphans from 2006 Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 15f958d76e4df1ca634800fbd318a456b933ccf7 Author: Volker Lendecke <v...@samba.org> Date: Mon Mar 21 13:31:49 2022 +0100 rpc_server: Remove an unneeded #include Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 23ba1dabf5da48a5381a67c5a1dda161199ccbb0 Author: Volker Lendecke <v...@samba.org> Date: Thu Mar 17 16:10:57 2022 +0100 lib: Avoid an #include includes.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit eaf38a445dce54e8bb7561ba3a8a86c8f7f95bb1 Author: Volker Lendecke <v...@samba.org> Date: Thu Mar 17 16:19:39 2022 +0100 lib: Avoid an #include includes.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 167bc2cfc5d7cd3997fb08e64a27f63774e27a75 Author: Volker Lendecke <v...@samba.org> Date: Thu Mar 17 17:14:40 2022 +0100 librpc: Avoid an else With an early return; we don't need the "else" Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8971f2ae0f61f310f733f252ab87c3aa442de71a Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 19 17:57:15 2022 +0100 librpc: Align integer types Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit b0d321f8332522f2c327f06ec322a693d483bc4e Author: Volker Lendecke <v...@samba.org> Date: Sat Mar 19 18:38:04 2022 +0100 librpc: Fix a typo Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit e287dfe9ed553f60070f8b13934fcbc47f4160f9 Author: Volker Lendecke <v...@samba.org> Date: Sun Mar 20 08:43:34 2022 +0100 librpc: Add a pair of {} Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 53d1b188e8bd56c4e9f3c088db18842782027e95 Author: Volker Lendecke <v...@samba.org> Date: Thu Mar 17 17:18:21 2022 +0100 pyrpc4: Simplify py_ndr_syntax_id() with GUID_buf_string() Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit a91ff509fd02374617198fbedc180507842b7a1e Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 12 21:22:42 2022 +0200 lib: Avoid an includes.h Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 12a556bded11d08456f7a0256702f4e5157383d7 Author: Volker Lendecke <v...@samba.org> Date: Wed Oct 12 21:27:32 2022 +0200 lib: Remove two unused macros Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 653bcbc1f48ec2a211c872e24ff5c93685c6cf37 Author: Volker Lendecke <v...@samba.org> Date: Sun Oct 16 16:02:31 2022 +0200 gensec: Align an integer type Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit f3eeb922c41ebb9ce9a242497195490a0b003213 Author: Volker Lendecke <v...@samba.org> Date: Thu Oct 13 11:08:06 2022 +0200 torture3: Fix an error message Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 6404c3f64be8a2a7abf050e65cee446d190c0647 Author: Volker Lendecke <v...@samba.org> Date: Fri Oct 7 13:53:39 2022 +0200 smbd: Cut long lines This is recent enough to justify just a README.Coding formatting change Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 801731b60fd4a4bfea7279a6942c35fdf1a4e1c6 Author: Volker Lendecke <v...@samba.org> Date: Thu Oct 20 17:08:40 2022 +0200 smbd: Remove "link_depth" parameter from non_widelink_open() We don't recurse anymore but loop inside. Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 80856941bff8e32cd76cbd3b05e05c9754785bf9 Author: Volker Lendecke <v...@samba.org> Date: Mon Oct 24 20:24:53 2022 +0200 smbd: Remove a comment left by copy&paste Signed-off-by: Volker Lendecke <v...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit 8b55dabf55335dc91cef54db8888ec40c9932434 Author: David Mulder <dmul...@samba.org> Date: Thu Oct 27 06:40:41 2022 -0600 winbind: Add smbconf fallback for gpupdate_callback We should use the configfile specified, but also fallback if none is specified. Signed-off-by: David Mulder <dmul...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> commit ea1f53fc8be3d7930efb2484bc7c2a41ac4a95df Author: David Mulder <dmul...@samba.org> Date: Wed Oct 26 12:37:01 2022 -0600 winbind: Fix user gpupdate called with NULL smb.conf Signed-off-by: David Mulder <dmul...@samba.org> Reviewed-by: Jeremy Allison <j...@samba.org> ----------------------------------------------------------------------- Summary of changes: buildtools/wafsamba/samba_autoconf.py | 4 + lib/replace/replace.h | 6 +- lib/replace/wscript | 9 +- python/samba/tests/{libsmb.py => libsmb-basic.py} | 55 ++++----- python/samba/tests/libsmb.py | 142 +++------------------- python/samba/tests/smb3unix.py | 36 ++---- source3/client/clitar.c | 2 +- source3/include/adt_tree.h | 8 +- source3/include/smb_macros.h | 6 - source3/lib/adt_tree.c | 59 ++++----- source3/lib/cleanupdb.c | 8 +- source3/lib/cleanupdb.h | 10 +- source3/lib/util_cluster.c | 4 +- source3/libsmb/pylibsmb.c | 89 +++++--------- source3/param/loadparm.c | 4 +- source3/smbd/filename.c | 10 +- source3/smbd/open.c | 8 +- source3/torture/test_posix.c | 2 +- source3/utils/ntlm_auth.c | 12 +- source3/winbindd/winbindd_gpupdate.c | 8 +- source4/auth/gensec/gensec_tstream.c | 2 +- source4/librpc/rpc/dcerpc_connect.c | 3 +- source4/librpc/rpc/dcerpc_util.c | 6 +- source4/librpc/rpc/pyrpc.c | 17 ++- source4/ntvfs/ipc/ipc.h | 0 source4/ntvfs/ipc/np_echo.c | 0 source4/ntvfs/ipc/rap_server.c | 1 - source4/rpc_server/service_rpc.c | 1 - source4/selftest/tests.py | 2 +- third_party/heimdal_build/wscript_configure | 3 +- 30 files changed, 176 insertions(+), 341 deletions(-) copy python/samba/tests/{libsmb.py => libsmb-basic.py} (73%) delete mode 100644 source4/ntvfs/ipc/ipc.h delete mode 100644 source4/ntvfs/ipc/np_echo.c Changeset truncated at 500 lines: diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index 3ca2f334190..f3168f94a51 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -775,6 +775,8 @@ def SAMBA_CONFIG_H(conf, path=None): testflags=True) conf.ADD_CFLAGS('-Werror-implicit-function-declaration', testflags=True) + conf.ADD_CFLAGS('-Werror=implicit-int', + testflags=True) conf.ADD_CFLAGS('-Werror=pointer-arith -Wpointer-arith', testflags=True) conf.ADD_CFLAGS('-Werror=declaration-after-statement -Wdeclaration-after-statement', @@ -787,6 +789,8 @@ def SAMBA_CONFIG_H(conf, path=None): testflags=True) conf.ADD_CFLAGS('-Werror=strict-overflow -Wstrict-overflow=2', testflags=True) + conf.ADD_CFLAGS('-Werror=old-style-definition -Wold-style-definition', + testflags=True) conf.ADD_CFLAGS('-Wformat=2 -Wno-format-y2k', testflags=True) conf.ADD_CFLAGS('-Wno-format-zero-length', testflags=True) diff --git a/lib/replace/replace.h b/lib/replace/replace.h index bd7f6e53e81..de50761d000 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -699,13 +699,9 @@ int rep_strerror_r(int errnum, char *buf, size_t buflen); #include <stdbool.h> #endif -#if !defined(HAVE_BOOL) -#ifdef HAVE__Bool -#define bool _Bool -#else +#ifndef HAVE_BOOL #error Need a real boolean type #endif -#endif #if !defined(HAVE_INTPTR_T) typedef long long intptr_t ; diff --git a/lib/replace/wscript b/lib/replace/wscript index 2f179992c82..b1ca95515a0 100644 --- a/lib/replace/wscript +++ b/lib/replace/wscript @@ -160,8 +160,7 @@ def configure(conf): msg='Checking for O_DIRECT flag to open(2)') conf.CHECK_TYPES('"long long" intptr_t uintptr_t ptrdiff_t comparison_fn_t') - if not conf.CHECK_TYPE('bool', define='HAVE_BOOL'): - if not conf.CHECK_TYPE('_Bool', define='HAVE__Bool'): + if not conf.CHECK_TYPE('bool', define='HAVE_BOOL', headers='stdbool.h'): raise Errors.WafError('Samba requires a genuine boolean type') conf.CHECK_TYPE('int8_t', 'char') @@ -934,9 +933,9 @@ def build(bld): bld.SAMBA_LIBRARY('replace', source=REPLACE_SOURCE, group='base_libraries', - # FIXME: Ideally symbols should be hidden here so they - # don't appear in the global namespace when Samba - # libraries are loaded, but this doesn't appear to work + # FIXME: Ideally symbols should be hidden here so they + # don't appear in the global namespace when Samba + # libraries are loaded, but this doesn't appear to work # at the moment: # hide_symbols=bld.BUILTIN_LIBRARY('replace'), private_library=True, diff --git a/python/samba/tests/libsmb.py b/python/samba/tests/libsmb-basic.py similarity index 73% copy from python/samba/tests/libsmb.py copy to python/samba/tests/libsmb-basic.py index 2fe4386340f..36566436e87 100644 --- a/python/samba/tests/libsmb.py +++ b/python/samba/tests/libsmb-basic.py @@ -19,18 +19,16 @@ from samba.samba3 import libsmb_samba_internal as libsmb from samba.dcerpc import security -from samba.samba3 import param as s3param -from samba import (credentials,NTSTATUSError) +from samba import NTSTATUSError from samba.ntstatus import NT_STATUS_DELETE_PENDING from samba.credentials import SMB_ENCRYPTION_REQUIRED -import samba.tests +import samba.tests.libsmb import threading import sys -import os import random -class LibsmbTestCase(samba.tests.TestCase): +class LibsmbTestCase(samba.tests.libsmb.LibsmbTests): class OpenClose(threading.Thread): @@ -52,23 +50,15 @@ class LibsmbTestCase(samba.tests.TestCase): except Exception: self.exc = sys.exc_info() - def prep_creds(self): - lp = s3param.get_context() - lp.load(os.getenv("SMB_CONF_PATH")) - - creds = credentials.Credentials() - creds.guess(lp) - creds.set_username(os.getenv("USERNAME")) - creds.set_password(os.getenv("PASSWORD")) - - return (lp,creds) - def test_OpenClose(self): - (lp,creds) = self.prep_creds() - c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", - lp, creds, multi_threaded=True, - force_smb1=True) + c = libsmb.Conn( + self.server_ip, + "tmp", + self.lp, + self.creds, + multi_threaded=True, + force_smb1=True) mythreads = [] @@ -87,11 +77,9 @@ class LibsmbTestCase(samba.tests.TestCase): def test_SMB3EncryptionRequired(self): test_dir = 'testing_%d' % random.randint(0, 0xFFFF) - (lp,creds) = self.prep_creds() - creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED) + self.creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED) - c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", - lp, creds) + c = libsmb.Conn(self.server_ip, "tmp", self.lp, self.creds) c.mkdir(test_dir) c.rmdir(test_dir) @@ -99,22 +87,24 @@ class LibsmbTestCase(samba.tests.TestCase): def test_SMB1EncryptionRequired(self): test_dir = 'testing_%d' % random.randint(0, 0xFFFF) - (lp,creds) = self.prep_creds() - creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED) + self.creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED) - c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", - lp, creds, force_smb1=True) + c = libsmb.Conn( + self.server_ip, + "tmp", + self.lp, + self.creds, + force_smb1=True) c.mkdir(test_dir) c.rmdir(test_dir) def test_RenameDstDelOnClose(self): - (lp,creds) = self.prep_creds() dstdir = "\\dst-subdir" - c1 = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", lp, creds) - c2 = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", lp, creds) + c1 = libsmb.Conn(self.server_ip, "tmp", self.lp, self.creds) + c2 = libsmb.Conn(self.server_ip, "tmp", self.lp, self.creds) try: c1.deltree(dstdir) @@ -141,8 +131,7 @@ class LibsmbTestCase(samba.tests.TestCase): pass def test_libsmb_CreateContexts(self): - (lp,creds) = self.prep_creds() - c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", lp, creds) + c = libsmb.Conn(self.server_ip, "tmp", self.lp, self.creds) cc_in = [(libsmb.SMB2_CREATE_TAG_MXAC, b'')] fnum,cr,cc = c.create_ex("",CreateContexts=cc_in) self.assertEqual( diff --git a/python/samba/tests/libsmb.py b/python/samba/tests/libsmb.py index 2fe4386340f..678ae00d2c9 100644 --- a/python/samba/tests/libsmb.py +++ b/python/samba/tests/libsmb.py @@ -20,138 +20,24 @@ from samba.samba3 import libsmb_samba_internal as libsmb from samba.dcerpc import security from samba.samba3 import param as s3param -from samba import (credentials,NTSTATUSError) -from samba.ntstatus import NT_STATUS_DELETE_PENDING -from samba.credentials import SMB_ENCRYPTION_REQUIRED +from samba import credentials import samba.tests -import threading -import sys import os -import random +class LibsmbTests(samba.tests.TestCase): -class LibsmbTestCase(samba.tests.TestCase): + def setUp(self): + self.lp = s3param.get_context() + self.lp.load(samba.tests.env_get_var_value("SMB_CONF_PATH")) - class OpenClose(threading.Thread): + self.creds = credentials.Credentials() + self.creds.guess(self.lp) + self.creds.set_username(samba.tests.env_get_var_value("USERNAME")) + self.creds.set_password(samba.tests.env_get_var_value("PASSWORD")) - def __init__(self, conn, filename, num_ops): - threading.Thread.__init__(self) - self.conn = conn - self.filename = filename - self.num_ops = num_ops - self.exc = False + # Build the global inject file path + server_conf = samba.tests.env_get_var_value("SERVERCONFFILE") + server_conf_dir = os.path.dirname(server_conf) + self.global_inject = os.path.join(server_conf_dir, "global_inject.conf") - def run(self): - c = self.conn - try: - for i in range(self.num_ops): - f = c.create(self.filename, CreateDisposition=3, - DesiredAccess=security.SEC_STD_DELETE) - c.delete_on_close(f, True) - c.close(f) - except Exception: - self.exc = sys.exc_info() - - def prep_creds(self): - lp = s3param.get_context() - lp.load(os.getenv("SMB_CONF_PATH")) - - creds = credentials.Credentials() - creds.guess(lp) - creds.set_username(os.getenv("USERNAME")) - creds.set_password(os.getenv("PASSWORD")) - - return (lp,creds) - - def test_OpenClose(self): - (lp,creds) = self.prep_creds() - - c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", - lp, creds, multi_threaded=True, - force_smb1=True) - - mythreads = [] - - for i in range(3): - t = LibsmbTestCase.OpenClose(c, "test" + str(i), 10) - mythreads.append(t) - - for t in mythreads: - t.start() - - for t in mythreads: - t.join() - if t.exc: - raise t.exc[0](t.exc[1]) - - def test_SMB3EncryptionRequired(self): - test_dir = 'testing_%d' % random.randint(0, 0xFFFF) - - (lp,creds) = self.prep_creds() - creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED) - - c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", - lp, creds) - - c.mkdir(test_dir) - c.rmdir(test_dir) - - def test_SMB1EncryptionRequired(self): - test_dir = 'testing_%d' % random.randint(0, 0xFFFF) - - (lp,creds) = self.prep_creds() - creds.set_smb_encryption(SMB_ENCRYPTION_REQUIRED) - - c = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", - lp, creds, force_smb1=True) - - c.mkdir(test_dir) - c.rmdir(test_dir) - - def test_RenameDstDelOnClose(self): - (lp,creds) = self.prep_creds() - - dstdir = "\\dst-subdir" - - c1 = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", lp, creds) - c2 = libsmb.Conn(os.getenv("SERVER_IP"), "tmp", lp, creds) - - try: - c1.deltree(dstdir) - except: - pass - - c1.mkdir(dstdir) - dnum = c1.create(dstdir, DesiredAccess=security.SEC_STD_DELETE) - c1.delete_on_close(dnum,1) - c2.savefile("\\src.txt", b"Content") - - with self.assertRaises(NTSTATUSError) as cm: - c2.rename("\\src.txt", dstdir + "\\dst.txt") - if (cm.exception.args[0] != NT_STATUS_DELETE_PENDING): - raise AssertionError("Rename must fail with DELETE_PENDING") - - c1.delete_on_close(dnum,0) - c1.close(dnum) - - try: - c1.deltree(dstdir) - c1.unlink("\\src.txt") - 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() + self.server_ip = samba.tests.env_get_var_value("SERVER_IP") diff --git a/python/samba/tests/smb3unix.py b/python/samba/tests/smb3unix.py index a825100d5b2..514c245515f 100644 --- a/python/samba/tests/smb3unix.py +++ b/python/samba/tests/smb3unix.py @@ -16,26 +16,10 @@ # from samba.samba3 import libsmb_samba_internal as libsmb -from samba.samba3 import param as s3param -from samba import (credentials,NTSTATUSError,ntstatus) -import samba.tests -import os +from samba import NTSTATUSError,ntstatus +import samba.tests.libsmb -class Smb3UnixTests(samba.tests.TestCase): - - def setUp(self): - self.lp = s3param.get_context() - self.lp.load(os.getenv("SMB_CONF_PATH")) - - self.creds = credentials.Credentials() - self.creds.guess(self.lp) - self.creds.set_username(os.getenv("USERNAME")) - self.creds.set_password(os.getenv("PASSWORD")) - - # Build the global inject file path - server_conf = os.getenv("SERVERCONFFILE") - server_conf_dir = os.path.dirname(server_conf) - self.global_inject = os.path.join(server_conf_dir, "global_inject.conf") +class Smb3UnixTests(samba.tests.libsmb.LibsmbTests): def enable_smb3unix(self): with open(self.global_inject, 'w') as f: @@ -50,7 +34,7 @@ class Smb3UnixTests(samba.tests.TestCase): self.enable_smb3unix() c = libsmb.Conn( - os.getenv("SERVER_IP"), + self.server_ip, "tmp", self.lp, self.creds, @@ -62,7 +46,7 @@ class Smb3UnixTests(samba.tests.TestCase): def test_negotiate_context_noposix(self): c = libsmb.Conn( - os.getenv("SERVER_IP"), + self.server_ip, "tmp", self.lp, self.creds, @@ -75,7 +59,7 @@ class Smb3UnixTests(samba.tests.TestCase): with self.assertRaises(NTSTATUSError) as cm: c = libsmb.Conn( - os.getenv("SERVER_IP"), + self.server_ip, "tmp", self.lp, self.creds, @@ -92,7 +76,7 @@ class Smb3UnixTests(samba.tests.TestCase): self.enable_smb3unix() c = libsmb.Conn( - os.getenv("SERVER_IP"), + self.server_ip, "tmp", self.lp, self.creds, @@ -107,7 +91,7 @@ class Smb3UnixTests(samba.tests.TestCase): self.enable_smb3unix() c = libsmb.Conn( - os.getenv("SERVER_IP"), + self.server_ip, "tmp", self.lp, self.creds, @@ -125,7 +109,7 @@ class Smb3UnixTests(samba.tests.TestCase): def test_posix_create_context_noposix(self): c = libsmb.Conn( - os.getenv("SERVER_IP"), + self.server_ip, "tmp", self.lp, self.creds, @@ -143,7 +127,7 @@ class Smb3UnixTests(samba.tests.TestCase): self.enable_smb3unix() c = libsmb.Conn( - os.getenv("SERVER_IP"), + self.server_ip, "tmp", self.lp, self.creds, diff --git a/source3/client/clitar.c b/source3/client/clitar.c index d62b53d2b17..a5c7df9c869 100644 --- a/source3/client/clitar.c +++ b/source3/client/clitar.c @@ -218,7 +218,7 @@ static NTSTATUS is_subpath(const char *sub, const char *full, /* * tar_get_ctx - retrieve global tar context handle */ -struct tar *tar_get_ctx() +struct tar *tar_get_ctx(void) { return &tar_ctx; } diff --git a/source3/include/adt_tree.h b/source3/include/adt_tree.h index 7e43fa60f6a..b3d71e7ec11 100644 --- a/source3/include/adt_tree.h +++ b/source3/include/adt_tree.h @@ -1,4 +1,4 @@ -/* +/* * Unix SMB/CIFS implementation. * Generic Abstract Data Types * Copyright (C) Gerald Carter 2002-2005. @@ -7,12 +7,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ @@ -22,7 +22,7 @@ struct sorted_tree; -/* +/* * API */ diff --git a/source3/include/smb_macros.h b/source3/include/smb_macros.h index 8271dbddfce..0f44d1402a8 100644 --- a/source3/include/smb_macros.h +++ b/source3/include/smb_macros.h @@ -34,12 +34,6 @@ #define IS_DOS_SYSTEM(test_mode) (((test_mode) & FILE_ATTRIBUTE_SYSTEM) != 0) #define IS_DOS_HIDDEN(test_mode) (((test_mode) & FILE_ATTRIBUTE_HIDDEN) != 0) -#define SMB_WARN(condition, message) \ - ((condition) ? (void)0 : \ - DEBUG(0, ("WARNING: %s: %s\n", #condition, message))) - -#define SMB_ASSERT_ARRAY(a,n) SMB_ASSERT((sizeof(a)/sizeof((a)[0])) >= (n)) - /* these are useful macros for checking validity of handles */ -- Samba Shared Repository