Only do the 1 second delay for sharing violations for SMB1, not SMB2.

Match Windows behavior.

Signed-off-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 171087a499531bf529fe800de73e0e10ecdcc6f7)
Ensure we don't try and cancel anything that is in a compound-related request.

Too hard to deal with splitting off the replies.

Signed-off-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5185365c6b215905663aca5161924a357268f64d)
The core of the fix to allow opens to go async inside a compound request.

This is only allowed for opens that cause an oplock break, otherwise it
is not allowed. See [MS-SMB2].pdf note <194> on Section 3.3.5.2.7.

Signed-off-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f4900ce9e0c52beb2dcf34eaf4bcd5f398d7900c)
Remove the compound_related_in_progress state from the smb2 global state.

And also remove the restriction that we can't read a new
request whilst we're in this state.

Signed-off-by: Jeremy Allison <jra@samba.org>

The last 4 patches address bug #9722 - Samba does not properly handle Oplock
breaks in compound requests.
(cherry picked from commit 9094b538c85a550b40827799f56427a926d315cd)
Makefile: Fix bug 9868 -- Don't know how to make LIBNDR_PREG_OBJ.

Thanks to Lucs for finding the issue

Signed-off-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 16ed254d9ca66ba0e3effcb1dcb4ac71d62b7d88)
s3-docs: Remove "experimental" label on "max protocol=SMB2" parameter

Fix bug #9688 - smb.conf(5) says: "max protocol=SMB2" is experimental.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
(cherry picked from commit c5173ab356e49625da01d4f2e703f53748d7db4a)
printing: use const in is_printer_published
(cherry picked from commit c8e399b8b164e13789dcaa8801cb74f26d91f22a)
printing: explicitly clear PUBLISHED attribute

Currently nt_printer_publish(DSPRINT_UNPUBLISH) flips (via xor) the
info2->attributes PRINTER_ATTRIBUTE_PUBLISHED flag, rather than
explicitly clearing it.
(cherry picked from commit d867da670e42e3cbcf5f251a8a758f9506511086)
Fix bug 9900: is_printer_published GUID retrieval

Samba currently always responds to GetPrinter(level = 7) requests with
DSPRINT_UNPUBLISH, regardless of the AD publish status tracked via the
PRINTER_ATTRIBUTE_PUBLISHED flag. This is due to erroneous "objectGUID"
unmarshalling in is_printer_published().

This change splits "objectGUID" retrieval into a separate function, and
adds a pull_reg_sz() call to correctly unmarshall the GUID.
(cherry picked from commit 577b2e554cff29d7676ef74ace1536210503601c)
Maintain a back-pointer to the fsp in struct smb_Dir when opening with FDOPENDIR.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit e89ec641fc98ffd7f7193deb3728b0a284a093eb)
(cherry picked from commit 2683c9ba9d85ca7f341ae3b21d6e0430a4e7b8d7)
In the struct smb_Dir destructor, use the fsp back pointer to release resources.

Removes one use of dirfd().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit ea14c9443178da9ae6ccbe71e573156396f6f699)
(cherry picked from commit 93417c945e12c3d03ba5c4b1cc0b02fb8dd692e0)
Remove the "Ugly hack" that was the second use of dirfd().

The destructor does all the resource deallocation needed.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 0fe894fb89f4867e266bb04670a58101311e0234)
(cherry picked from commit 8d96eb3666ce2e0f016068dfae60eb32ed2b518e)
Remove dependency on detection of HAVE_DIRFD for use of fdopendir().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Apr 12 16:21:10 CEST 2013 on sn-devel-104
(cherry picked from commit 7a4dd845958f1411daa8031ca242987001ab2f26)
(cherry picked from commit abff441e445431970d1e25fa79e10276e576d9e3)
Fix bug #9822 - Samba crashing during Win8 sync.

When refactoring the dptr desctructor in the
fix for bug:

9778 (Samba directory code uses dirfd() without vectoring through a VFS call)

I removed the code to NULL out the struct smb_Dir *
pointer inside the fsp struct by mistake.

Re-add the NULLing out of that pointer when
closing a directory pointer associated with
an open file.

Reporter confirms it fixes the crash.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>

Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Sat Apr 27 20:44:55 CEST 2013 on sn-devel-104
(cherry picked from commit 251767cde9a146d8122d76e257ab232c05ad452a)
(cherry picked from commit fe51e23801b24af43ce605f51f3e607fae74d3b7)
BUG 9881: Check for system libtevent.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 5e6dfd1650d724c5f21b1b4324dfd44c68c3046d)
check_parent_exists() can change errno. Ensure we preserve it across calls.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>

Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Tue Apr 30 11:00:11 CEST 2013 on sn-devel-104

Fix bug #9927 - errno gets overwritten in call to check_parent_exists().
(cherry picked from commit b5243a52a237b524b7afb8125c4b75378af622d1)
When message-type is drvupgrade, MSG_DEBUG should be replaced with MSG_PRINTER_DRVUPGRADE.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>

Fix bug #9941 - Fix a bug of drvupgrade of smbcontrol.
(cherry picked from commit 242cc0b992cc627d6b1730ce089e39125ed7d300)
Bug 8997: change libreplace GPL source to LGPL

libreplace currently includes socket.c and getifaddrs.c both of which
are GPL licensed.
Although not required, talloc and tdb build alongside this source,
leading to some ambiguity regarding their LGPL licences.

The following copyright holders have agreed to the GPL->LGPL change:
lib/replace/getifaddrs.c
   Copyright (C) Andrew Tridgell 1998
   Copyright (C) Jeremy Allison 2007
   Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007

lib/replace/test/getifaddrs.c
lib/replace/socket.c
 * Copyright (C) Michael Adam <obnox@samba.org> 2008

Signed-off-by: David Disseldorp <ddiss@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>

(cherry picked from commit 8a6743e4edcdff1c7860d150720483f19f3b33bb)
(cherry picked from commit acae464f7fedd96bbddaed5227756328ea0fe32d)
WHATSNEW: Add changes since 3.6.15.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
(cherry picked from commit a1a0c53d87fea7565032e22cb59a1bb9cddd0656)
s3-autoconf: Add missing libtevent dependency.

Signed-off-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit f7588c73b9e8d95dcf3ca15067e05284dc117d3d)