1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-24 21:34:56 +03:00
Commit Graph

116199 Commits

Author SHA1 Message Date
Kristján Valur
1ff252e398 pygpo: More python exception cleanup.
* Don't override existing exceptions.

* Careful with talloc contexts.

* Return NULL on error.

* Add more information to exception messages from internal functions.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan@rvx.is>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2019-03-07 14:08:22 +00:00
Kristján Valur
a8b316d102 pygpo: Fix error handing when getting gpo unix path.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan@rvx.is>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2019-03-07 14:08:21 +00:00
Kristján Valur
08b5b11b96 pygpo: Proper exception exit in py_ads_connect().
connect() now succeeds or raises an exception.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan@rvx.is>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2019-03-07 14:08:21 +00:00
Kristján Valur
36adf08fab pygpo: Replace the use of SystemError with RuntimeError.
SystemError is reserved for internal errors in the interpreter.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13822
Signed-off-by: Kristján Valur Jónsson <kristjan@rvx.is>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2019-03-07 14:08:21 +00:00
Joe Guo
80cf852dbe subunit/run.py: change shebang to python3
always use explicit python version at current stage.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>

Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Thu Mar  7 13:03:56 UTC 2019 on sn-devel-144
2019-03-07 13:03:56 +00:00
Joe Guo
10109f62ce tests/auto_log_pass_change.py: only care about the last expected message other than exact messages count
The messages count could be different because of racing condition.
And we should only care about the last expected one.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett abartlet@samba.org
Reviewed-by: Noel Power npower@samba.org
2019-03-07 12:01:25 +00:00
Joe Guo
02c7b8c03d subunit/run.py: make iso8601 UTC usage python 2/3 compatible
In `iso8601/iso8601.py`:

    if sys.version_info >= (3, 2, 0):
        UTC = datetime.timezone.utc
        ...
    else:
        class Utc(datetime.tzinfo):
            ...

        UTC = Utc()

The class `Utc` is only available for python < 3.2.0.
Use `UTC` instance instead, which is python 2/3 compatible.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2019-03-07 12:01:25 +00:00
Andrew Bartlett
8b18da27cf s4-server: Open and close a transaction on sam.ldb at startup
This fixes upgrading from 4.7 and earlier releases, and makes the DB
reindexing more transparent. It should also make it easier to handle
future normalisation rule changes, e.g. if we change the pack-format
of integer indexes in a future release.

Without this change, the  should have still handled reindexing the
database. We don't know why exactly this wasn't happening correctly,
but opening a transaction early in the samba process startup should
now guarantee that the DB is correctly reindexed by the time the main
samba code runs.

An alternative fix would have been to open a transaction in the the
DSDB module stack every time we connect to the database. However, this
would add an extra write lock every time we open the DB, whereas
starting samba happens much more infrequently.

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar  7 04:58:42 UTC 2019 on sn-devel-144
2019-03-07 04:58:42 +00:00
Andrew Bartlett
6f2558cab8 dsdb: Provide better error strings in rootdse GUID attribute handling
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2019-03-07 03:50:20 +00:00
Andrew Bartlett
30f93bc7ac kcc: Give a better error message when samdb_ntds_objectGUID fails
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2019-03-07 03:50:20 +00:00
Andrew Bartlett
0c52a6bee7 dsdb: Unify samdb_{get,set}_ntds_{objectGUID,invocation_id}
The new unified versions have better debugging and ensure
that both functions continue to have the same control flow.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
2019-03-07 03:50:20 +00:00
Garming Sam
ff58f45807 WHATSNEW: Add the removal of the web server
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Garming Sam <garming@samba.org>
Autobuild-Date(master): Thu Mar  7 03:17:52 UTC 2019 on sn-devel-144
2019-03-07 03:17:52 +00:00
Garming Sam
4a9a77f454 paged_results: Remove C++ commment and unneeded TODO
Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Tim Beale <timbeale@catalyst.net.nz>
2019-03-07 02:14:15 +00:00
Christof Schmitt
ccb6453214 passdb: Increase ABI version to 0.28.0
The change from c906153cc lib: Remove some unused code
removed functions, but only updated the minor version
of the ABI. Update the passdb version to 0.28.0
to reflect this change.
file.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar  7 01:30:49 UTC 2019 on sn-devel-144
2019-03-07 01:30:49 +00:00
Garming Sam
4d2260d86d web_server: Remove the web port smb.conf parameter
With the removal of the web server, there are not any users of this
parameter and so should just be removed.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-07 00:33:16 +00:00
Garming Sam
72c79e30f0 web_server: Remove the unused Python WSGI web server
SWAT was removed in Samba 4.1 and there isn't any reason to keep a web
server in our codebase. The web server was not turned on by default.

The web server plainly does not hold up to modern web server standards
and allows for resource exhaustion (and probably generally has bugs).
Credit goes to Michael Hanselmann for prompting us to remove this
service entirely.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-07 00:33:16 +00:00
Isaac Boukris
d94c8992f9 sam.c: allocate account_sid on tmp_ctx
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar  6 04:30:22 UTC 2019 on sn-devel-144
2019-03-06 04:30:22 +00:00
Isaac Boukris
ce83b21be8 sam.c: fix incorrect check of talloc_new() allocation
Signed-off-by: Isaac Boukris <iboukris@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-03-06 03:16:15 +00:00
Stefan Metzmacher
6da3664f8a ndr_spoolss_buf: fix out of scope use of stack variable in NDR_SPOOLSS_PUSH_ENUM_OUT()
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13818

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Björn Jacke <bjacke@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-03-06 03:16:14 +00:00
Mathieu Parent
c059b8cb82 Enable make test even without lmdb
Bug: https://bugzilla.samba.org/show_bug.cgi?id=13630

Signed-off-by: Mathieu Parent <math.parent@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-03-06 03:16:14 +00:00
Christof Schmitt
4125ff89e4 lib/winbind_util: Add winbind_xid_to_sid for --without-winbind
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13813

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar  6 01:53:16 UTC 2019 on sn-devel-144
2019-03-06 01:53:16 +00:00
Christof Schmitt
73bac6f9af lib/winbind_util: Remove winbind_[gu]id_to_sid
Commit c906153cc7 removed these functions, now also remove them for the
--without-winbind case.

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-06 00:50:15 +00:00
Christof Schmitt
4b1e4c2212 lib/winbind_util: Move include out of ifdef
This fixes compile errors about missing prototypes with
--picky-developer and --without-winbind

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2019-03-06 00:50:14 +00:00
Tim Beale
1d5583c913 dns_hub: Add some debug as to what DNS proxying is happening
This should make it clear at run-time how dns_hub is actually proxying
DNS requests, which will hopefully aid in debugging problems (i.e.
forgetting to add a mapping when adding a new DNS realm).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Mar  6 00:48:43 UTC 2019 on sn-devel-144
2019-03-06 00:48:43 +00:00
Tim Beale
2cd65a7a4e dns_hub: Minor variable rename
We've dropped the iface logic now - this dictionary maps from
realm-to-IP.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:31 +00:00
Tim Beale
327ed9758a selftest: Map realm to IP address (instead of iface)
The code is more readable if the hashmap translates between realm and
DC-name, rather than realm-to-iface. We already have a function to map
between DC-name and iface (and since we're doing this, we might as well
map straight to IP address).

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:31 +00:00
Tim Beale
cbcd4f8f00 selftest: Pass realm-to-IP mapping to dns_hub as an argument
Instead of storing hashmaps in 2 different files, we can just convert a
perl hashmap into a string, pass it to dns_hub, and convert it back into
a python dictionary.

The main reason for doing this is the IP-to-testenv mapping now all
lives in a single file (Samba.pm). All this logic is right next to each
other rather than being split across multiple files. Hopefully this will
make it easier to keep it up to date as we add new testenvs.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:31 +00:00
Tim Beale
d6d8ecb596 selftest: Split out dns_hub's testenv realm-to-IP logic
Add a separate helper function, as the realm-to-IPv4-addr logic is
fairly self-contained.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:31 +00:00
Tim Beale
90ea8c2a99 selftest: Try to tie dns_hub IP mapping to Samba.pm better
dns_hub.py maps the testenv realm to an IP and Samba.pm maps the testenv
NetBIOS name to an IP. We need to keep the two places consistent, as we
add or remove testenvs.

This patch changes dns_hub.py so that it uses a similar hashmap to
Samba.pm. We now have a hashmap with the same name in 2 different
places, so hopefully that's easier to tie them together and keep them in
sync.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:30 +00:00
Tim Beale
d1e145d644 selftest: Cleanup Samba.pm iface mapping
It looks a bit cleaner if we declare the hash-map in one go, rather than
adding each entry one at a time. Also added a comment explaining what
the hash-map is for, and fixed up tab vs spaces inconsistencies.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:30 +00:00
Tim Beale
2b60936d91 selftest: Avoid hard-coding client IP address
We implicitly assume the client IP used by selftest is always
127.0.0.11. Add an iface entry for the client to make this a little more
explicit.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:30 +00:00
Tim Beale
572f83d62a selftest: dns_hub doesn't need to store $swiface
dns_hub doesn't need to store $ctx->{swiface}. Other testenvs store this
and export it as SOCKET_WRAPPER_DEFAULT_IFACE (i.e. for the tests to
use), but dns_hub doesn't need to do this.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:30 +00:00
Tim Beale
5e09d39211 selftest: Add helper functions to get IP addresses
Let's centralize these assumptions in one place.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-05 23:27:30 +00:00
Aaron Haslett
6a7dd7ab51 tests: Reduce likelihood of auth_log test locking up during CI
We would sometimes see the auth_log test hang during a CI run. The CI
job would eventually fail after consuming a costly 10 hours of CI
runtime.

We believe the problem is around the test creating multiple instances of
the Messaging() context. This is a similar race condition to what was
seen in 19f34b2161.

Currently a new Messaging() context is created for every test case. By
using classmethods instead, the Messaging context is only created once
per python test file execution (i.e. creation of the python class,
rather than initialization of the python object, which happens for every
test-case).

This means the test will only create one Messaging() context, which
should avoid any race conditions.

Changes:
+ removed msg_ctxs - this wasn't actually used for anything.
+ use classmethods to setup and tear-down the Messaging() context (and
tweak lp initialization accordingly).
+ fix discardMessages() - the loop wasn't actually discarding any
messages previously (this may also have been the cause of the test
hanging).

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Noel Power <npower@samba.org>

Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Tue Mar  5 13:10:43 UTC 2019 on sn-devel-144
2019-03-05 13:10:43 +00:00
Douglas Bagnall
f0ecfd384c pidl/Python: initialise a datablob
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Mar  4 22:41:01 UTC 2019 on sn-devel-144
2019-03-04 22:41:01 +00:00
Douglas Bagnall
c942614eae dsdb pytsts: reduce scale of subtree rename speed test
The speed test, when it was introduced a few patches ago, was
deliberately slow so that we could see how much better the changes
were. It used 500 users, 50 groups, and 27 computers.

Before the changes, it took this long:

rename ou took 64.373s
rename group took 0.160s
rename user took 0.004s
rename computer took 0.123s

After using the sorted links, it took this long:

rename ou took 12.984s
rename group took 0.161s
rename user took 0.004s
rename computer took 0.122s

And with the final patch to stop the linear search early on success:

rename ou took 11.680s
rename group took 0.089s
rename user took 0.004s
rename computer took 0.128s

"rename ou" is the one we were aiming at. Now that we have done that,
we reduce the size of the test so as not to slow down everyone's
autobuilds.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
e4ac7fb9dc dsdb/linked_attributes: shortcut exit for backlink fix
In most cases there can only be one link for each GUID. If we assume
that is true, we can skip half the search, on average.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
4f812c1f32 dsdb/linked_attributes: improve formatting in some places
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
6d01cb5114 dsdb/linked_attributes: initialise more pointers to NULL
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
8765ed2f1d dsdb linked attributes: fix forward links faster
Rename operations can be very slow in large database with many group
memberships, because the linked attributes need to be found and
rewritten for each moved object and the way we did that was naive.

For a while now Samba has kept forward links in sorted order, so
finding group memberships can be an O(log n) rather than O(n)
operation. This patch makes use of that.

The backlinks are not sorted, nor are forward links in old databases,
so we have to use a linear search in those cases.

There is a little bit of extra work to handle the few kinds of forward
links (e.g. msDS-RevealedUsers) that have DN+Binary values.

Tim and Garming came up with the basic idea and a prototype.

Pair-programmed-with: Tim Beale <timbeale@catalyst.net.nz>
Pair-programmed-with: Garming Sam <garming@catalyst.net.nz>
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
518320ae33 dsdb: linked_attributes module knows about sorted links
Until now the linked attrbutes module has allocated its private data
on a per transaction basis, but we prefer to check the sorted links
feature less often than that. So the private data struct is given
module life time and a transaction member to carry out the old role.

In coming patches, the sorted links flag will be used.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
bf50324fef dsdb:replmd: add compatible feature helper function
repl_meta_data.c uses the compatible features attribute of the
"@SAMBA_DSDB" special object to record that linked attributes are
being stored in the database in a sorted order. Soon the
linked_attributes module is going to want to know the same thing, and
in time other modules will want to know about other compatible
features, so we introduce a helper function.

Error checking is slightly improved.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
7d8cfe02bb dsdb/pytests: sanity checks for links under subtree renames
These tests will ensure that linked attributes continue to be handled
correctly under forthcoming changes. The la_move_ou_tree_big() test
will show that the changes make this much faster, after which it can
perhaps be removed.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:18 +00:00
Douglas Bagnall
0673ad09ae replmd/la: disambiguate error messages a bit
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:17 +00:00
Douglas Bagnall
1f97322063 dsdb/group_audit: use common get_parsed_dns_trusted()
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:17 +00:00
Douglas Bagnall
16f4c694b5 dsdb:util_links: count el->values with unsigned int
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:17 +00:00
Douglas Bagnall
edfd33ab3e tests/rodc_rwdc: p.communicate() gives bytes, not str
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:17 +00:00
Douglas Bagnall
4ddfe8fc75 dns_hub: use python 3 shebang
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:17 +00:00
Douglas Bagnall
4d8aa4a160 s4/auth/krb: fix spelling of entries
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:17 +00:00
Andreas Schneider
c1b6fe62a4 s4:torture: Make sure we do not create a shadow 'struct params'
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-04 21:41:17 +00:00