summaryrefslogtreecommitdiff
path: root/source4
Commit message (Collapse)AuthorAgeFilesLines
...
* replmd: Only modify the object if it actually changedTim Beale2018-11-211-0/+14
| | | | | | | | | | | | | | | | Commit 775054afbe1512 reworked replmd_process_link_attribute() so that we batch together DB operations for the same source object. However, it was possible that the object had not actually changed at all, e.g. - link was already processed by critical-objects-only during join, or - we were doing a full-sync and processing info that was already up-to-date in our DB. In these cases we modified the object anyway, even though nothing had changed. This patch fixes it up, so we check that the object has actually changed before modifying the DB. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replmd: replmd_process_link_attribute() returns type of change madeTim Beale2018-11-211-2/+20
| | | | | | | | | | | | | | | | In order to share work across related link attribute updates, we need replmd_process_link_attribute() to let the caller know what actually changed. This patch adds an extra return type that'll be used in the next patch. What we're interested in is: the update was ignored (i.e. it's old news), a new link attribute was added (because this affects the overall msg/element memory), and an existing link attribute was modified (due to how links are actually stored, this includes deleting the link, as in reality it simply involves setting the existing link to 'inactive'). Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* source4 samr: Tidy DBG_WARNING callsGary Lockyer2018-11-211-49/+27
| | | | | | | | | | | | | | Move the calls to GUID_buf_string and dom_sid_str_buf into the coresponding DBG_WARNING call, instead of using an intermediate variable. While this violates the coding guidelines, doing this makes the code less cluttred and means the functions are only called if the debug message is printed. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Autobuild-User(master): Andrew Bartlett <abartlet@samba.org> Autobuild-Date(master): Wed Nov 21 01:50:11 CET 2018 on sn-devel-144
* s4-samr: Use GUID_buf_string() in dcesrv_samr_EnumDomainUsers()Andrew Bartlett2018-11-201-2/+6
| | | | | | | | This avoids memory allocation. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s4-samr: Use dom_sid_split_rid() to get the RID in dcesrv_samr_EnumDomainUsersAndrew Bartlett2018-11-201-5/+27
| | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* source4 samr: cache samr_EnumDomainUsers resultsGary Lockyer2018-11-202-48/+156
| | | | | | | | | | | Add a cache of GUID's that matched the last samr_EnunDomainUsers made on a domain handle. The cache is cleared if resume_handle is zero, and when the final results are returned to the caller. The existing code repeated the database query for each chunk requested. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4-samr: Use GUID_buf_string() in dcesrv_samr_EnumDomainGroups()Andrew Bartlett2018-11-201-2/+6
| | | | | | | | This avoids memory allocation Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* s4-samr: Use dom_sid_split_rid() to get the RID in dcesrv_samr_EnumDomainGroupsGary Lockyer2018-11-201-5/+27
| | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* source4 samr: cache samr_EnumDomainGroups resultsGary Lockyer2018-11-202-51/+211
| | | | | | | | | Add a cache of GUID's that matched the last samr_EnunDomainGroups made on a domain handle. The cache is cleared if resume_handle is zero, and when the final results are returned to the caller. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4-samr: Use dom_sid_split_rid() to get the RID in dcesrv_samr_QueryDisplayInfoAndrew Bartlett2018-11-201-6/+24
| | | | | | Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
* source4 samr: cache samr_QueryDisplayInfo resultsGary Lockyer2018-11-202-145/+318
| | | | | | | | | | | | | | Add a cache of GUID's that matched the last samr_QueryDisplayInfo made on a domain handle. The cache is cleared if the requested start index is zero, or if the level does not match that in the cache. The cache is maintained in the guid_caches array of the dcesrv_handle. Note: that currently this cache exists for the lifetime of the RPC handle. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replmd: Cache recycle-bin state to avoid DB lookupTim Beale2018-11-201-6/+28
| | | | | | | | | | | | | | | | | | By caching the recycle-bin state we can save ~6% of the join time. Checking whether the recycle-bin is enabled involves an underlying DSDB search. We do this ~4 times for each link we replicate (twice for the link source and target). By caching the recycle-bin's state over the duration of the replication, we can save 1000s of unnecessary DB searches. With 5K users this makes the join time ~5 secs faster. 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): Tue Nov 20 08:40:16 CET 2018 on sn-devel-144
* replmd: Split some code out into create_la_entry() helper functionTim Beale2018-11-201-17/+41
| | | | | | | | | | | replmd_store_linked_attributes() has gotten in szie and complexity. This refactors some code out into a separate function to make things a bit more manageable. This patch should not alter functionality. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replmd: Minor change to replmd_verify_link_target() argsTim Beale2018-11-201-6/+5
| | | | | | | | | | | We were passing in the entire src_msg, but all we really need is the source object's DN (and even then, it's only used in error messages). Change it so we only pass in what the function actually needs. This makes it a bit easier to see what src_msg is actually used for. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replmd: Skip redundant source object link checksTim Beale2018-11-201-20/+37
| | | | | | | | | | | | | | | | | | We receive the links grouped together by source object. We can save ourselves some work by not looking up the source object for every single link (if it's still the same object we're dealing with). We've already made this change to replmd_process_linked_attribute(). This patch makes the same change to replmd_store_linked_attributes(). (We verify that we know about each link source/target as we receive each replication chunk. replmd_process_linked_attribute() kicks in later as the transaction completes). Note some care is needed to hold onto the tmp_ctx/src_msg across multiple passes of the for loop. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* replmd: Split up replmd_verify_linked_attribute() into src/target checksTim Beale2018-11-201-31/+43
| | | | | | | | | | | | | | | Refactor replmd_verify_linked_attribute() so we split out the link attribute source/target checks. This patch should not alter functionality. The source object check has been moved out to where replmd_verify_linked_attribute() was called. replmd_verify_linked_attribute() has been renamed, as it's now only checking the link target. Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4:heimdal_build: make use of libreplace getprogname() replacementStefan Metzmacher2018-11-202-8/+5
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* dsdb group_audit tests: fix use of strncmpGary Lockyer2018-11-201-3/+8
| | | | | | | | | | Replace the uses of: strncmp(expected, value, strlen(expected)) With: strcmp(expected, value) Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* smbtorture: Close unused pipe fds in kernel_oplocks8Christof Schmitt2018-11-161-0/+2
| | | | | | | | | | | This fixes a hang of the testcase when hitting an error in the child (e.g. localdir does not exist) 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): Fri Nov 16 21:52:13 CET 2018 on sn-devel-144
* dsdb: Slightly simplify samdb_check_passwordVolker Lendecke2018-11-161-11/+10
| | | | | | | | Avoid an "else" where we have the early return Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Björn Baumbach <bbaumbach@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* torture: Fix the 32-bit buildVolker Lendecke2018-11-151-2/+2
| | | | | | | | | | | Unfortunately there's no off_t printf specifier as there's one for size_t. So we have to use intmax_t. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 15 19:45:24 CET 2018 on sn-devel-144
* s4:torture: Use 65520 for maxopenfilesAndreas Schneider2018-11-151-1/+9
| | | | | | | The socket_wrapper limit is 65535 open sockets. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4:dsdb: Use const char in py_dsdb_garbage_collect_tombstones()Andreas Schneider2018-11-141-1/+1
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
* s4:librpc: Use discard_const_p for ndr/py_miscAndreas Schneider2018-11-141-3/+5
| | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Uri Simchoni <uri@samba.org>
* s4/scripting/bin: gensec_client.update needs bytesNoel Power2018-11-141-2/+1
| | | | | | | PY3 test was failing as param passed to update was str rather than bytes Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/scripting/bin: PY3 convert servicePrincipalName attr to stringTim Beale2018-11-141-1/+1
| | | | | | | | | | res[0]["servicePrincipalName"] is an instance of ldb.bytes in PY3 If we wish to get the string value we need to call the custom str function which attempts to decode the bytes to 'utf8' Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed by: Noel Power <npower@samba.org>
* s4/dsdb/tests: PY3 port of samba4.ldap.acl.pythonNoel Power2018-11-141-11/+12
| | | | | | | convert various attribute results to str so assert function as expected for tests. Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/dsdb/tests/python: PY3 port samba4.ldap.secdescNoel Power2018-11-141-8/+8
| | | | | | | User str/bytes as needed for various asserts Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/dsdb/tests/python: PY3 port samba4.ldap_schema.pythonNoel Power2018-11-141-8/+8
| | | | | | | | | + Misc attributes needed to be converted to strings from bytes to ensure various asserts work as expected. + Fix ndr_unpack call which needs bytes not str Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4:torture/smb2/session: test smbXcli_session_set_disconnect_expired() worksRalph Boehme2018-11-131-0/+110
| | | | | | | | | | | This adds a simple test that verifies that after having set smbXcli_session_set_disconnect_expired() a session gets disconnected when it expires. Bug: https://bugzilla.samba.org/show_bug.cgi?id=9175 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org>
* s4:torture/smb2/session: session reauth response must be signedRalph Boehme2018-11-131-0/+8
| | | | | | | | | | This test checks that a session setup reauth is signed even when neither client nor server require signing. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13661 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s4:torture/smb2/session: add force_signing to test_session_expire1iRalph Boehme2018-11-131-1/+6
| | | | | | | | | | Existing callers pass true, so no change in behaviour. The next commit adds an additional test that passes force_signing=false. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13661 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s4:torture/smb2/session: require a signed session setup reauth responseRalph Boehme2018-11-131-0/+8
| | | | | | | | | | | All existing tests using this function require signing, so currently this passes. A subsequent commit adds a test where neither client nor server require signing and that's where this trap will explode. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13661 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s4:torture/smb2/session: invalidate credential cacheRalph Boehme2018-11-131-0/+8
| | | | | | | | | | | | | | Invalidate credential cache before connecting to the server, otherwise we will reuse the credentials from the credential cache populated by the preceeding tests. Also invalidate it at the end, otherwise subsequent tests might run into problems if the credentials expire while authenticating. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13661 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org>
* s4-auth-tests: Fix test_kerberos with MIT krbJustin Stephenson2018-11-101-0/+17
| | | | | | | | | | | | | | | | When a keytab of type MEMORY is used, the MIT kerberos krb5_kt_add_entry() library function adds a keytab entry to the beginning of the keytab table, instead of the end. This adds a MIT kerberos conditional to reverse iterate through the keytable entries to address this. Signed-off-by: Justin Stephenson <jstephen@redhat.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> Autobuild-User(master): Alexander Bokovoy <ab@samba.org> Autobuild-Date(master): Sat Nov 10 12:48:02 CET 2018 on sn-devel-144
* s4:torture/vfs/fruit: torture writing AFP_AfpInfo streamRalph Boehme2018-11-091-0/+336
| | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13677 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4-kdc: restore MIT KDC backendPhilipp Gesang2018-11-092-17/+20
| | | | | | | | | | | | | | | Fix fallout from the KDC prefork patchset (99aea42520fc..). GCC warns when Samba is being built with --with-system-mitkrb5. Fix this by adapting the signature of mitkdc_task_init() to match task_init which has been extended to return a status code. Status codes try to mimick those of kdc-heimdal.c:kdc_task_init() as closely as possible. Signed-off-by: Philipp Gesang <philipp.gesang@intra2net.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org>
* debug: Use debuglevel_(get|set) functionAndreas Schneider2018-11-081-1/+1
| | | | | | | | Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Thu Nov 8 11:03:11 CET 2018 on sn-devel-144
* source4 smdb rpc_server: Support prefork process model.Gary Lockyer2018-11-071-80/+115
| | | | | | | | | | | Allow the rpc_server to run in the prefork process model. Due to the use of shared handles and resources all of the rpc end points are serviced in the first worker process. Those end points that can be run in multiple processes (currently only Netlogon and management) are serviced in the first and any subsequent workers. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* source4 smbd: pass instance number to post_forkGary Lockyer2018-11-075-8/+21
| | | | | | | | Pass the instance number to the post_fork hook. This is required to allow the rpc_server to support the prefork process model. Signed-off-by: Gary Lockyer <gary@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* libnet: Reset debug counters after replicating critical objectsTim Beale2018-11-061-0/+6
| | | | | | | | | | | | | | | | Reset the debug counters once we have finished replicating a given partition. This helps if we replicate the same partition immediately afterward with different options. This helps the DC join debug look less weird. Because it replicates the critical objects first, and then the base partition, previously it always ended up overcounting, e.g. Partition[DC=addom,DC=samba,DC=example,DC=com] objects[314/218] linked_values[48/24] Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
* s4/selftest: enable samba.tests.samba_tool.gpo for PY3Noel Power2018-11-051-2/+2
| | | | | | | | Signed-off-by: Noel Power <noel.power@suse.com> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Autobuild-User(master): Noel Power <npower@samba.org> Autobuild-Date(master): Mon Nov 5 23:04:48 CET 2018 on sn-devel-144
* smbtorture: Add test for DELETE_ON_CLOSE on files with READ_ONLY attributeChristof Schmitt2018-11-031-0/+119
| | | | | | | BUG: https://bugzilla.samba.org/show_bug.cgi?id=13673 Signed-off-by: Christof Schmitt <cs@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* auth4: Use dom_sid_str_bufVolker Lendecke2018-11-021-8/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* audit_tests: Use dom_sid_str_bufVolker Lendecke2018-11-021-10/+10
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* dsdb: Use dom_sid_str_bufVolker Lendecke2018-11-021-6/+5
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* rpc_server4: Use dom_sid_str_bufVolker Lendecke2018-11-021-5/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* nbt_server: Use dom_sid_str_bufVolker Lendecke2018-11-021-4/+6
| | | | | Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4:torture/smb2/read: add test for cancelling SMB aioRalph Boehme2018-11-023-0/+118
| | | | | | | | Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* s4:libcli/smb2: reapply request endtimeRalph Boehme2018-11-021-0/+17
| | | | | | | | | | | tevent_req_finish() removed a possible request timeout, make sure to reinstall it. This happened when an interim SMB2 response was received. Bug: https://bugzilla.samba.org/show_bug.cgi?id=13667 Signed-off-by: Ralph Boehme <slow@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>