samba.git
9 years agoprinting: only reload printer shares on client enum
David Disseldorp [Fri, 11 Jul 2014 15:00:05 +0000 (17:00 +0200)]
printing: only reload printer shares on client enum

Currently, automatic printer share updates are handled in the following
way:
- Background printer process (BPP) forked on startup
- Parent smbd and per-client children await MSG_PRINTER_PCAP messages
- BPP periodically polls the printing backend for printcap data
- printcap data written to printer_list.tdb
- MSG_PRINTER_PCAP sent to all smbd processes following update
- smbd processes all read the latest printer_list.tdb data, and update
  their share listings

This procedure is not scalable, as all smbd processes hit
printer_list.tdb in parallel, resulting in a large spike in CPU usage.

This change sees smbd processes only update their printer share lists
only when a client asks for this information, e.g. via NetShareEnum or
EnumPrinters.

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

Suggested-by: Volker Lendecke <vl@samba.org>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 4f4501ac1f35ab15f25d207c0d33e7c4d1abdf38)

9 years agoprinting: traverse_read the printer list for share updates
David Disseldorp [Wed, 9 Jul 2014 22:18:10 +0000 (00:18 +0200)]
printing: traverse_read the printer list for share updates

The printcap update procedure involves the background printer process
obtaining the printcap information from the printing backend, writing
this to printer_list.tdb, and then notifying all smbd processes of the
new list. The processes then all attempt to simultaneously traverse
printer_list.tdb, in order to update their local share lists.

With a large number of printers, and a large number of per-client smbd
processes, this traversal results in significant lock contention, mostly
due to the fact that the traversal is unnecessarily done with an
exclusive (write) lock on the printer_list.tdb database.

This commit changes the share update code path to perform a read-only
traversal.

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

Reported-by: Alex K <korobkin+samba@gmail.com>
Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 1e83435eac2cef03fccb4cf69ef5e0bfbd710410)

9 years agos3: smbd : SMB2 - fix SMB2_SEARCH when searching non wildcard string with a case...
Jeremy Allison [Tue, 10 Jun 2014 22:58:15 +0000 (15:58 -0700)]
s3: smbd : SMB2 - fix SMB2_SEARCH when searching non wildcard string with a case-canonicalized share.

We need to go through filename_convert() in order for the filename
canonicalization to be done on a non-wildcard search string (as is
done in the SMB1 findfirst code path).

Fixes Bug #10650 - "case sensitive = True" option doesn't work with "max protocol = SMB2" or higher in large directories.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3: smbd - SMB[2|3]. Ensure a \ or / can't be found anywhere in a search path, not...
Jeremy Allison [Tue, 10 Jun 2014 21:41:45 +0000 (14:41 -0700)]
s3: smbd - SMB[2|3]. Ensure a \ or / can't be found anywhere in a search path, not just at the start.

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3: enforce a positive allocation_file_size for non-empty files (bug #10543)
Björn Baumbach [Thu, 27 Mar 2014 10:17:30 +0000 (11:17 +0100)]
s3: enforce a positive allocation_file_size for non-empty files (bug #10543)

Some file systems do not allocate a block for very
small files. But for non-empty file should report a
positive size.

Pair-Programmed-With: Michael Adam <obnox@samba.org>

Signed-off-by: Björn Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr  5 03:09:00 CEST 2014 on sn-devel-104

(cherry picked from commit c35b31f45244a8339684c3b83a7d86eefb80e0da)

9 years agopassdb: fix NT_STATUS_NO_SUCH_GROUP
Arvid Requate [Thu, 17 Jan 2013 15:44:28 +0000 (16:44 +0100)]
passdb: fix NT_STATUS_NO_SUCH_GROUP

Share options like "force group" and "valid users = @group1"
triggered a NT_STATUS_NO_SUCH_GROUP. While the group was found in
the SAM backend, its objectclass was not retrived.

This fix also revealed a talloc access after free in the group
branch of pdb_samba_dsdb_getgrfilter.

[Bug 9570] Access failure for shares with "force group" or "valid users = @group"

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

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos3:libsmb: Set a max charge for SMB2 connections
Ross Lagerwall [Thu, 21 Aug 2014 06:32:36 +0000 (07:32 +0100)]
s3:libsmb: Set a max charge for SMB2 connections

Set a max charge for SMB2 connections so that larger request sizes can
be used and more requests can be in flight.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Aug 21 17:31:11 CEST 2014 on sn-devel-104

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10778
libsmbclient with SMB2 doesn't pipeline or use large blocks

9 years agos3: smbd: POSIX ACLs. Remove incorrect check for SECINFO_PROTECTED_DACL in incoming...
Jeremy Allison [Thu, 21 Aug 2014 23:28:42 +0000 (16:28 -0700)]
s3: smbd: POSIX ACLs. Remove incorrect check for SECINFO_PROTECTED_DACL in incoming security_information flags in posix_get_nt_acl_common().

Tidy-up of code obsoleted by fixes for bug #10773 (SECINFO_PROTECTED_DACL is not ignored).
We now never pass SECINFO_PROTECTED_DACL in security_information flags to this layer.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Aug 22 11:26:57 CEST 2014 on sn-devel-104

9 years agolibcli/security: add better detection of SECINFO_[UN]PROTECTED_[D|S]ACL in get_sec_info()
Stefan Metzmacher [Wed, 20 Aug 2014 13:00:59 +0000 (15:00 +0200)]
libcli/security: add better detection of SECINFO_[UN]PROTECTED_[D|S]ACL in get_sec_info()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Aug 22 02:52:50 CEST 2014 on sn-devel-104

9 years agos3:smbd: mask security_information input values with SMB_SUPPORTED_SECINFO_FLAGS
Stefan Metzmacher [Wed, 20 Aug 2014 11:58:38 +0000 (13:58 +0200)]
s3:smbd: mask security_information input values with SMB_SUPPORTED_SECINFO_FLAGS

Sometimes Windows clients doesn't filter SECINFO_[UN]PROTECTED_[D|S]ACL flags
before sending the security_information to the server.

security_information = SECINFO_PROTECTED_DACL| SECINFO_DACL
results in a NULL dacl being returned from an GetSecurityDecriptor
request. This happens because posix_get_nt_acl_common()
has the following logic:

if ((security_info & SECINFO_DACL) && !(security_info & SECINFO_PROTECTED_DACL)) {
    ... create DACL ...
}

I'm not sure if the logic is correct or wrong in this place (I guess it's
wrong...).

But what I know is that the SMB server should filter the given
security_information flags before passing to the filesystem.

[MS-SMB2] 3.3.5.20.3 Handling SMB2_0_INFO_SECURITY
...
The server MUST ignore any flag value in the AdditionalInformation field that
is not specified in section 2.2.37.

Section 2.2.37 lists:
OWNER_SECURITY_INFORMATION
GROUP_SECURITY_INFORMATION
DACL_SECURITY_INFORMATION
SACL_SECURITY_INFORMATION
LABEL_SECURITY_INFORMATION
ATTRIBUTE_SECURITY_INFORMATION
SCOPE_SECURITY_INFORMATION
BACKUP_SECURITY_INFORMATION

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agosecurity.idl: add SMB_SUPPORTED_SECINFO_FLAGS
Stefan Metzmacher [Wed, 20 Aug 2014 11:43:13 +0000 (13:43 +0200)]
security.idl: add SMB_SUPPORTED_SECINFO_FLAGS

A SMB server should only care about specific SECINFO flags
and ignore others e.g. SECINFO_PROTECTED_DACL.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
9 years agoFixed a memory leak in cli_set_mntpoint().
Har Gagan Sahai [Wed, 6 Aug 2014 09:02:35 +0000 (14:32 +0530)]
Fixed a memory leak in cli_set_mntpoint().

Fixes bug #10759 - Memory leak in libsmbclient in cli_set_mntpoint function

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

Signed-off-by: Har Gagan Sahai <SHarGagan@novell.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 13 04:36:50 CEST 2014 on sn-devel-104

9 years agolib: Remove unused nstrcpy
Volker Lendecke [Mon, 4 Aug 2014 05:29:14 +0000 (07:29 +0200)]
lib: Remove unused nstrcpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10758

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Aug  4 09:58:16 CEST 2014 on sn-devel-104

Signed-off-by: Volker Lendecke <vl@samba.org>
9 years agobuild: fix configure to honour --without-dmapi
Michael Adam [Mon, 18 Aug 2014 09:42:27 +0000 (11:42 +0200)]
build: fix configure to honour --without-dmapi

Previously, --without-dmapi would still autodetect and link a useable dmapi
library. This change allows to build without dmapi support even when a dmapi
library is found.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 2afacf940f21759c08bcc4a6e906428595966a19)

9 years agotests: dnsserver: Add a update test with name set to '.'
Amitay Isaacs [Mon, 28 Jul 2014 08:09:37 +0000 (18:09 +1000)]
tests: dnsserver: Add a update test with name set to '.'

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue Jul 29 19:33:19 CEST 2014 on sn-devel-104

(cherry picked from commit 6d104182d9667e4f996439d24cfa052f34098ce4)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10742
samba-tool dns add 172.31.9.161 s4xdom.base . NS mydns.org. => NO_MEMORY

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Thu Aug  7 18:54:28 CEST 2014 on sn-devel-104

9 years agos4-rpc: dnsserver: Allow . to be specified for @ record
Amitay Isaacs [Mon, 28 Jul 2014 03:07:58 +0000 (13:07 +1000)]
s4-rpc: dnsserver: Allow . to be specified for @ record

Windows allow both . and @ to be specified with modifying @ record.

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

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 4b4e30b780345c74f9983ba77f04c616b3d034b7)

9 years agos3: net time - fix usage and core dump.
Jeremy Allison [Tue, 29 Jul 2014 21:12:31 +0000 (14:12 -0700)]
s3: net time - fix usage and core dump.

Bug 10728 - 'net time system' segfaults

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3: xml-docs. Ensure users of 'net time' know the remote server must be specified...
Jeremy Allison [Tue, 29 Jul 2014 19:29:37 +0000 (12:29 -0700)]
s3: xml-docs. Ensure users of 'net time' know the remote server must be specified with -S.

Bug 10728 - 'net time system' segfaults

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3: remove stat_ex.vfs_private completely
Michael Adam [Thu, 17 Jul 2014 15:27:17 +0000 (17:27 +0200)]
s3: remove stat_ex.vfs_private completely

It is not used any more.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Jul 24 14:23:11 CEST 2014 on sn-devel-104

(cherry picked from commit cd95937369b1729e2417d78f3c903bce5d32da93)

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

9 years agos3:vfs:gpfs: remove a block and reduce indentation in gpfs_is_offline()
Michael Adam [Thu, 17 Jul 2014 15:06:32 +0000 (17:06 +0200)]
s3:vfs:gpfs: remove a block and reduce indentation in gpfs_is_offline()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit eb0577dca04a2fde4691094a006954d417d1cf22)

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

9 years agos3:vfs:gpfs: remove all writing uses of stat_ex.vfs_private from vfs_gpfs.
Michael Adam [Thu, 17 Jul 2014 21:35:58 +0000 (23:35 +0200)]
s3:vfs:gpfs: remove all writing uses of stat_ex.vfs_private from vfs_gpfs.

Now that the vfs_private cache is never read in vfs_gpfs, there is
no need any more to write it.

With this change, vfs_gpfs does not use vfs_private any more.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit d87d13f4c2a77c03bbffcd0fe4fc9464d9024cae)

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

9 years agos3:vfs:gpfs: Remove all reading uses of stat_ex.vfs_private from vfs_gfs.
Michael Adam [Thu, 17 Jul 2014 15:22:09 +0000 (17:22 +0200)]
s3:vfs:gpfs: Remove all reading uses of stat_ex.vfs_private from vfs_gfs.

This was used as a cache for offline-info in the stat buffer.
But as the implementation of gpfs_is_offline() showed, this cache
does not always carry valid information when the stat itself is valid
(since at least one call goes to fstatat() directly, circumventing
 the vfs).

So the correct thing is to always call SMB_VFS_IS_OFFLINE()
when checking whether a file is offline. For the pread and pwrite
calls, we need to call IS_OFFLINE before the actual read
and check afterwards if the file was offline before (as a basis
whether to send notifications).

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit 16a040f8ef7f2f594505ef07e6f9b77df8f1d725)

Conflicts:
source3/modules/vfs_gpfs.c

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

9 years agos3:vfs:gpfs: fix flapping offline: always get winAttrs from gpfs for is_offline
Michael Adam [Thu, 3 Jul 2014 08:10:11 +0000 (10:10 +0200)]
s3:vfs:gpfs: fix flapping offline: always get winAttrs from gpfs for is_offline

There is a problem of flapping offline due to uninitialized
stat buffers. Due to a optimization in vfswrap_readdir which
directly calling fastatat (i.e. not through vfs), marking the
stat buffer valid, there is nothing this module can do about
it and hence can not currently not rely on the vaildity of
the stat buffer.

By always calling out to GPFS even when the stat buffer is
flagged valid, we can always return correct offline information,
thereby sacrificing the readdir optimization.

Pair-Programmed-With: Volker Lendecke <vl@samba.org>

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit 31e67507144aae8d5a8ec49587ac89d2d94636f0)

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

9 years agos3:vfs:gpfs: store the winAttrs in the struct_ex when we got them in vfs_gpfs_fstat()
Michael Adam [Thu, 3 Jul 2014 08:07:37 +0000 (10:07 +0200)]
s3:vfs:gpfs: store the winAttrs in the struct_ex when we got them in vfs_gpfs_fstat()

This may (e.g.) have lead to some occurrences of flapping offline bits.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
(cherry picked from commit 573ca6ef6b8376800d8fc988d67909e103b74656)

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

9 years agos3:idmap: don't log missing range config if range checking not requested
Michael Adam [Sun, 20 Jul 2014 09:49:37 +0000 (11:49 +0200)]
s3:idmap: don't log missing range config if range checking not requested

idmap_init_domain() is called with check_range == false from
idmap_passdb_domain(). In this case, we usually don't have an
idmap range at all, and we don't want to level 1 debug
messages complaining about the fact are irritating at least.

This patch removes the debug in the case of check_range == false.

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

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 3c6ec8908a697ac95536b35d242ccd64e524a0a5)

9 years agosys_poll_intr: fix timeout arithmetic
Daniel Kobras [Mon, 21 Jul 2014 08:47:53 +0000 (10:47 +0200)]
sys_poll_intr: fix timeout arithmetic

Callers of sys_poll_intr() assume timeout to be in milliseconds like
poll(2) expects, but implementation used nanosecond units. Also make
sure timeout doesn't become infinite by mistake during time arithmetic.

Signed-off-by: Daniel Kobras <d.kobras@science-computing.de>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10731

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Jul 22 00:12:24 CEST 2014 on sn-devel-104

9 years agos4:torture/rpc: add rpc.netlogon.ServerReqChallengeGlobal
Stefan Metzmacher [Thu, 17 Jul 2014 14:05:12 +0000 (16:05 +0200)]
s4:torture/rpc: add rpc.netlogon.ServerReqChallengeGlobal

This demonstrates that the challenge table should be global.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Sat Jul 19 12:51:39 CEST 2014 on sn-devel-104

(cherry picked from commit d90f3323ee001080645dcd25da8b8ce1367b1377)

9 years agos4:rpc_server/netlogon: keep a global challenge table
Stefan Metzmacher [Thu, 17 Jul 2014 12:20:58 +0000 (14:20 +0200)]
s4:rpc_server/netlogon: keep a global challenge table

Some clients call netr_ServerReqChallenge() and netr_ServerAuthenticate3()
on different connections. This works against Windows DCs as they
have a global challenge table.

A VMware provisioning task for Windows VMs seemy to rely on this behavior.

As a fallback we're storing the challenge in a global memcache with a fixed
size. This should allow these strange clients to work against a
Samba AD DC.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(similar to commit 321ebc99b5a00f82265aee741a48aa84b214d6e8)

9 years agolib/util: move memcache.[ch] to the toplevel 'samba-util' library
Stefan Metzmacher [Thu, 17 Jul 2014 10:58:34 +0000 (12:58 +0200)]
lib/util: move memcache.[ch] to the toplevel 'samba-util' library

This is generic enough that it could be used in all code.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Jul 18 15:43:33 CEST 2014 on sn-devel-104

(cherry picked from commit 45807028d478c082fef6f3a3d5a142d96d63fb50)

9 years agos3:lib/memcache: only include the required header files
Stefan Metzmacher [Thu, 17 Jul 2014 10:49:48 +0000 (12:49 +0200)]
s3:lib/memcache: only include the required header files

We don't need the full "includes.h".

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit b560fac7f78b761ee279d8e87a749125665eb5d1)

9 years agos3:lib/memcache: make use of talloc for memcache_elements
Stefan Metzmacher [Thu, 17 Jul 2014 10:48:51 +0000 (12:48 +0200)]
s3:lib/memcache: make use of talloc for memcache_elements

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 91105d1057c29c5878f50678baeb1bd1a6f1abe3)

9 years agos3:lib/memcache: use uint8_t instead of uint8
Stefan Metzmacher [Thu, 17 Jul 2014 10:41:20 +0000 (12:41 +0200)]
s3:lib/memcache: use uint8_t instead of uint8

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit d7cbc63dc7537fc9562da985b77f6d62dc41fd84)

9 years agos4:torture/rpc: add invalidAuthenticate2
Stefan Metzmacher [Fri, 10 Jan 2014 11:19:08 +0000 (12:19 +0100)]
s4:torture/rpc: add invalidAuthenticate2

This add 'rpc.netlogon.netlogon.invalidAuthenticate2' as new test
it demonstrates the STATUS_BUFFER_OVERFLOW on computer names
larger than 15 characters.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jan 22 19:07:12 CET 2014 on sn-devel-104

(cherry picked from commit 38f8788d6bf7fac509dcf492214a66a8bb3ac3fc)

9 years agoselftest/knownfail: add ^samba4.rpc.netlogon.*.invalidAuthenticate2 for v4-1-*
Stefan Metzmacher [Fri, 18 Jul 2014 09:06:50 +0000 (11:06 +0200)]
selftest/knownfail: add ^samba4.rpc.netlogon.*.invalidAuthenticate2 for v4-1-*

This works in master (>= 4.2), but not in 4.1.x.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
9 years agolibcli/auth: also set secure channel type in netlogon_creds_client_init().
Günther Deschner [Wed, 19 Dec 2012 12:53:23 +0000 (13:53 +0100)]
libcli/auth: also set secure channel type in netlogon_creds_client_init().

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit a9d5b2fdf03a25e7669258de6c83288be3335cef)

9 years agolib: tevent: make TEVENT_SIG_INCREMENT atomic.
Jeremy Allison [Wed, 30 Jul 2014 16:56:54 +0000 (09:56 -0700)]
lib: tevent: make TEVENT_SIG_INCREMENT atomic.

On arm platforms incrementing a variable is not
an atomic operation, so may be interrupted by
signal processing (if a signal interrupts another
signal handler).

Use compiler built-ins to make this atomic.
__sync_fetch_and_add() works on gcc, llvm,
IBM xlC on AIX, and Intel icc (10.1 and
above).

atomic_add_32() works on Oracle Solaris.

Based on an inital patch from kamei@osstech.co.jp.

Bug #10640 - smbd is not responding - tevent_common_signal_handler() increments non-atomic variables

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

Back-ported from master 536c799f00d7bdd6a574b6bdbc0e9c742eeef8b5

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
9 years agoVERSION: Bump version up to 4.1.12.
Karolin Seeger [Fri, 1 Aug 2014 11:17:17 +0000 (13:17 +0200)]
VERSION: Bump version up to 4.1.12.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoVERSION: Disable git snapshots for the 4.1.11 release.
Karolin Seeger [Thu, 31 Jul 2014 13:00:27 +0000 (15:00 +0200)]
VERSION: Disable git snapshots for the 4.1.11 release.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10735
CVE-2014-3560: unstrcpy macro length is invalid

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoWHATSNEW: Add release notes for Samba 4.1.11.
Karolin Seeger [Thu, 31 Jul 2014 12:48:01 +0000 (14:48 +0200)]
WHATSNEW: Add release notes for Samba 4.1.11.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10735
CVE-2014-3560: unstrcpy macro length is invalid

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agofix unstrcpy
Volker Lendecke [Tue, 22 Jul 2014 05:02:00 +0000 (07:02 +0200)]
fix unstrcpy

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10735
CVE-2014-3560: unstrcpy macro length is invalid

9 years agoMerge tag 'samba-4.1.10' into v4-1-test
Stefan Metzmacher [Mon, 28 Jul 2014 08:07:54 +0000 (10:07 +0200)]
Merge tag 'samba-4.1.10' into v4-1-test

samba: tag release samba-4.1.10

Signed-off-by: Stefan Metzmacher <metze@samba.org>
9 years agoMerge commit 'origin/v4-1-test^' into v4-1-stable samba-4.1.10
Karolin Seeger [Mon, 28 Jul 2014 07:13:45 +0000 (09:13 +0200)]
Merge commit 'origin/v4-1-test^' into v4-1-stable

This was needed because of a changed commit message (fixed version number)
in v4-1-stable after generating the 'samba-4.1.9' tag.

Karolin

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
9 years agoMerge tag 'samba-4.1.9' into v4-1-stable
Karolin Seeger [Mon, 28 Jul 2014 07:00:36 +0000 (09:00 +0200)]
Merge tag 'samba-4.1.9' into v4-1-stable

samba: tag release samba-4.1.9

9 years agoVERSION: Bump version number up to 4.1.11...
Karolin Seeger [Mon, 28 Jul 2014 06:44:32 +0000 (08:44 +0200)]
VERSION: Bump version number up to 4.1.11...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoVERSION: Disable git snapshots for the 4.1.10 release.
Karolin Seeger [Mon, 28 Jul 2014 06:43:45 +0000 (08:43 +0200)]
VERSION: Disable git snapshots for the 4.1.10 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoWHATSNEW: Add release notes for Samba 4.1.10.
Karolin Seeger [Mon, 28 Jul 2014 06:42:15 +0000 (08:42 +0200)]
WHATSNEW: Add release notes for Samba 4.1.10.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()
Stefan Metzmacher [Wed, 16 Jul 2014 14:17:56 +0000 (16:17 +0200)]
ldb-samba: fix a memory leak in ldif_canonicalise_objectCategory()

Searches for '(objectCategory=Person)' will leak a ldb_dn structure
on the ldb_context. These searches are typically used by Zarafa.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Thu Jul 17 00:51:57 CEST 2014 on sn-devel-104

(cherry picked from commit 8d33cddcb001a5a78aca036161d6223268274211)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Sat Jul 19 05:25:12 CEST 2014 on sn-devel-104

9 years agos3: SMB2 : Fix leak of blocking lock records in the database.
Jeremy Allison [Thu, 26 Jun 2014 19:08:46 +0000 (12:08 -0700)]
s3: SMB2 : Fix leak of blocking lock records in the database.

Based on a fix from Hemanth Thummala <hemanth.thummala@gmail.com>
Bug #10673 - Increasing response times for byte range unlock requests.

The previous refactoring makes it obvious we need to call
remove_pending_lock() in all places where we are returning
from the SMB2 blocking lock call.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Mon Jun 30 14:59:16 CEST 2014 on sn-devel-104

(cherry picked from commit cee1531e551e5ccd5ccd4a55de226ad686919486)

9 years agos3: smb2: Simplify logic in reprocess_blocked_smb2_lock().
Jeremy Allison [Thu, 26 Jun 2014 19:01:56 +0000 (12:01 -0700)]
s3: smb2: Simplify logic in reprocess_blocked_smb2_lock().

SMB2 blocking locks can only have one lock per request, so
there can never be any other locks to wait for.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 1a02a1e6aa15c028a848585d66cecbbdda8015b3)

9 years agos3: smb2: Remove unused code from remove_pending_lock().
Jeremy Allison [Thu, 26 Jun 2014 00:10:45 +0000 (17:10 -0700)]
s3: smb2: Remove unused code from remove_pending_lock().

SMB2 blocking locks can only have one lock per request, so
there can never be any previous locks to remove.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 508c09c6a019458bb0290fbf284e73c24feddb0e)

9 years agoselftest/knownfail: ignore samba3.smb2.oplock.exclusive5 failures in v4-1-*
Stefan Metzmacher [Tue, 15 Jul 2014 10:57:29 +0000 (12:57 +0200)]
selftest/knownfail: ignore samba3.smb2.oplock.exclusive5 failures in v4-1-*

This is fixed by 20669d4a75386eef4fdcea07fb99812c4e09de13 in master.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Thu Jul 17 11:07:08 CEST 2014 on sn-devel-104

9 years agosmbd: Remove 2 indentation levels
Volker Lendecke [Wed, 25 Jun 2014 08:36:47 +0000 (08:36 +0000)]
smbd: Remove 2 indentation levels

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
(cherry picked from commit 1dc5c20c8f7d8aa96fa0601bf5bf6dc69fb79d9f)

9 years agos3: smbd - Prevent file truncation on an open that fails with share mode violation.
Jeremy Allison [Tue, 24 Jun 2014 21:19:30 +0000 (14:19 -0700)]
s3: smbd - Prevent file truncation on an open that fails with share mode violation.

Fix from Volker, really - just tidied up a little.
The S_ISFIFO check may not be strictly neccessary,
but doesn't hurt (might make the code a bit more complex
than it needs to be).

Fixes bug #10671 - Samba file corruption as a result of failed lock check.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
(cherry picked from commit 31b3427a417217e5e869baafdf63e633efc39d12)
[ddiss@samba.org: 4.1 backport]

9 years agos4:dsdb/repl_meta_data: make sure objectGUID can't be deleted
Stefan Metzmacher [Mon, 7 Jul 2014 21:51:31 +0000 (23:51 +0200)]
s4:dsdb/repl_meta_data: make sure objectGUID can't be deleted

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit d64bc6c9af24109e89632db9133070f2ab827c46)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Tue Jul 15 15:01:25 CEST 2014 on sn-devel-104

9 years agoselftest: teardown the environments also on getting SIGPIPE
Stefan Metzmacher [Thu, 10 Jul 2014 12:28:56 +0000 (14:28 +0200)]
selftest: teardown the environments also on getting SIGPIPE

make test uses

selftest.pl | subuntu-filter.py ...

FAIL_IMMEDIATELY=1 lets subuntu-filter.py exit,
which generates SIGPIPE in selftest.pl.

We should handle this just like any other signal
and teardown all environments.

This should make the teardown process more reliable/verbose.

Pair-Programmed-With: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
(cherry picked from commit b2803950fc439017680069813fc49255a3f0cbbf)

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10696
backport autobuild/selftest fixes from master

9 years agolibwbclient: allow only one initial_blob/challenge_blob in wbcCredentialCache()
Stefan Metzmacher [Thu, 10 Jul 2014 03:28:36 +0000 (05:28 +0200)]
libwbclient: allow only one initial_blob/challenge_blob in wbcCredentialCache()

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
9 years agos3: libwbclient: Don't break out of loop too soon - find all parameters.
Jeremy Allison [Tue, 8 Jul 2014 23:36:30 +0000 (16:36 -0700)]
s3: libwbclient: Don't break out of loop too soon - find all parameters.

Fix bug #10692: wbcCredentialCache fails if challenge_blob is not first

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos4:dsdb/samldb: don't allow 'userParameters' to be modified over LDAP for now
Stefan Metzmacher [Tue, 8 Jul 2014 14:19:09 +0000 (16:19 +0200)]
s4:dsdb/samldb: don't allow 'userParameters' to be modified over LDAP for now

For now it's safer to reject setting 'userParameters' via LDAP,
as we'll not provide the same behavior as a Windows Server.

If someone requires that feature please report this in the following
bug reports!

Bug: https://bugzilla.samba.org/show_bug.cgi?id=8077
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10130

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Jul  9 11:07:51 CEST 2014 on sn-devel-104

(cherry picked from commit 04e9d020c97c2dcd360b1845907f4c396d5671dc)

9 years agodbcheck: Add check and test for various invalid userParameters values
Andrew Bartlett [Tue, 17 Jun 2014 04:00:57 +0000 (16:00 +1200)]
dbcheck: Add check and test for various invalid userParameters values

Bug: https://bugzilla.samba.org/show_bug.cgi?id=8077
Change-Id: I6f2f4169856ce78c62e3a7e74b48520cca9cb9ae
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 9bfbff65436a088fab5d564b6c0bb122a76492bc)

9 years agodsdb: Always store and return the userParameters as a array of LE 16-bit values
Andrew Bartlett [Tue, 17 Jun 2014 04:03:22 +0000 (16:03 +1200)]
dsdb: Always store and return the userParameters as a array of LE 16-bit values

This is not allowed to be odd length, as otherwise we can not send it over the SAMR transport correctly.

Allocating one byte less memory than required causes malloc() heap corruption
and then a crash or lockup of the SAMR server.

Andrew Bartlett

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10130
Change-Id: I5c0c531c1d660141e07f884a4789ebe11c1716f6
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit d7b4d10aba90f4a1acf01d1d5ab62161862f62f7)

9 years agodsdb: Set syntax of userParameters to binary string, not unicode string
Andrew Bartlett [Tue, 24 Sep 2013 17:12:24 +0000 (10:12 -0700)]
dsdb: Set syntax of userParameters to binary string, not unicode string

This means we continue to store the values as given on SAMR, assuming
that the SAMR buffer is little endian.  The syntax for this specific
object is forced to be a binary blob, so that it is not converted on
DRSUAPI.

This commit does not fix existing databases, nor pdb_samba_dsdb (used
by classicupgrade).

Andrew Bartlett

Bug: https://bugzilla.samba.org/show_bug.cgi?id=8077
Change-Id: I10bb6aaecc381194e3c0ce6b9163f961acbdcee1
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 1592eaa5c781af83aa64bc4e7211339e1d1eafce)

9 years agotorture4: Make raw.lock.multilock fail after 20 seconds
Volker Lendecke [Thu, 3 Jul 2014 10:05:55 +0000 (10:05 +0000)]
torture4: Make raw.lock.multilock fail after 20 seconds

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jul  4 00:04:10 CEST 2014 on sn-devel-104

(cherry picked from commit 0c97b7eb5359b95c0d51a3b5524e82e34243d2d1)

The last 7 patches address bug #10684 - SMB1 blocking locks can fail
notification on unlock, causing client timeout.

9 years agotorture4: Adapt comment to code
Volker Lendecke [Thu, 3 Jul 2014 10:05:39 +0000 (10:05 +0000)]
torture4: Adapt comment to code

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4205463ef1815d6e86e1d1f1f57651ca30407469)

9 years agos4: smbtorture: Add multi-lock test. Regression test for bug #10684.
Jeremy Allison [Tue, 1 Jul 2014 19:05:07 +0000 (12:05 -0700)]
s4: smbtorture: Add multi-lock test. Regression test for bug #10684.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 64346a134dac2bd023f7473202ca38d35ffd3c89)

9 years agos3: smbd: Locking - re-add pending lock records if we fail to acquire a lock (and...
Jeremy Allison [Thu, 3 Jul 2014 03:51:24 +0000 (20:51 -0700)]
s3: smbd: Locking - re-add pending lock records if we fail to acquire a lock (and the lock hasn't timed out).

Keep the blocking lock record and the pending lock records consistent
if we are dealing with multiple blocking lock requests in one SMB1 LockingX
request.

Ensure we re-add the records under the record lock, to avoid race
conditions.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 954401f8b2b16b3e2ef9655e8ce94d657becce36)

9 years agos3: smbd: Locking - treat lock timeout the same as any other error.
Jeremy Allison [Thu, 3 Jul 2014 03:40:49 +0000 (20:40 -0700)]
s3: smbd: Locking - treat lock timeout the same as any other error.

Allows the special case in process_blocking_lock_queue()
that talks back to the client to be removed.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit cc9de6eb091159a84228b988c49261c46c301233)

9 years agos3: smbd: Locking - add and use utility function lock_timed_out().
Jeremy Allison [Thu, 3 Jul 2014 03:18:42 +0000 (20:18 -0700)]
s3: smbd: Locking - add and use utility function lock_timed_out().

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 12be57ef3b2d1b670be7a83f29cd580938030015)

9 years agos3: smbd: Locking - convert to using utility macro used elsewhere.
Jeremy Allison [Thu, 3 Jul 2014 00:25:22 +0000 (17:25 -0700)]
s3: smbd: Locking - convert to using utility macro used elsewhere.

Bug #10684 - SMB1 blocking locks can fail notification on unlock, causing client timeout.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <Volker.Lendecke@SerNet.DE>
(cherry picked from commit 517fa80bd385c6adcfee03ea6b25599013ad88f5)

9 years agos4:dsdb/extended_dn_in: don't force DSDB_SEARCH_SHOW_RECYCLED
Stefan Metzmacher [Mon, 7 Jul 2014 10:00:14 +0000 (12:00 +0200)]
s4:dsdb/extended_dn_in: don't force DSDB_SEARCH_SHOW_RECYCLED

We should take the controls the caller provided when we search
for existing objects.

A search with a basedn of '<GUID=....>' should result in LDB_ERR_NO_SUCH_OBJECT
is the object has isDeleted=TRUE.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 9e6349f81edb3914d18bc50473d65c0c1f5bc113)

9 years agos4:dsdb/kcc: use SHOW_RECYCLED instead of SHOW_DELETED in when deleting tombstone...
Stefan Metzmacher [Mon, 7 Jul 2014 20:53:19 +0000 (22:53 +0200)]
s4:dsdb/kcc: use SHOW_RECYCLED instead of SHOW_DELETED in when deleting tombstone/deleted objects

SHOW_RECYCLED implies SHOW_DELETED.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit fa177273b87d980f81f19acb2f1a9154f8c6bfd9)

9 years agos4:dsdb/schema_load: make error message more verbose
Stefan Metzmacher [Thu, 3 Jul 2014 14:00:48 +0000 (16:00 +0200)]
s4:dsdb/schema_load: make error message more verbose

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 26fa0b97d0270456becb86d93723a3c8e5d58585)

9 years agodbcheck: Ensure dbcheck can operate with --attrs set
Andrew Bartlett [Thu, 27 Feb 2014 02:17:35 +0000 (15:17 +1300)]
dbcheck: Ensure dbcheck can operate with --attrs set

This also includes a test to ensure we do not regress on this point.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit f596dc94e1ab839f13e2a9edbcec774635b5c211)

9 years agokerberos: Remove un-used event context argument from smb_krb5_init_context()
Andrew Bartlett [Thu, 17 Apr 2014 10:35:33 +0000 (22:35 +1200)]
kerberos: Remove un-used event context argument from smb_krb5_init_context()

The event context here was only specified in the server or admin-tool
context, which does not do network communication, so this only caused
a talloc_reference() and never any useful result.

The actual network communication code sets an event context directly
before making the network call.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Apr 28 02:24:57 CEST 2014 on sn-devel-104

(cherry picked from commit 086c06e361962e1c118d8eed2316e9df7834ae8b)

9 years agodsdb: Specify no event context to smb_krb5_init_context() in dsdb
Andrew Bartlett [Thu, 17 Apr 2014 09:48:30 +0000 (21:48 +1200)]
dsdb: Specify no event context to smb_krb5_init_context() in dsdb

These routines parse principals and generate keys only, no network
communication is done.

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 7a26989d4c62f38dcafc2a688b8cbaccc6499480)

9 years agodsdb: Add DSDB_SEARCH_ONE_ONLY support to dsdb_module_search*()
Andrew Bartlett [Fri, 6 Sep 2013 03:39:50 +0000 (15:39 +1200)]
dsdb: Add DSDB_SEARCH_ONE_ONLY support to dsdb_module_search*()

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit cccc0dee04e2e3aecd82ed4cf887f9e36dd4962d)

9 years agodsdb: Do not permit nested event loops when in a transaction, use a nested event...
Andrew Bartlett [Thu, 17 Apr 2014 03:39:56 +0000 (15:39 +1200)]
dsdb: Do not permit nested event loops when in a transaction, use a nested event context

It is never safe to execute arbitary code inside a transaction - we
need to get in and get out, not run other events for the rest of the
server.

This patch avoids that by creating a private event loop during
transactions, so no unexpected operations fire, and returning the
original one when we finish it.

If an event fires during an LDB transaction, an unrelated operation
can occur during the transaction, and if the transaction were to be
cancelled, there would be a silent rollback (despite the client having
been indicated success).

Additionally, other processes could be called via IRPC that need to
operate on the database but are locked out due to the ongoing
transaction.

Andrew Bartlett

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10582
Change-Id: I22322fc006e61d7291da17cdf6431416ebb7b30f
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Tue May  6 13:36:20 CEST 2014 on sn-devel-104

(cherry picked from commit 401f555c28aee861385b75c371b5f44cded1d391)

9 years agodsdb: Rename private_data to rootdse_private_data in rootdse
Andrew Bartlett [Thu, 17 Apr 2014 03:38:14 +0000 (15:38 +1200)]
dsdb: Rename private_data to rootdse_private_data in rootdse

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

Change-Id: I349a2be67333ada86c19cd6d2ed283cd5bbeb2aa
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 543c5bf94187473271767ad782439abbfccda00d)

9 years agodsdb: Add more tests for DN+String and DN+Binary comparisons
Andrew Bartlett [Wed, 5 Feb 2014 03:22:11 +0000 (16:22 +1300)]
dsdb: Add more tests for DN+String and DN+Binary comparisons

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Feb  5 10:41:37 CET 2014 on sn-devel-104

(cherry picked from commit 741e5dca09053d0fc9a6e2a112113f1828a95759)

9 years agoselftest: Add tests for dbcheck detection and removal of partial objects
Andrew Bartlett [Thu, 3 Apr 2014 21:40:35 +0000 (10:40 +1300)]
selftest: Add tests for dbcheck detection and removal of partial objects

To avoid listing all the provision snapshots, we use a broader blacklist for waf dist
and a whitelist for dbcheck-oldrelease.sh

Andrew Bartlett

Change-Id: Iab0ff4be0b4287dc128a49302836a6f0f7b39678
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 7c2bf8d2bc5230e4bd98cc5a0f1b8f3cc56a3f77)

9 years agodsdb: Make it harder to corrupt the database by requiring DBCHECK or RELAX for final...
Andrew Bartlett [Thu, 3 Apr 2014 01:50:05 +0000 (14:50 +1300)]
dsdb: Make it harder to corrupt the database by requiring DBCHECK or RELAX for final object deletion

This kind of deletion can cause us to then replicate back a partial
object.  We allow dbcheck to directly remove totally corrupt objects
(missing an objectclass) by specifying both DBCHECK and RELAX, and the
tombstone sweep after 180 days is done with the RELAX control.

Andrew Bartlett

Change-Id: Ic21f68e507ba9b65e035ca568430e35e2d001c7d
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit b19d80d0a97faffc165f068612f74d4ef8d7e5da)

9 years agobuild: Exclude source4/selftest/provisions/release-4-1-0rc3 from the tarball
Andrew Bartlett [Mon, 3 Mar 2014 01:26:36 +0000 (14:26 +1300)]
build: Exclude source4/selftest/provisions/release-4-1-0rc3 from the tarball

Change-Id: Id4ddaabb91363174d2fbef09e823f53b13912a51
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Mar 21 10:06:04 CET 2014 on sn-devel-104

(cherry picked from commit efad13addca918e18e3df341cc38405a93028940)

9 years agodbcheck: Directly call dn.get_rdn_{val,name}() for clarity and consistency
Andrew Bartlett [Tue, 29 Apr 2014 21:38:34 +0000 (09:38 +1200)]
dbcheck: Directly call dn.get_rdn_{val,name}() for clarity and consistency

When looking for incorrect name values, this improves the previous
code by avoiding one more manual parse step, and uses less cryptic
variable names.

Andrew Bartlett

Change-Id: Iff8e571a6359a67bf173f729dc12b8787292b3cb
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
(cherry picked from commit 393348d11ed781d9f42049d5f996b0bab8b15d58)

9 years agodbchecker: verify and fix broken dn values
Stefan Metzmacher [Thu, 13 Mar 2014 22:12:39 +0000 (23:12 +0100)]
dbchecker: verify and fix broken dn values

With older Samba versions (4.0.x) the following could happen:

- On account was created on DC1
- It was replicated to DC2
- The connection between the dcs is offline
- The account gets modified on DC2
- The account gets deleted on DC1
- The connection becomes online again
- DC1 replicates the modification from DC2,
  this resets the dn to the original value.
  'name' and 'cn' are correct (with '\nDEL${GUID}'),
  but 'dn' is wrong.
- DC2 replicates the deletion from DC1.
  this doesn't include a changed dn as DC1
  had a bug.
  'name' is correct (with '\nDEL${GUID}'),
  but 'cn' and 'dn' are wrong.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10536
Change-Id: Ia70a6c12e0ff0d4c2c8100cb1d8f3c6422b65591
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 709ed040ec161e99b3c1f7076eac4a631149f64a)

9 years agodbchecker: make the deleted objects container detection more generic
Stefan Metzmacher [Thu, 13 Mar 2014 22:12:39 +0000 (23:12 +0100)]
dbchecker: make the deleted objects container detection more generic

Change-Id: I282ad887c41412e25fdf73476e405f4e88e0b239
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 821d7dc7b33598f72c4518f8975073b058df5960)

9 years agodsdb: Do not refresh the schema using the wrong event context
Andrew Bartlett [Wed, 14 May 2014 08:12:03 +0000 (20:12 +1200)]
dsdb: Do not refresh the schema using the wrong event context

What we now do is have the refresh function and module be on a
seperate object to the schema, only referring to the data and
not excuting on the original ldb and event loop.

That is, we never use another ldb context when calling the
refresh function, by binding the refresh handler to the
ldb and not the schema.

Andrew Bartlett

Change-Id: I5c323dda743cf5858badd01147fda6227599bc16
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 791c38282d681c60eaedb47803b9043991f5950d)

9 years agodsdb: Do not store a struct ldb_dn in struct schema_data
Andrew Bartlett [Fri, 23 May 2014 04:06:17 +0000 (16:06 +1200)]
dsdb: Do not store a struct ldb_dn in struct schema_data

The issue is that the DN contains a pointer to the ldb it belongs to,
and if this is not kept around long enough, we might reference memory
after it is de-allocated.

Andrew Bartlett

Change-Id: I040a6c37a3164b3309f370e32e598dd56b1a1bbb
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 8327321225251e312ccbd06bbefa5ebf98099f34)

9 years agosamba-tool dbcheck: handle missing objectClass
Felix Botner [Mon, 24 Feb 2014 13:08:25 +0000 (14:08 +0100)]
samba-tool dbcheck: handle missing objectClass

In several cases we have seen objects without the objectClass attribute.
Here the suggestion for a patch to find such objects in "samba-tool dbcheck"
with the option to delete them.

(patch improved by Andrew Bartlett to suggest DRS re-replication)

Signed-off-by: Felix Botner <botner@univention.de>
Change-Id: I8eb0d191a2089271a9af5884d6bfbf173a5c85c6
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 5b1d6e722e254522165ec512537a2efa2b979e6f)

9 years agodsdb: Improve missing objectClass handling
Andrew Bartlett [Tue, 25 Mar 2014 23:46:57 +0000 (12:46 +1300)]
dsdb: Improve missing objectClass handling

This attempts to permit deletion of objects that have no objectClass
to allow dbcheck to clean up a corrupt database.  It is not complete,
the replmd_replPropertyMetaDataCtr1_sort_and_verify() call will still
fail, but this is as much as is safe to do without a way to replicate
the original issue.

Andrew Bartlett

Change-Id: If0b6c7f18e8aee587e6b3b4af878a0145f5eac37
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 74a83be540c8fa0dd0f91da25b1f9d7ccc4ec568)

9 years agodsdb: Improve errors and checks for missing objectClass values
Andrew Bartlett [Tue, 25 Mar 2014 23:48:17 +0000 (12:48 +1300)]
dsdb: Improve errors and checks for missing objectClass values

Change-Id: I8c4ac679accc90748d20c9c86986b127c939fa75
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit df2ef57584aab81c75012ec5d878322ff0691608)

9 years agodsdb: Clarify how the DSDB_REPL_FLAG_PRIORITISE_INCOMING flag works
Andrew Bartlett [Fri, 21 Mar 2014 03:56:19 +0000 (16:56 +1300)]
dsdb: Clarify how the DSDB_REPL_FLAG_PRIORITISE_INCOMING flag works

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Change-Id: Ib9f2f4ba417dbf0ee24b6e7db02d78a9bfe8850c
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit dac1411b9ef9863152932698ce8c4e0a8cc79b1c)

9 years agodsdb: Do not update notify_uSN until the transaction is genuinely committed to the DB
Andrew Bartlett [Fri, 21 Mar 2014 03:26:48 +0000 (16:26 +1300)]
dsdb: Do not update notify_uSN until the transaction is genuinely committed to the DB

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Change-Id: I734bc75ed348de8f0a5ff92e18e08de2340b8951
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 20a665ae09eb8d5affb88fe409a6130a74bd0aad)

9 years agodsdb: Further assert that we always have an objectClass and an rDN
Andrew Bartlett [Fri, 28 Feb 2014 04:49:12 +0000 (17:49 +1300)]
dsdb: Further assert that we always have an objectClass and an rDN

We must have these two elements in a replPropertyMetaData for it to be
valid.

We may have to relax this for new partition creation, but for now we
want to find and isolate the database corruption.

The printing of the LDIF is moved above the checks to make it easier
to diagnoise the failures when further reproduced.

Based initially on a patch originally by Arvid Requate <requate@univention.de>

Andrew Bartlett

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Change-Id: I5f583d89e6d4c5e8e2d9667f336a0e8fd8347b25
Reviewed-on: https://gerrit.samba.org/164
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Mar 17 06:44:17 CET 2014 on sn-devel-104

(cherry picked from commit 9c9df40220234cba973e84b4985d90da1334a1d1)

9 years agodsdb: Ensure to sort replPropertyMetaData as UNSIGNED, not SIGNED quantities
Andrew Bartlett [Fri, 28 Feb 2014 09:59:06 +0000 (22:59 +1300)]
dsdb: Ensure to sort replPropertyMetaData as UNSIGNED, not SIGNED quantities

enum is an int, and therefore signed.  Some attributes have the high bit set.

Andrew Bartlett

Change-Id: I39a5499b7c6bbb763e15977d802cda8c69b94618
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-on: https://gerrit.samba.org/163
Reviewed-by: Kamen Mazdrashki <kamenim@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Mar 14 10:16:41 CET 2014 on sn-devel-104

(cherry picked from commit 61b978872fe86906611f64430b2608f5e7ea7ad8)

9 years agos4:samdb: respect SEARCH_FLAG_PRESERVEONDELETE
Arvid Requate [Thu, 6 Feb 2014 16:50:57 +0000 (17:50 +0100)]
s4:samdb: respect SEARCH_FLAG_PRESERVEONDELETE

According to MS-ADTS section 3.1.1.5.5.1.1 the searchFlags must be
checked.

Signed-off-by: Arvid Requate <requate@univention.de>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Thu Feb  6 21:42:22 CET 2014 on sn-devel-104

(cherry picked from commit 98c961eb82194cd0738dbc58e4ae9f81771b409e)

9 years agos4-samldb: Do not allow deletion of objects with RID < 1000
Nadezhda Ivanova [Mon, 14 Oct 2013 09:38:10 +0000 (12:38 +0300)]
s4-samldb: Do not allow deletion of objects with RID < 1000

According to [MS-SAMR] 3.1.5.7 Delete Pattern we should not allow deletion
of security objects with RID < 1000. This patch will prevent deletion of
well-known accounts and groups.

Signed-off-by: Nadezhda Ivanova <nivanova@symas.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Nadezhda Ivanova <nivanova@samba.org>
Autobuild-Date(master): Mon Oct 14 13:31:50 CEST 2013 on sn-devel-104

(cherry picked from commit 13a10d43141c29dad61868b451c0c1dca82360de)

9 years agodsdb: Use dsdb_next_callback() rather than a no-op per-module callback
Andrew Bartlett [Fri, 6 Sep 2013 03:46:36 +0000 (15:46 +1200)]
dsdb: Use dsdb_next_callback() rather than a no-op per-module callback

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 35e56d2b71b1dcd906baa70509ec50af39504b5a)

9 years agos4-dsdb: instanceType NC_HEAD is only allowed combined with WRITE for an originating...
Nadezhda Ivanova [Tue, 29 Oct 2013 16:17:27 +0000 (18:17 +0200)]
s4-dsdb: instanceType NC_HEAD is only allowed combined with WRITE for an originating add operation

As described in MS-ATDS 3.1.1.5.2.8.

Signed-off-by: Nadezhda Ivanova <nivanova@symas.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Nadezhda Ivanova <nivanova@samba.org>
Autobuild-Date(master): Sun Nov  3 16:17:30 CET 2013 on sn-devel-104

(cherry picked from commit 8a505090215501324f83dda86d146708b687abcc)

9 years agos4:dsdb/repl: make use of dcerpc_binding_handle_is_connected()
Stefan Metzmacher [Wed, 22 Jan 2014 13:14:12 +0000 (14:14 +0100)]
s4:dsdb/repl: make use of dcerpc_binding_handle_is_connected()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 0e902b83b4029320cf050a221ad41acdcdc23373)

9 years agos3:smb2_read: let smb2_sendfile_send_data() behave like send_file_readX()
Stefan Metzmacher [Thu, 10 Jul 2014 19:08:06 +0000 (21:08 +0200)]
s3:smb2_read: let smb2_sendfile_send_data() behave like send_file_readX()

We now pass the header to SMB_VFS_SENDFILE(), so we have to handle that also
in the fallback code.

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

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): Fri Jul 11 22:57:17 CEST 2014 on sn-devel-104

(cherry picked from commit 7c5ea400ad1f280f5c338c31a0a893154340fdb3)

9 years agonet/doc: make clear that net vampire is for NT4 domains only
Björn Jacke [Fri, 13 Jun 2014 12:14:41 +0000 (14:14 +0200)]
net/doc: make clear that net vampire is for NT4 domains only

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

Signed-off-by: Bjoern Jacke <bj@sernet.de>