samba.git
5 years agotraffic: split is_a_real_packet() function out of class
Douglas Bagnall [Fri, 19 Oct 2018 03:52:48 +0000 (16:52 +1300)]
traffic: split is_a_real_packet() function out of class

So we can use it to determine whether a packet should be a Packet before
making the leap.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic: give Packet __slots__ for reduced memory
Douglas Bagnall [Fri, 19 Oct 2018 03:51:22 +0000 (16:51 +1300)]
traffic: give Packet __slots__ for reduced memory

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic: make random_colour_print more deterministic, silent on demand
Douglas Bagnall [Fri, 19 Oct 2018 03:48:40 +0000 (16:48 +1300)]
traffic: make random_colour_print more deterministic, silent on demand

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic: delete empty temp directories
Douglas Bagnall [Fri, 19 Oct 2018 03:25:06 +0000 (16:25 +1300)]
traffic: delete empty temp directories

even if someone asked to keep the temporary data, they don't want
to see 5000 empty directries. Non-empty directories will remain.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic: use namedtuple for ConversationAccounts namespace class
Douglas Bagnall [Fri, 19 Oct 2018 03:46:05 +0000 (16:46 +1300)]
traffic: use namedtuple for ConversationAccounts namespace class

Saving memory, which reduces fork overhead.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic: fix mk_masked_dir doc and comments
Douglas Bagnall [Fri, 19 Oct 2018 03:43:13 +0000 (16:43 +1300)]
traffic: fix mk_masked_dir doc and comments

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic: Packet.from_line classmethod uses cls var
Douglas Bagnall [Fri, 19 Oct 2018 03:41:36 +0000 (16:41 +1300)]
traffic: Packet.from_line classmethod uses cls var

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic learner: avoid truncated output files on error
Douglas Bagnall [Fri, 19 Oct 2018 03:39:36 +0000 (16:39 +1300)]
traffic learner: avoid truncated output files on error

add_argument(type=argparse.FileType('w'), ...) will open the file
and leave it empty if the script fails.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic_learner: use samba.logger, not print(file=sys.stderr)
Douglas Bagnall [Fri, 19 Oct 2018 03:37:08 +0000 (16:37 +1300)]
traffic_learner: use samba.logger, not print(file=sys.stderr)

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic_learner: return an error code
Douglas Bagnall [Wed, 24 Oct 2018 00:46:16 +0000 (13:46 +1300)]
traffic_learner: return an error code

And use it in tests, rather than expecting exact strings.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic: use default value for --duration
Douglas Bagnall [Fri, 19 Oct 2018 03:03:25 +0000 (16:03 +1300)]
traffic: use default value for --duration

We could not do this when we replayed traffic summaries (as opposed to
models), but now this script does not do that.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic_replay: drop summary replay
Douglas Bagnall [Fri, 19 Oct 2018 03:18:39 +0000 (16:18 +1300)]
traffic_replay: drop summary replay

The traffic_replay script has been able to replay a replay log as well
as a model, which was not used in practice and complicated the script.

If we want that feature, we can make a new script for it.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotraffic replay: allow --random-seed=0
Douglas Bagnall [Fri, 5 Oct 2018 01:42:27 +0000 (14:42 +1300)]
traffic replay: allow --random-seed=0

Zero is a valid seed.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/traffic: remove duplicate test file
Douglas Bagnall [Thu, 27 Sep 2018 00:58:11 +0000 (12:58 +1200)]
python/traffic: remove duplicate test file

The other one is python/samba/tests/blackbox/testdata/traffic-sample-very-short.model

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agopython/tests/blackbox: check_exit_code() explains by default
Douglas Bagnall [Wed, 24 Oct 2018 04:49:00 +0000 (17:49 +1300)]
python/tests/blackbox: check_exit_code() explains by default

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agoidmap: In _wbint_Sids2UnixIDs, pass back what we have
Volker Lendecke [Tue, 18 Dec 2018 14:53:48 +0000 (15:53 +0100)]
idmap: In _wbint_Sids2UnixIDs, pass back what we have

SOME_UNMAPPED does not mean that nothing worthwhile is in here. We
need to pass what we have.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Jan  8 13:15:35 CET 2019 on sn-devel-144

5 years agoidmap_tdb: If one SID fails to map, try the rest
Volker Lendecke [Tue, 18 Dec 2018 14:53:21 +0000 (15:53 +0100)]
idmap_tdb: If one SID fails to map, try the rest

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
5 years agoselftest: Test sids-to-xids with one failing sid
Volker Lendecke [Fri, 21 Dec 2018 10:49:33 +0000 (11:49 +0100)]
selftest: Test sids-to-xids with one failing sid

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Volker Lendecke <vl@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
5 years agowaf: fix tri-state of --with-sendfile-support being auto the default
Björn Jacke [Mon, 7 Jan 2019 00:05:19 +0000 (01:05 +0100)]
waf: fix tri-state of --with-sendfile-support being auto the default

--with-sendfile-support should be used automatically if it's found.

Configure now also fails reliably for all platforms when sendfile was
explicitly requested but failed to be detected.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=9707

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jan  8 07:03:49 CET 2019 on sn-devel-144

5 years agowaf: fix waf errors with sendfail detection on Solaris
Björn Jacke [Sun, 6 Jan 2019 23:28:34 +0000 (00:28 +0100)]
waf: fix waf errors with sendfail detection on Solaris

Signed-off-by: Bjoern Jacke <bjacke@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3: net: Do not set NET_FLAGS_ANONYMOUS with -k
Justin Stephenson [Mon, 17 Dec 2018 16:26:11 +0000 (11:26 -0500)]
s3: net: Do not set NET_FLAGS_ANONYMOUS with -k

This affects net rpc getsid and net rpc changetrustpw commands.
This avoids an anonymous IPC connection being made when -k is used,
this only affects net rpc getsid and net rpc changetrustpw commands.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13726

Signed-off-by: Justin Stephenson <jstephen@redhat.com>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
5 years agolibnet4: Use dom_sid_str_buf
Volker Lendecke [Sun, 16 Dec 2018 16:24:36 +0000 (17:24 +0100)]
libnet4: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agowinbind4: Use dom_sid_str_buf
Volker Lendecke [Sun, 16 Dec 2018 16:17:58 +0000 (17:17 +0100)]
winbind4: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopysecurity: Use dom_sid_str_buf
Volker Lendecke [Sun, 16 Dec 2018 16:12:19 +0000 (17:12 +0100)]
pysecurity: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoauth4: Use dom_sid_str_buf
Volker Lendecke [Sun, 16 Dec 2018 16:11:55 +0000 (17:11 +0100)]
auth4: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agontpd: Use dom_sid_str_buf
Volker Lendecke [Sun, 16 Dec 2018 16:02:54 +0000 (17:02 +0100)]
ntpd: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopassdb: Use dom_sid_str_buf
Volker Lendecke [Sun, 16 Dec 2018 15:59:32 +0000 (16:59 +0100)]
passdb: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agowinbind: Fix a typo
Volker Lendecke [Fri, 14 Dec 2018 19:30:10 +0000 (20:30 +0100)]
winbind: Fix a typo

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopydsdb: Use dom_sid_str_buf
Volker Lendecke [Fri, 21 Dec 2018 08:34:34 +0000 (09:34 +0100)]
pydsdb: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibndr: Use dom_sid_str_buf
Volker Lendecke [Fri, 21 Dec 2018 08:32:41 +0000 (09:32 +0100)]
libndr: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbclient: Use dom_sid_str_buf
Volker Lendecke [Fri, 21 Dec 2018 08:30:58 +0000 (09:30 +0100)]
smbclient: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibcli: Simplify smblsa_lookup_name
Volker Lendecke [Fri, 21 Dec 2018 08:27:43 +0000 (09:27 +0100)]
libcli: Simplify smblsa_lookup_name

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agowinbindd: Use dom_sid_str_buf
Volker Lendecke [Thu, 20 Dec 2018 20:57:21 +0000 (21:57 +0100)]
winbindd: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agoauth3: Use dom_sid_str_buf
Volker Lendecke [Thu, 20 Dec 2018 20:53:17 +0000 (21:53 +0100)]
auth3: Use dom_sid_str_buf

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolib: Remove StrnCpy
Volker Lendecke [Mon, 31 Dec 2018 06:16:29 +0000 (07:16 +0100)]
lib: Remove StrnCpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agosmbd: Use strlcpy instead of StrnCpy
Volker Lendecke [Mon, 31 Dec 2018 06:15:21 +0000 (07:15 +0100)]
smbd: Use strlcpy instead of StrnCpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agonmbd: Use strlcpy instead of StrnCpy
Volker Lendecke [Mon, 31 Dec 2018 06:15:03 +0000 (07:15 +0100)]
nmbd: Use strlcpy instead of StrnCpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agolibsmb: Use strlcpy instead of StrnCpy
Volker Lendecke [Mon, 31 Dec 2018 06:14:48 +0000 (07:14 +0100)]
libsmb: Use strlcpy instead of StrnCpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:torture:base:bench-readwrite: fix uninitialized memory causing segfault
Aliaksei Karaliou [Fri, 21 Dec 2018 13:47:00 +0000 (16:47 +0300)]
s4:torture:base:bench-readwrite: fix uninitialized memory causing segfault

Allocation of 'struct smb_composite_connect' happens without zeroing
so that smb_composite_connect_send() thinks that connection
already exists and fails on its handling.

Signed-off-by: Aliaksei Karaliou <akaraliou@panasas.com>
Reviewed-by: Douglas Bagnall <dbagnall@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agonetcmd: Small refactor to SMB connection in domain backup
Tim Beale [Thu, 13 Dec 2018 03:50:00 +0000 (16:50 +1300)]
netcmd: Small refactor to SMB connection in domain backup

Rework the code so we only do this in one place.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Autobuild-User(master): Tim Beale <timbeale@samba.org>
Autobuild-Date(master): Tue Jan  8 03:13:48 CET 2019 on sn-devel-144

5 years agonetcmd: Refactor duplicated SMB connect in GPO commands
Tim Beale [Thu, 13 Dec 2018 21:47:45 +0000 (10:47 +1300)]
netcmd: Refactor duplicated SMB connect in GPO commands

Do the SMB connection in a single helper function.

Note: this highlights that perhaps we want all SMB connections to be
signed, but we can fix that up separately.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agotests: Avoid hardcoding domain in GPO tests
Tim Beale [Thu, 13 Dec 2018 20:50:02 +0000 (09:50 +1300)]
tests: Avoid hardcoding domain in GPO tests

The realm varies by testenv. Currently the GPO tests will only run on
the ad_dc testenv.

A slightly better solution is to use the REALM environmental variable,
so that the test can run on any testenv.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agopython/ntacls: Convert ntacls to use s3 flags
Tim Beale [Thu, 13 Dec 2018 21:34:48 +0000 (10:34 +1300)]
python/ntacls: Convert ntacls to use s3 flags

This helper code is just using the flags defined by the Python bindings.
Convert it over to use s3 bindings instead of s4.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos3:pylibsmb: Add flags used by .list() to SMB Py bindings
Tim Beale [Thu, 13 Dec 2018 21:30:38 +0000 (10:30 +1300)]
s3:pylibsmb: Add flags used by .list() to SMB Py bindings

These flags are exposed by the s4 code. Python code that calls .list()
checks the returned attribs/mode for the directory listing, e.g. to work
out whether something is a sub-directory:

  if item['attrib'] & libsmb.FILE_ATTRIBUTE_DIRECTORY...

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos3:pylibsmb: Rename 'credentials' param to match s4
Tim Beale [Wed, 12 Dec 2018 23:40:49 +0000 (12:40 +1300)]
s3:pylibsmb: Rename 'credentials' param to match s4

s4 just calls it 'creds'. Renaming it will make it easier to convert
existing SMB connections over to use the new bindings.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
5 years agotests: Rename libsmb_samba_internal test to libsmb
Tim Beale [Wed, 12 Dec 2018 23:37:33 +0000 (12:37 +1300)]
tests: Rename libsmb_samba_internal test to libsmb

So that it better matches the updated Python bindings name.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos3:pylibsmb: Rename libsmb_samba_internal Py bindings to libsmb
Tim Beale [Wed, 12 Dec 2018 23:32:17 +0000 (12:32 +1300)]
s3:pylibsmb: Rename libsmb_samba_internal Py bindings to libsmb

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agotests: Run SMB Py bindings tests against testenv with SMBv1-disabled
Tim Beale [Wed, 12 Dec 2018 01:50:53 +0000 (14:50 +1300)]
tests: Run SMB Py bindings tests against testenv with SMBv1-disabled

Sanity-check that the SMBv2 connection actually works by running it
against a testenv with SMBv1 disabled.

I've dropped 'local' from the ad_dc target, because it shouldn't be
needed. We're trying to test the client-side SMB connection, so running
it without 'local' is probably a better test.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Tim Beale <timbeale@samba.org>
Autobuild-Date(master): Mon Jan  7 04:29:51 CET 2019 on sn-devel-144

5 years agotests: Avoid hardcoding domain in test
Tim Beale [Tue, 11 Dec 2018 21:04:09 +0000 (10:04 +1300)]
tests: Avoid hardcoding domain in test

Currently the sysvol domain directory is hard-coded, so the tests can
only ever run on the ad_dc.

This patch makes things marginally better by using the REALM
environmental variable instead. This allows us to run it against other
testenvs (like the SMBv2-only restoredc).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agotests: Completely replace s4 connection in smb tests
Tim Beale [Wed, 12 Dec 2018 01:42:30 +0000 (14:42 +1300)]
tests: Completely replace s4 connection in smb tests

This test now uses the s3 python bindings completely, so we can remove
the s4 connection.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Add .deltree() API to SMB py bindings
Tim Beale [Wed, 12 Dec 2018 00:45:46 +0000 (13:45 +1300)]
s3:pylibsmb: Add .deltree() API to SMB py bindings

This basically re-uses the underlying functionality of existing APIs in
order to support a .deltree() API, i.e.
- we use the .list() functionality (i.e. do_listing()) to traverse every
  item in the given directory.
- we then use either .unlink() (i.e. unlink_file()) or .rmdir() (i.e.
  remove_dir()) to delete the individual item.
- sub-directories are handled recursively, by repeating the process.

Note that the .deltree() API is currently only really used for testing
(and deleting GPO files). So the recursion is never going to be
excessive.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Minor refactor to py_cli_list() variables
Tim Beale [Wed, 12 Dec 2018 00:47:46 +0000 (13:47 +1300)]
s3:pylibsmb: Minor refactor to py_cli_list() variables

Add a define for the file attribute mask (we'll reuse it in a subsequent
patch), and make the variable type explicit.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:libsmb: Avoid duplicated code by making cli_read_sink() public
Tim Beale [Thu, 3 Jan 2019 04:48:39 +0000 (17:48 +1300)]
s3:libsmb: Avoid duplicated code by making cli_read_sink() public

cli_read_sink() and pull_helper() were essentially identical. By making
cli_read_sink() non-static, we can delete the latter.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos3:pylibsmb: Add .loadfile() API to SMB py bindings
Tim Beale [Wed, 5 Dec 2018 02:08:09 +0000 (15:08 +1300)]
s3:pylibsmb: Add .loadfile() API to SMB py bindings

Add a .loadfile API to read a file's contents. This provides a
convenient way to read a file and is consistent with the existing
source4 API, which is used by things like the GPO python code and the
ntacls backup.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos3:pylibsmb: Add .savefile() API to SMB py bindings
Tim Beale [Mon, 10 Dec 2018 20:34:42 +0000 (09:34 +1300)]
s3:pylibsmb: Add .savefile() API to SMB py bindings

This provides a simple API for writing a file's contents and makes the
s3 API consistent with the s4 API.

All the async APIs here support SMBv2 so we don't need to use the sync
APIs at all.

Note that we have the choice here of using either cli_write_send() or
cli_push_send(). I chose the latter, because that's what smbclient uses.
It also appears to handle writing a large file better (i.e. one that
exceeds the max write size of the underlying connection).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos3:pylibsmb: Free async .list() memory
Tim Beale [Tue, 11 Dec 2018 23:23:42 +0000 (12:23 +1300)]
s3:pylibsmb: Free async .list() memory

finfos was being allocated but never freed.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Make s3 and s4 listings return the same dict
Tim Beale [Tue, 4 Dec 2018 03:25:10 +0000 (16:25 +1300)]
s3:pylibsmb: Make s3 and s4 listings return the same dict

Make the python dictionary generated by the s3 .list() use the same keys
as the current source4 dict. The reason for using the source4 dict is
that other python code depends on these keys (e.g. ntacls.py), whereas
the source3 API is currently unused.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
5 years agos3:pylibsmb: Don't return '.'/'..' in .list()
Tim Beale [Tue, 4 Dec 2018 03:03:35 +0000 (16:03 +1300)]
s3:pylibsmb: Don't return '.'/'..' in .list()

The source4 .list() API wasn't doing this. This makes source3 and source4
have *almost* equivalent functionality, so we can start usign the
source3 API in the tests.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Make .list() work for SMBv2
Tim Beale [Tue, 11 Dec 2018 23:08:24 +0000 (12:08 +1300)]
s3:pylibsmb: Make .list() work for SMBv2

In order for .list() to work on an SMBv2 connection we need to
use the synchronous API.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Split code out into do_listing() helper
Tim Beale [Tue, 11 Dec 2018 22:28:22 +0000 (11:28 +1300)]
s3:pylibsmb: Split code out into do_listing() helper

We'll want to reuse the directory listing function for the deltree API.
This patch splits the bulk of the work out into a do_listing() helper
function.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Split out code into list_helper()
Tim Beale [Tue, 4 Dec 2018 02:43:53 +0000 (15:43 +1300)]
s3:pylibsmb: Split out code into list_helper()

Refactor out the code so we can re-use it for the synchronous API as
well.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Consolidate .readdir()/.list() py bindings API
Tim Beale [Mon, 3 Dec 2018 20:15:30 +0000 (09:15 +1300)]
s3:pylibsmb: Consolidate .readdir()/.list() py bindings API

Rename the .readdir API to .list and make the parameters match up with
the s4 python bindings, i.e. 'mask' is optional and separate from the
directory parameter.

Note that nothing uses the .readdir source3 API currently, so it's safe
to rename.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Add .chkpath() API to SMB py bindings
Tim Beale [Mon, 3 Dec 2018 03:33:19 +0000 (16:33 +1300)]
s3:pylibsmb: Add .chkpath() API to SMB py bindings

Note that this is checking the existence of *directories*, not *files*.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Add .mkdir(), .rmdir() APIS to SMB py bindings
Tim Beale [Mon, 3 Dec 2018 03:27:07 +0000 (16:27 +1300)]
s3:pylibsmb: Add .mkdir(), .rmdir() APIS to SMB py bindings

I kept these separate from the chkpath API because it's a nice way to
use the old s4 API in the tests to verify the new s3 API works
correctly.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Add .unlink() API to SMB Py bindings
Tim Beale [Sun, 2 Dec 2018 21:50:19 +0000 (10:50 +1300)]
s3:pylibsmb: Add .unlink() API to SMB Py bindings

Add a basic .unlink() API to the source3 bindings. This is based on the
source4 python bindings, but uses the source3 client library APIs.
(We use a helper function to do most of the work, because we will need
to reuse it in order to support the deltree API).

Update the source4 test to use the source3 API. We will gradually
convert it over, and then delete the source4 python bindings.

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:pylibsmb: Make lp a mandatory param for the SMB connection
Tim Beale [Tue, 11 Dec 2018 21:25:35 +0000 (10:25 +1300)]
s3:pylibsmb: Make lp a mandatory param for the SMB connection

Currently establishing the SMB connection relies on having initialized
the global source3 loadparm.

This patch makes the lp param mandatory, so that you always have to pass
the parameter in when establishing the SMB connection.

It also makes the source3 API more consistent with the current source4
API, which will make it easier to replace the source4 version later.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
5 years agos3:smbd: Fix build on AIX
Bjoern Jacke [Wed, 28 Nov 2018 10:38:44 +0000 (04:38 -0600)]
s3:smbd: Fix build on AIX

AIX makes a define of ip_len in netinet/ip.h (sic!)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13731

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Jan  4 16:29:50 CET 2019 on sn-devel-144

5 years agowaf: let CHECK_SIZEOF check for 64 bit also
Bjoern Jacke [Sat, 22 Dec 2018 02:27:32 +0000 (20:27 -0600)]
waf: let CHECK_SIZEOF check for 64 bit also

wafsamba: utmp can be 64 bit also (like on AIX)

BUG: https://bugzilla.samba.org/show_bug.cgi?id=12017

Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Wed Jan  2 14:10:41 CET 2019 on sn-devel-144

5 years agoHappy New Year 2019!
Stefan Metzmacher [Tue, 1 Jan 2019 11:52:26 +0000 (12:52 +0100)]
Happy New Year 2019!

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jan  1 16:02:05 CET 2019 on sn-devel-144

5 years agoauth/gensec: enforce that all DCERPC contexts support SIGN_PKT_HEADER
Stefan Metzmacher [Wed, 31 Oct 2018 14:55:57 +0000 (15:55 +0100)]
auth/gensec: enforce that all DCERPC contexts support SIGN_PKT_HEADER

That's currently always the case and will simplifies the callers.

WORKS now???
TDB_NO_FSYNC=1 buildnice make -j test FAIL_IMMEDIATELY=1 SOCKET_WRAPPER_KEEP_PCAP=1 TESTS='samba4.rpc.lsa.secrets.*ncacn_np.*Kerberos.*Samba3.*fl2000dc'
and
TDB_NO_FSYNC=1 buildnice make -j test FAIL_IMMEDIATELY=1 SOCKET_WRAPPER_KEEP_PCAP=1 TESTS='samba3.rpc.lsa.*ncacn_ip_tcp.*nt4_dc'

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Dec 23 21:33:51 CET 2018 on sn-devel-144

5 years agopy:dcerpc/raw_testcase: add helper functions for ncacn_np: SMB connection support
Stefan Metzmacher [Thu, 22 Nov 2018 17:21:03 +0000 (18:21 +0100)]
py:dcerpc/raw_testcase: add helper functions for ncacn_np: SMB connection support

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: maintain self.secondary_address
Stefan Metzmacher [Thu, 22 Nov 2018 17:21:03 +0000 (18:21 +0100)]
py:dcerpc/raw_testcase: maintain self.secondary_address

This was it's easier to alter once add support for SMB connections.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: maintain self.max_{xmit,recv}_frag
Stefan Metzmacher [Thu, 22 Nov 2018 17:21:03 +0000 (18:21 +0100)]
py:dcerpc/raw_testcase: maintain self.max_{xmit,recv}_frag

This was it's easier to alter once add support for SMB connections.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: support DCERPC_AUTH_LEVEL_CONNECT in do_single_request()
Stefan Metzmacher [Mon, 26 Nov 2018 10:41:26 +0000 (11:41 +0100)]
py:dcerpc/raw_testcase: support DCERPC_AUTH_LEVEL_CONNECT in do_single_request()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: add start_with_alter to do_generic_bind()
Stefan Metzmacher [Thu, 22 Nov 2018 07:29:32 +0000 (08:29 +0100)]
py:dcerpc/raw_testcase: add start_with_alter to do_generic_bind()

This will allow do_generic_bind() to be used to test
security context multiplexing.

Check with git show -w

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: test signing also with raw NTLMSSP and Kerberos
Stefan Metzmacher [Tue, 20 Nov 2018 16:37:38 +0000 (17:37 +0100)]
py:dcerpc/raw_protocol: test signing also with raw NTLMSSP and Kerberos

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: test signing with and without header signing
Stefan Metzmacher [Tue, 20 Nov 2018 16:37:38 +0000 (17:37 +0100)]
py:dcerpc/raw_protocol: test signing with and without header signing

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: prepare get_auth_context_creds() and do_generic_bind() for...
Stefan Metzmacher [Tue, 20 Nov 2018 14:15:04 +0000 (15:15 +0100)]
py:dcerpc/raw_testcase: prepare get_auth_context_creds() and do_generic_bind() for header signing

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: prepare do_generic_bind() for raw NTLMSSP and Kerberos authen...
Stefan Metzmacher [Tue, 20 Nov 2018 14:15:04 +0000 (15:15 +0100)]
py:dcerpc/raw_testcase: prepare do_generic_bind() for raw NTLMSSP and Kerberos authentication

They just use 3 legs (messages) for the authentication, while SPNEGO
uses 2 or 4 messages.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: use require DOMAIN/REALM in get_user_creds()
Stefan Metzmacher [Tue, 20 Nov 2018 16:22:56 +0000 (17:22 +0100)]
py:dcerpc/raw_testcase: use require DOMAIN/REALM in get_user_creds()

This is the usage now:

SMB_CONF_PATH=/dev/null \
    SERVER=172.31.9.188 \
    TARGET_HOSTNAME=w2012r2-188.w2012r2-l6.base \
    USERNAME=administrator \
    PASSWORD=A1b2C3d4 \
    DOMAIN=W2012R2-L6 \
    REALM=W2012R2-L6.BASE \
    IGNORE_RANDOM_PAD=1 \
    python/samba/tests/dcerpc/raw_protocol.py -v -f TestDCERPC_BIND

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: use generate_request_auth() in do_single_request()
Stefan Metzmacher [Tue, 20 Nov 2018 16:19:32 +0000 (17:19 +0100)]
py:dcerpc/raw_testcase: use generate_request_auth() in do_single_request()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: use check_response_auth() in do_single_request()
Stefan Metzmacher [Tue, 20 Nov 2018 15:02:50 +0000 (16:02 +0100)]
py:dcerpc/raw_testcase: use check_response_auth() in do_single_request()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: add generate_request_auth() helper function
Stefan Metzmacher [Tue, 20 Nov 2018 16:16:05 +0000 (17:16 +0100)]
py:dcerpc/raw_testcase: add generate_request_auth() helper function

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: add check_response_auth() helper function
Stefan Metzmacher [Tue, 20 Nov 2018 15:02:50 +0000 (16:02 +0100)]
py:dcerpc/raw_testcase: add check_response_auth() helper function

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: rename _test_spnego_signing_auth_level_request to _test_auth_...
Stefan Metzmacher [Tue, 20 Nov 2018 14:43:24 +0000 (15:43 +0100)]
py:dcerpc/raw_protocol: rename _test_spnego_signing_auth_level_request to _test_auth_signing_auth_level_request

We now pass down dcerpc.DCERPC_AUTH_TYPE_SPNEGO from callers
instead of having SPNEGO specific functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: rename _test_spnego_bind_auth_level to_test_auth_bind_auth_level
Stefan Metzmacher [Tue, 20 Nov 2018 14:43:24 +0000 (15:43 +0100)]
py:dcerpc/raw_protocol: rename _test_spnego_bind_auth_level to_test_auth_bind_auth_level

We now pass down dcerpc.DCERPC_AUTH_TYPE_SPNEGO from callers
instead of having SPNEGO specific functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: pass auth_context and stub_len to parse_auth() in order to...
Stefan Metzmacher [Tue, 20 Nov 2018 14:48:08 +0000 (15:48 +0100)]
py:dcerpc/raw_testcase: pass auth_context and stub_len to parse_auth() in order to assert

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: let self._test_spnego_bind_auth_level() return auth_context
Stefan Metzmacher [Tue, 20 Nov 2018 14:38:06 +0000 (15:38 +0100)]
py:dcerpc/raw_protocol: let self._test_spnego_bind_auth_level() return auth_context

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: let do_single_request() check stub length against alloc_hint
Stefan Metzmacher [Tue, 20 Nov 2018 15:01:01 +0000 (16:01 +0100)]
py:dcerpc/raw_testcase: let do_single_request() check stub length against alloc_hint

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: make use of assertPadding()
Stefan Metzmacher [Tue, 11 Dec 2018 18:56:58 +0000 (19:56 +0100)]
py:dcerpc/raw_protocol: make use of assertPadding()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: make use of assertPadding()
Stefan Metzmacher [Tue, 11 Dec 2018 18:56:58 +0000 (19:56 +0100)]
py:dcerpc/raw_testcase: make use of assertPadding()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: add assertPadding() that allows IGNORE_RANDOM_PAD=1
Stefan Metzmacher [Tue, 11 Dec 2018 18:56:58 +0000 (19:56 +0100)]
py:dcerpc/raw_testcase: add assertPadding() that allows IGNORE_RANDOM_PAD=1

Sometimes Windows returns non zero bytes in padding fields,
we won't allow that by default, but IGNORE_RANDOM_PAD=1 will
will only do the length check.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: explicitly disconnect additional connections
Stefan Metzmacher [Tue, 11 Dec 2018 18:42:09 +0000 (19:42 +0100)]
py:dcerpc/raw_protocol: explicitly disconnect additional connections

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_testcase: disconnect on tearDown() of RawDCERPCTest
Stefan Metzmacher [Tue, 11 Dec 2018 18:41:08 +0000 (19:41 +0100)]
py:dcerpc/raw_testcase: disconnect on tearDown() of RawDCERPCTest

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/raw_protocol: rename test_spnego_packet_bind_sign_privacy => test_spnego_pa...
Stefan Metzmacher [Thu, 13 Dec 2018 22:57:35 +0000 (23:57 +0100)]
py:dcerpc/raw_protocol: rename test_spnego_packet_bind_sign_privacy => test_spnego_packet_bind_seal

This makes it consistent with other tests like
test_spnego_integrity_bind_seal.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agopy:dcerpc/tests: rename dcerpc/string.py -> string_tests.py
Stefan Metzmacher [Tue, 20 Nov 2018 07:25:31 +0000 (08:25 +0100)]
py:dcerpc/tests: rename dcerpc/string.py -> string_tests.py

Otherwise it's not possible to run the raw_protocol tests anymore:

python/samba/tests/dcerpc/raw_protocol.py
Traceback (most recent call last):
  File "python/samba/tests/dcerpc/raw_protocol.py", line 26, in <module>
    import samba.dcerpc.dcerpc as dcerpc
  File "bin/python/samba/__init__.py", line 32, in <module>
    from samba.compat import string_types
  File "bin/python/samba/compat.py", line 151, in <module>
    from urllib import quote as urllib_quote
  File "/usr/lib/python2.7/urllib.py", line 25, in <module>
    import string
  File "/abs/path/samba/python/samba/tests/dcerpc/string.py", line 22, in <module>
    # Some strings for ctype-style character classification
  File "bin/python/samba/tests/__init__.py", line 36, in <module>
    from samba.compat import text_type
ImportError: cannot import name text_type

This allows the following again:

SMB_CONF_PATH=/dev/null \
    SERVER=172.31.9.188 \
    TARGET_HOSTNAME=w2012r2-188.w2012r2-l6.base \
    USERNAME=administrator \
    PASSWORD=A1b2C3d4 \
    DOMAIN=W2012R2-L6 \
    REALM=W2012R2-L6.BASE \
    python/samba/tests/dcerpc/raw_protocol.py -v -f TestDCERPC_BIND

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos3:pylibsmb: add settimeout()
Stefan Metzmacher [Wed, 19 Dec 2018 14:18:17 +0000 (15:18 +0100)]
s3:pylibsmb: add settimeout()

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13676

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:librpc: add python winspool bindings
Stefan Metzmacher [Tue, 13 Sep 2016 04:31:04 +0000 (06:31 +0200)]
s4:librpc: add python winspool bindings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:librpc: add python spoolss bindings
Stefan Metzmacher [Tue, 13 Sep 2016 04:31:04 +0000 (06:31 +0200)]
s4:librpc: add python spoolss bindings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
5 years agos4:librpc: add python witness bindings
Stefan Metzmacher [Tue, 13 Sep 2016 03:51:57 +0000 (05:51 +0200)]
s4:librpc: add python witness bindings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>