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

35767 Commits

Author SHA1 Message Date
Michael Hanselmann
1e9b74e8e7 Remove ad2oLschema man page
ad2oLschema itself was removed in commit 17aac8cad2 in March 2009. Also
remove the last reference to the program.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-26 03:03:23 +00:00
Michael Hanselmann
0c7c44a284 Split oLschema2ldif into library and binary
The oLschema2ldif program was contained in a single file, making reuse
of its parsing logic elsewhere impossible. With this change the majority
of the code is moved to a new file, "lib.c", while the CLI interface is
now in a "main.c" file.

End-of-line whitespace is also removed.

Signed-off-by: Michael Hanselmann <public@hansmi.ch>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-26 03:03:23 +00:00
Michael Saxl
526c6d0be5 s4:dlz make b9_has_soa check dc=@ node
the zone node does not hold the dnsRecord values, so for the zone level
the node dc=@,dc=zonename has to be queried

regression introduced with 28e2a518ff, BUG: https://bugzilla.samba.org/show_bug.cgi?id=13466

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

Signed-off-by: Michael Saxl <mike@mwsys.mine.bz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-26 03:03:23 +00:00
Garming Sam
6c62e05466 dlz: Add test to ensure there are writable zones
This is currently broken since 28e2a518ff

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

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-26 03:03:23 +00:00
Samuel Cabrero
e23425a03c s4:dsdb: Check errno to determine if crypt or crypt_r succeeded
The behavior of these functions upon errors depends on the implementation.
The GNU libc implementation seems to return a null hash, but others like
libxcrypt returns a invalid hash string '*0'.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-03-22 14:03:19 +00:00
Samuel Cabrero
88804bc24c s4:torture: Initialize tm struct
The samba3.blackbox.shadow_copy_torture tests call to strptime passing
an uninitalized tm structure as an argument, but the strptime function
does not write the tm.tm_isdst field.

These tm structures are passed later as the mktime argument, which
produces different values depending on whether the arbitrary value
of the tm.tm_isdst field is lower or equal to zero or greather than
zero.

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
2019-03-22 14:03:19 +00:00
Stefan Metzmacher
dd6f0dad21 dbcheck: use the str() value of the "name" attribute
We do the same with the rdn attribute value
and we need the same logic on both in order to
check they are the same.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
2019-03-21 16:42:19 +00:00
Andrew Bartlett
6a6a178b3c selftest: Remove obsolete py3_compatible=True markers
All our tests now run in python3.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:15 +00:00
Andrew Bartlett
beda359bdd selftest: Remove support for running multiple tests against python versions in a single run
The extra_python support was added to aid the python3 transition

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:15 +00:00
Andrew Bartlett
fdb6305c86 build: Remove bld.gen_python_environments()
This was part of --extra-python support.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
2019-03-21 04:06:14 +00:00
Andrew Bartlett
270d04e4ea build: Remove --extra-python
This option is quite invasive in waf and was mainly for the python3 transition.

Testing with multiple python versions can be done by testing a full compile against
multiple versions, likewise multiple different binding versions can be created
the same way.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
2019-03-21 04:06:14 +00:00
Andreas Schneider
bf469343f5 s4:librpc: Fix installation of Samba
This breaks installation of Samba 4.10 on Fedora.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Mar 20 13:11:28 UTC 2019 on sn-devel-144
2019-03-20 13:11:28 +00:00
Volker Lendecke
d0dc4033cc heimdal: Fix "assuming signed overflow doesnt occur" error
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2019-03-18 19:21:24 +00:00
Stefan Metzmacher
a2c5f8cf41 dbcheck: don't check expired tombstone objects by default anymore
These will be removed anyway and any change on them risks to
be an originating update that causes replication problems.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Mar 14 03:12:27 UTC 2019 on sn-devel-144
2019-03-14 03:12:27 +00:00
Stefan Metzmacher
b096a3117e blackbox/dbcheck-links.sh: prepare regression test for skipping expired tombstones
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13816

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:21 +00:00
Stefan Metzmacher
a1658b306d dbcheck: detect the change after deletion bug
Old versions of 'samba-tool dbcheck' could reanimate
deleted objects, when running at the same time as the
tombstone garbage collection.

When the (deleted) parent of a deleted object
(with the DISALLOW_MOVE_ON_DELETE bit in systemFlags),
is removed before the object itself, dbcheck moved
it in the LostAndFound[Config] subtree of the partition
as an originating change. That means that the object
will be in tombstone state again for 180 days on the local
DC. And other DCs fail to replicate the object as
it's already removed completely there and the replication
only gives the name and lastKnownParent attributes, because
all other attributes should already be known to the other DC.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:20 +00:00
Stefan Metzmacher
1ccc21a34d blackbox/dbcheck-links.sh: add regression test for lost deleted object repair
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13816

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:20 +00:00
Stefan Metzmacher
e388e59949 dbcheck: don't remove dangling one-way links on already deleted objects
This would typically happen when the garbage collection
removed a parent object before a child object (both with
the DISALLOW_MOVE_ON_DELETE bit set in systemFlags),
while dbcheck is running at the same time as the garbage collection.
In this case the lastKnownParent attributes points a non existing
object.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:20 +00:00
Stefan Metzmacher
6d50ee7492 dbcheck: don't move already deleted objects to LostAndFound
This would typically happen when the garbage collection
removed a parent object before a child object (both with
the DISALLOW_MOVE_ON_DELETE bit set in systemFlags),
while dbcheck is running at the same time as the garbage collection.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:20 +00:00
Stefan Metzmacher
3e8a435d27 dsdb:repl_meta_data: allow CONTROL_DBCHECK_FIX_LINK_DN_NAME to by pass rename
We need a way to rename an object without updating the replication meta
data.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:19 +00:00
Stefan Metzmacher
5357f591ac blackbox/dbcheck-links.sh: reproduce lost deleted object problem
When a parent object is removed during the tombstone garbage collection
before a child object and samba-tool dbcheck runs at the same time, the
following can happen:

- If the object child had DISALLOW_MOVE_ON_DELETE in systemFlags,
  samba-tool dbcheck moves the object under the LostAndFound[Config]
  object (as an originating update!)
- The lastKnownParent attribute is removed (as an originating update!)

These originating updates cause the object to have an extended time
as tombstone. And these changes are replicated to other DCs,
which very likely already removed the object completely!

This means the destination DC of replication has no chance to handle
the object it gets from the source DC with just 2 attributes (name, lastKnownParent).

The destination logs something like:

  No objectClass found in replPropertyMetaData

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:19 +00:00
Douglas Bagnall
c69092e9ba s4/scripting: remove obsolete w32err_code.py
This has been replaced by gen_werror.py which shares common code with other scripts
(e.g. gen_ntstatus) and is more likely to work with conteporary microsoft HTML.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-14 02:12:18 +00:00
Tim Beale
a68e8af2d1 testsuite: Remove build_farm testsuites
This test code is not run (and has not been run for about a decade).
Let's remove it - it's there in the git history if we ever want to try
to repurpose it again.

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): Tue Mar 12 02:56:05 UTC 2019 on sn-devel-144
2019-03-12 02:56:05 +00:00
Tim Beale
a64c2e3bde s4/scripting: Remove legacy selftest-vars.sh script
This script was added in 2010 and has only been sporadically kept
up-to-date since. It doesn't appear to work (I think that selftest
and the testenvs have perhaps grown in complexity since 2010 and it's no
longer possible to try to access a testenv from a different
process-space, due to how we use the cwrap libraries).

There's now an alternative (export_envvars_to_file()) in the selftest
code to regenerate a similar file, if anyone actually needs it.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 01:53:26 +00:00
Tim Beale
3bee244394 selftest: Remove unused SELFTEST_INTERFACES
This doesn't appear to be used anywhere and dates back to 2008.

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 01:53:26 +00:00
Volker Lendecke
d7de2f7748 lib: Remove "struct sid_parse_ret" again
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 00:42:19 +00:00
Volker Lendecke
e18610a197 lib: Make sid_parse return the parsed length
Use a temporary struct as a return value to make the compiler catch all
callers. If we just changed bool->ssize_t, this would just generate a
warning. struct sid_parse_ret will go away in the next commit

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 00:42:19 +00:00
Douglas Bagnall
0a804d38c4 s4/scripting/autoidl: p3 exception syntax
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 00:42:18 +00:00
Douglas Bagnall
561b654bc5 s4/scripting: MORE py3 compatible print functions
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-12 00:42:18 +00:00
Joe Guo
16d40ffcf0 samba-o3: fix -Werror=strict-overflow error in s4/torture/raw/eas module
samba-o3 test failed in ubuntu:16.04 docker container:

    ==> /home/samba/samba/samba-o3.stderr <==
    ../../source4/torture/raw/eas.c: In function ‘test_max_eas’:
    ../../source4/torture/raw/eas.c:286:12: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow]
     static bool test_max_eas(struct smbcli_state *cli, struct torture_context *tctx)
                ^
    cc1: all warnings being treated as errors

`total += j` may overflow. Change total type to `size_t` to mute error.

Signed-off-by: Joe Guo <joeg@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2019-03-08 00:42:19 +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
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
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
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