samba.git
8 years agoVERSION: Disable git snapshots for the 4.1.19 release. samba-4.1.19
Karolin Seeger [Sat, 20 Jun 2015 19:43:58 +0000 (21:43 +0200)]
VERSION: Disable git snapshots for the 4.1.19 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agoWHATSNEW: Add release notes for Samba 4.1.19.
Karolin Seeger [Sat, 20 Jun 2015 19:43:20 +0000 (21:43 +0200)]
WHATSNEW: Add release notes for Samba 4.1.19.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
8 years agos3: libsmbclient: Re-resolving targetcli on every read/write/lseek/ftruncate/close...
Jeremy Allison [Thu, 28 May 2015 18:07:41 +0000 (11:07 -0700)]
s3: libsmbclient: Re-resolving targetcli on every read/write/lseek/ftruncate/close is both incorrect and slow.

Cache targetcli on file open in the SMBCFILE struct.

Bug 11295 - Excessive cli_resolve_path() usage can slow down transmission.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 9f57244bbd1ffa203a1f50bb289789628c4a3f66)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Wed Jun 10 01:20:32 CEST 2015 on sn-devel-104

8 years agonsswitch: Extend idmap_rfc2307 testcase for reverse lookup
Christof Schmitt [Fri, 5 Jun 2015 15:26:43 +0000 (08:26 -0700)]
nsswitch: Extend idmap_rfc2307 testcase for reverse lookup

Also test the codepaths to map UID and GID back to SID and names.  Use
different user and group to avoid returning results cached from the
previous lookups.

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

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 Jun  5 01:24:32 CEST 2015 on sn-devel-104
(cherry picked from commit c1c07b462058f863e706127203e6f30dba89a2a9)

8 years agoidmap_rfc2307: Fix wbinfo --gid-to-sid query
Christof Schmitt [Thu, 4 Jun 2015 19:11:27 +0000 (12:11 -0700)]
idmap_rfc2307: Fix wbinfo --gid-to-sid query

Fix syntax error in LDAP query for gidNumber.

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

Signed-off-by: Christof Schmitt <cs@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 835c278e43b9dec98834de0fb12445720e9df2e5)

8 years agos4.2/fsmo.py: fixed fsmo transfer exception
Steve Howells [Sat, 31 Jan 2015 16:09:17 +0000 (16:09 +0000)]
s4.2/fsmo.py: fixed fsmo transfer exception

In transfer_role() there is an duplicate call to samdb.modify() inside the if statement
where the type of role is being determined (specifically for the naming fsmo). This
call is unnecessary as after the if statement their is a correct call, with a try/catch
block, used by all fsmo transfers that will handle errors - such as the DC with the
fsmo role being offline.

The call to samdb.modify() inside the if statement for naming fsmo has been removed.

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

Signed-off-by: Steve Howells <steve.howells@moscowfirst.com>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Marc Muehlfeld <mmuehlfeld@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 9198246f91c02e33ed7a3580588557d0fb9f8811)

8 years agos3: IPv6 enabled DNS connections for ADS client
David Holder [Wed, 27 May 2015 16:15:51 +0000 (09:15 -0700)]
s3: IPv6 enabled DNS connections for ADS client

This patch makes DNS client connections protocol independent.
For example DNS updates. This makes IPv6-only clients possible.

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

Back-port from fff774eda3ed04d319232b108a94282af24cc6b0

Signed-off-by: David Holder <david.holder@erion.co.uk>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Tue Jun  2 01:55:28 CEST 2015 on sn-devel-104

8 years agoAdd IPv6 support for determining FQDN during ADS join.
David Holder [Wed, 27 May 2015 18:40:17 +0000 (11:40 -0700)]
Add IPv6 support for determining FQDN during ADS join.

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

Back ported from commit 6e08bfb4441022a00d0c29205e835a4858a3a57f

Signed-off-by: David Holder <david.holder@erion.co.uk>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
8 years agoAdd IPv6 support to ADS client side LDAP connects. Corrected format for IPv6 LDAP...
David Holder [Wed, 27 May 2015 18:10:52 +0000 (11:10 -0700)]
Add IPv6 support to ADS client side LDAP connects. Corrected format for IPv6 LDAP URI.

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

(Back ported from commit c324d7901c991a6700abdc3ee701920fea5e5819)

Signed-off-by: David Holder <david.holder@erion.co.uk>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
8 years agos4:torture:smb2:compound: compound read and padding
Ralph Boehme [Thu, 14 May 2015 02:27:54 +0000 (04:27 +0200)]
s4:torture:smb2:compound: compound read and padding

Add test to check that compound read responses are padded to an 8 byte
boundary.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu May 28 16:50:39 CEST 2015 on sn-devel-104

(cherry picked from commit 2ffa939bbe2c02509e1790c8b3f6f9b6910e3cf6)

8 years agos3:smb2: add padding to last command in compound requests
Ralph Boehme [Thu, 28 May 2015 07:02:17 +0000 (09:02 +0200)]
s3:smb2: add padding to last command in compound requests

Following Windows behaviour, the last command in a compound request
should be padded to an 8 byte boundary and OS X clients crash badly if
we don't pad.

[MS-SMB2] 3.3.4.1.3, "Sending Compounded Responses", doesn't make it
clear whether the padding requirement governs the last command in a
compound response, a future MS-SMB2 update will document Windwows
product behaviour in a footnote.

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

Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit dfa64b958b201931e0dbe11f153f606f20217594)

8 years agos3: smbcacls: Ensure we read a hex number as %x, not %u.
Jeremy Allison [Fri, 22 May 2015 07:24:56 +0000 (09:24 +0200)]
s3: smbcacls: Ensure we read a hex number as %x, not %u.

Based on a patch from Zoe O'Connell <zoe@metail.com>

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jim McDonough <jmcd@samba.org>
8 years agos4: libcli/finddcs_cldap: continue processing CLDAP until all addresses are used
Alexander Bokovoy [Wed, 20 May 2015 08:17:38 +0000 (11:17 +0300)]
s4: libcli/finddcs_cldap: continue processing CLDAP until all addresses are used

This is a subtle bug that causes CLDAP pings to fail if SRV records
discovered cannot be resolved or connection to them cannot be
established. The code that fires up CLDAP ping will silently cancel
the whole tevent request without going to the next server in the queue.

This may happen, for example, when connection to IPv6 addresses couldn't
be established, or when IPv4 address is not online or blocked by
firewall.

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

Signed-off-by: Alexander Bokovoy <ab@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit eb029b32e95c9e7382488f3a1b033cdbe3237c1c)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Thu May 21 17:44:11 CEST 2015 on sn-devel-104

8 years agos3:winbindd: make sure we remove pending io requests before closing client sockets
Stefan Metzmacher [Mon, 18 May 2015 11:17:40 +0000 (13:17 +0200)]
s3:winbindd: make sure we remove pending io requests before closing client sockets

This avoids a crash inside the tevent epoll backend.

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

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): Wed May 20 22:16:54 CEST 2015 on sn-devel-104

(cherry picked from commit 435ddd8223eaa6fafb62cead0399bdd042d998e8)

8 years agos4:lib/tls: fix build with gnutls 3.4
Evangelos Foutras [Mon, 13 Apr 2015 20:11:14 +0000 (23:11 +0300)]
s4:lib/tls: fix build with gnutls 3.4

gnutls_certificate_type_set_priority() was removed in GnuTLS 3.4.0. Use
gnutls_priority_set_direct instead.

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

Signed-off-by: Björn Jacke <bj@sernet.de>
Reviewed-By: Jelmer Vernooij <jelmer@samba.org>
Autobuild-User(master): Björn Jacke <bj@sernet.de>
Autobuild-Date(master): Wed Apr 29 22:29:02 CEST 2015 on sn-devel-104

(cherry picked from commit c6ad8a10c12c8a79dc83cab1591e5279edd62bd6)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Thu May 21 12:00:39 CEST 2015 on sn-devel-104

9 years agolibads: record service ticket endtime for sealed ldap connections
Uri Simchoni [Sat, 9 May 2015 19:59:17 +0000 (22:59 +0300)]
libads: record service ticket endtime for sealed ldap connections

When a ticket is obtained for binding a signed/sealed ldap connection,
its liftime should be recorded in the ads struct, in order to enable
reuse of the connection.

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

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed May 13 04:32:16 CEST 2015 on sn-devel-104

(cherry picked from commit 40eac8e4d8bc85f2329b8ed6c5ba96a141dc20a3)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Wed May 20 18:44:55 CEST 2015 on sn-devel-104

9 years agos3: smbd: VFS: fake_acl module called get_full_smb_filename() with a stream path...
Jeremy Allison [Tue, 5 May 2015 02:56:39 +0000 (19:56 -0700)]
s3: smbd: VFS: fake_acl module called get_full_smb_filename() with a stream path, then used the result to call XATTR functions directly.

Ensure when pulling XATTR values, we don't allow a stream filename.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 0f23bf228ceb38b024a77fcf2916971ad4f6aa4d)

9 years agos3: smbd: VFS: For all EA and ACL calls use synthetic_smb_fname(), not synthetic_smb_...
Jeremy Allison [Sat, 2 May 2015 04:06:20 +0000 (21:06 -0700)]
s3: smbd: VFS: For all EA and ACL calls use synthetic_smb_fname(), not synthetic_smb_fname_split().

EA's and ACL paths are all post-stream name checks (and shouldn't
get stream names). This one took a *long* time to find.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit ccb4f791fd19d9b3af79a205a15c0219ed7240ea)

9 years agos3: smbd: VFS: All the places that are currently calling vfs_stat_smb_fname() and...
Jeremy Allison [Fri, 1 May 2015 20:09:36 +0000 (13:09 -0700)]
s3: smbd: VFS: All the places that are currently calling vfs_stat_smb_fname() and vfs_lstat_smb_fname() should be calling vfs_stat_smb_basename().

They are all post-stream name processing.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 14f4e254bb8d1f456ebb8da728f2fb812a9b3034)

9 years agos3: smbd: VFS: Add vfs_stat_smb_basename() - to be called when we *know* stream name...
Jeremy Allison [Fri, 1 May 2015 19:50:51 +0000 (12:50 -0700)]
s3: smbd: VFS: Add vfs_stat_smb_basename() - to be called when we *know* stream name parsing has already been done.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 044dabfd92d09de4f168a36a07ac3232f5647a1d)

9 years agovfs_gpfs: move failure label before END_PROFILE
Ralph Boehme [Thu, 30 Apr 2015 10:29:57 +0000 (12:29 +0200)]
vfs_gpfs: move failure label before END_PROFILE

The label was added in 5e65ae14ddb74c648f31b4dfbacd4af9c02ca058 as part
of fix for bug 11244, but was wrongly placed behind END_PROFILE.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu May  7 19:22:00 CEST 2015 on sn-devel-104

(cherry picked from commit 3876e59826ad17466975ae9e9a65879c76737b2b)

9 years agovfp_gpfs: ensure END_PROFILE is always called
Ralph Boehme [Wed, 29 Apr 2015 18:48:08 +0000 (20:48 +0200)]
vfp_gpfs: ensure END_PROFILE is always called

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Thu Apr 30 19:34:41 CEST 2015 on sn-devel-104

(cherry picked from commit 5e65ae14ddb74c648f31b4dfbacd4af9c02ca058)

9 years agos3:selftest: run smb2.notify with --signing=required
Stefan Metzmacher [Fri, 1 May 2015 18:26:41 +0000 (20:26 +0200)]
s3:selftest: run smb2.notify with --signing=required

This reproduces a bug withe implicit canceled requests.

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

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

9 years agos3:smb2_sesssetup: remove unused smbd_smb2_session_setup_* destructors
Stefan Metzmacher [Sat, 2 May 2015 14:29:03 +0000 (16:29 +0200)]
s3:smb2_sesssetup: remove unused smbd_smb2_session_setup_* destructors

The cleanup of a failing session setup is now handled in
smbd_smb2_session_setup_wrap_*().

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

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

9 years agos3:smb2_sesssetup: add smbd_smb2_session_setup_wrap_send/recv()
Stefan Metzmacher [Sat, 2 May 2015 14:21:25 +0000 (16:21 +0200)]
s3:smb2_sesssetup: add smbd_smb2_session_setup_wrap_send/recv()

The wrapper calls smbXsrv_session_shutdown_send/recv() in case of an error,
this makes sure a failing reauth shuts down the session like an explicit logoff.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 50aeb6b38b14d6c26229834ece3c32eb50f9e56a)

9 years agos3:smb2_sesssetup: always assign smb2req->session when a session was created.
Stefan Metzmacher [Sat, 2 May 2015 14:27:26 +0000 (16:27 +0200)]
s3:smb2_sesssetup: always assign smb2req->session when a session was created.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8f0d4d1132b74615dc6198ab736590dec52effda)

9 years agos3:smb2_sesssetup: let smbd_smb2_logoff_* use smbXsrv_session_shutdown_*
Stefan Metzmacher [Sat, 2 May 2015 14:20:06 +0000 (16:20 +0200)]
s3:smb2_sesssetup: let smbd_smb2_logoff_* use smbXsrv_session_shutdown_*

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

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

9 years agos3:smbXsrv_session: cancel pending requests when we logoff a previous session
Stefan Metzmacher [Sat, 2 May 2015 14:13:27 +0000 (16:13 +0200)]
s3:smbXsrv_session: cancel pending requests when we logoff a previous session

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

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

9 years agos3:smbXsrv_session: add smb2srv_session_shutdown_send/recv helper functions
Stefan Metzmacher [Sat, 2 May 2015 07:57:03 +0000 (09:57 +0200)]
s3:smbXsrv_session: add smb2srv_session_shutdown_send/recv helper functions

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

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

9 years agos3:smbXsrv_session: clear smb2req->session of pending requests in smbXsrv_session_log...
Stefan Metzmacher [Sat, 2 May 2015 14:17:34 +0000 (16:17 +0200)]
s3:smbXsrv_session: clear smb2req->session of pending requests in smbXsrv_session_logoff_all_callback()

smbXsrv_session_logoff_all_callback() is called when the last transport
connection is gone, which means we won't need to sign any response...

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

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

9 years agos3:smbXsrv_session: clear smb2req->session of pending requests in smbXsrv_session_des...
Stefan Metzmacher [Sat, 2 May 2015 14:09:40 +0000 (16:09 +0200)]
s3:smbXsrv_session: clear smb2req->session of pending requests in smbXsrv_session_destructor()

This won't be needed typically needed as the caller is supposted to cancel
the requests already, but this makes sure we don't keep dangling pointers.

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

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

9 years agos4:torture/smb2: add smb2.notify.session-reconnect test
Stefan Metzmacher [Sat, 2 May 2015 07:57:03 +0000 (09:57 +0200)]
s4:torture/smb2: add smb2.notify.session-reconnect test

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit f435c89d61385272bf5b79f82f6e1373908d2b94)

9 years agos4:torture/smb2: add smb2.notify.invalid-reauth test
Stefan Metzmacher [Fri, 1 May 2015 18:20:50 +0000 (20:20 +0200)]
s4:torture/smb2: add smb2.notify.invalid-reauth test

An invalid reauth closes the session.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a8ec77e86b17213eeb6a51a835639d79e9486223)

9 years agos4:torture/smb2: add smb2.notify.close test
Stefan Metzmacher [Fri, 1 May 2015 18:20:50 +0000 (20:20 +0200)]
s4:torture/smb2: add smb2.notify.close test

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 44f9e1052de81a0a3052997e7e19a01813fbec43)

9 years agos4:torture/smb2: verify STATUS_NOTIFY_CLEANUP return value
Stefan Metzmacher [Fri, 1 May 2015 18:19:42 +0000 (20:19 +0200)]
s4:torture/smb2: verify STATUS_NOTIFY_CLEANUP return value

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 4bfa6b024e530694741c7c07171fa09762578389)

9 years agos3:smbd: use STATUS_NOTIFY_CLEANUP on smb2 logoff (explicit and implicit) and tdis
Stefan Metzmacher [Fri, 1 May 2015 18:02:38 +0000 (20:02 +0200)]
s3:smbd: use STATUS_NOTIFY_CLEANUP on smb2 logoff (explicit and implicit) and tdis

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5169e9b20c69092d04b596f48ca0e69a46af438f)

9 years agos3:smbd: use STATUS_NOTIFY_CLEANUP when closing a smb2 directory handle
Stefan Metzmacher [Fri, 1 May 2015 18:02:38 +0000 (20:02 +0200)]
s3:smbd: use STATUS_NOTIFY_CLEANUP when closing a smb2 directory handle

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a5981d137461e5715c92a4fb4cdeaa650f34e999)

9 years agos3:smbd: add a smbd_notify_cancel_by_map() helper function
Stefan Metzmacher [Fri, 1 May 2015 18:04:55 +0000 (20:04 +0200)]
s3:smbd: add a smbd_notify_cancel_by_map() helper function

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 2c47fb16089602a42f62124520e58bdcd8c7d053)

9 years agosmbd:smb2: fix error code when the header says the request is signed but we don't...
Michael Adam [Wed, 25 Sep 2013 21:18:56 +0000 (23:18 +0200)]
smbd:smb2: fix error code when the header says the request is signed but we don't have a sesseion

I.e. when the request is a session setup.
We replied with ACCESS_DENIED, but windows expects USER_SESSION_DELETED

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Wed Oct  2 22:07:44 CEST 2013 on sn-devel-104

(cherry picked from commit c3a5fecdc1ff0320f4979fa21aa636aacaac8abe)

9 years agos3:smb2_server: don't rely on the SMB2_HDR_FLAG_SIGNED if signing is required
Stefan Metzmacher [Mon, 23 Sep 2013 18:51:30 +0000 (20:51 +0200)]
s3:smb2_server: don't rely on the SMB2_HDR_FLAG_SIGNED if signing is required

Windows (at least the test suites) may skip the SMB2_HDR_FLAG_SIGNED
in a reauth session setup, but still provide a valid signature.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 4a7b792bc6d463a3aa4e1150a271ed6b929276cc)

9 years agoVERSION: Bump version up to 4.1.19...
Karolin Seeger [Mon, 11 May 2015 17:20:33 +0000 (19:20 +0200)]
VERSION: Bump version up to 4.1.19...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agoWHATSNEW: Add release notes for Samba 4.1.18. samba-4.1.18
Karolin Seeger [Tue, 5 May 2015 19:27:48 +0000 (21:27 +0200)]
WHATSNEW: Add release notes for Samba 4.1.18.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
9 years agos3: nmbd: Don't set work_changed = True inside update_server_ttl().
Jeremy Allison [Fri, 1 May 2015 16:56:59 +0000 (09:56 -0700)]
s3: nmbd: Don't set work_changed = True inside update_server_ttl().

This is taken care of inside expire_servers() when it calls
remove_server_from_workgroup().

Ensure the only functions in nmbd_serverlistdb.c that
set subnet->work_changed are:

remove_all_servers()
add_server_to_workgroup()
remove_server_from_workgroup()

Fix inspired by a change from Volker.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit c3c820a661c092de31d56c16c8cd1ec57999d2f7)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Wed May  6 22:32:36 CEST 2015 on sn-devel-104

9 years agos3: nmbd: Ensure we only set work_changed = true if we modify the record.
Jeremy Allison [Thu, 30 Apr 2015 19:05:17 +0000 (12:05 -0700)]
s3: nmbd: Ensure we only set work_changed = true if we modify the record.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit db6572ef80e20b0e577b9e9fb5d233f8bdd20713)

9 years agovfs: kernel_flock and named streams
Ralph Boehme [Wed, 29 Apr 2015 14:53:04 +0000 (16:53 +0200)]
vfs: kernel_flock and named streams

Streams implementing VFS modules may implement streams in a way that the
fsp will have the basefile open in the fsp fd, so lacking a distinct fd
for the stream, kernel_flock will apply on the basefile which is
wrong. The actual check is deffered to the VFS module implementing the
kernel_flock call.

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit d748652e5b1c1c0238a2b86cdf14d7f6de7ce9b2)

9 years agos3: smbd: Incorrect file size returned in the response of "FILE_SUPERSEDE Create"
Jeremy Allison [Tue, 28 Apr 2015 21:22:42 +0000 (14:22 -0700)]
s3: smbd: Incorrect file size returned in the response of "FILE_SUPERSEDE Create"

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

Signed-off-by: Kenny Dinh <kdinh@peaxy.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Böhme <rb@sernet.de>
(cherry picked from commit d68383e9638254d1b6805b3d3ea3e5e897908374)

9 years agos4: rpc: Refactor dcesrv_alter() function into setup and send steps.
Jeremy Allison [Fri, 24 Apr 2015 20:19:30 +0000 (13:19 -0700)]
s4: rpc: Refactor dcesrv_alter() function into setup and send steps.

Fixes bug:

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

Based on code from Julien Kerihuel <j.kerihuel@openchange.org>

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Apr 25 02:43:22 CEST 2015 on sn-devel-104

(cherry picked from commit 49030649db3dfec5a9bc03e5dde4255a14499f16)

9 years agoAdd DCERPC flag to call unbind hooks without destroying the connection itself upon...
Julien Kerihuel [Mon, 6 Apr 2015 09:26:58 +0000 (11:26 +0200)]
Add DCERPC flag to call unbind hooks without destroying the connection itself upon termination of a connection with outstanding pending calls.

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

Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 14 20:39:34 CEST 2015 on sn-devel-104

(cherry picked from commit fd90d270c7e97a639f42a96b674a674d1b51aa0d)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Tue Apr 28 04:30:13 CEST 2015 on sn-devel-104

9 years agos4:rpc_server: Add multiplex state to dcerpc flags and control over multiplex PFC...
Julien Kerihuel [Wed, 25 Mar 2015 04:06:03 +0000 (21:06 -0700)]
s4:rpc_server: Add multiplex state to dcerpc flags and control over multiplex PFC flag in bind_ack and and dcesrv_alter replies

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

Signed-off-by: Julien Kerihuel <j.kerihuel@openchange.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
(cherry picked from commit caaf89e899c2a3926fb9e54d1c86f1a9cd5d7618)

Conflicts:
source4/rpc_server/dcerpc_server.c
source4/rpc_server/dcerpc_server.h

9 years agoMake sure we initialize conn to NULL, because a routine we call may give an error...
Richard Sharpe [Thu, 23 Apr 2015 19:36:28 +0000 (12:36 -0700)]
Make sure we initialize conn to NULL, because a routine we call may give an error and not touch conn, and then we get an error when trying to TALLOC_FREE it.

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

Signed-off-by: Richard Sharpe <rsharpe@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 471744a32d37f187c87f9bfa6f860b69446b9afe)

9 years agos3:smbd: update comment to correctly reflect MS-SMB2
Ralph Boehme [Fri, 17 Apr 2015 07:12:59 +0000 (09:12 +0200)]
s3:smbd: update comment to correctly reflect MS-SMB2

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Apr 22 01:04:02 CEST 2015 on sn-devel-104

(cherry picked from commit 64b038da31c7674410ef770f9c40a5402159fb57)

9 years agos3:smbd: missing tevent_req_nterror
Ralph Boehme [Thu, 16 Apr 2015 20:28:25 +0000 (22:28 +0200)]
s3:smbd: missing tevent_req_nterror

The error code path in case fsp == NULL misses a call
tevent_req_nterror().

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

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ad52dcdf5de6f5f2c2ee156d93ebbb343f39e526)

9 years agospoolss: purge the printer name cache on name change
David Disseldorp [Tue, 31 Mar 2015 23:03:13 +0000 (01:03 +0200)]
spoolss: purge the printer name cache on name change

Currently the name cache is only cleared on printer deletion. This means
that if a printer undergoes a name change, the old name remains in the
cache and can be subsequently used incorrecly if another printer takes
the same name as the old.

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

Reported-by: Franz Pförtsch <franz.pfoertsch@brose.com>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue Apr 14 05:37:50 CEST 2015 on sn-devel-104

(cherry picked from commit a97507a9a7ba01beead6a621e1210618e93a9f9c)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Tue Apr 21 02:16:00 CEST 2015 on sn-devel-104

9 years agos3: libsmbclient: After getting attribute server, ensure main srv pointer is still...
Jeremy Allison [Tue, 31 Mar 2015 21:40:23 +0000 (14:40 -0700)]
s3: libsmbclient: After getting attribute server, ensure main srv pointer is still valid.

Bug #11186: Crash seen in libsmbclient due to free of server structure during SMBC_getxattr() call

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

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): Tue Apr 14 02:58:43 CEST 2015 on sn-devel-104

(cherry picked from commit 2d4db4a65e1e8924470741378fe249f22196eceb)

9 years agos3: Fix fsctl_validate_neg_info to pass MS compliance suite.
Jeremy Allison [Tue, 31 Mar 2015 23:20:51 +0000 (16:20 -0700)]
s3: Fix fsctl_validate_neg_info to pass MS compliance suite.

It turns out that all the client and server need to agree on is what
protocol should have been negotiated.  If they disagree, they should
disconnect.  The contents of the list of protocols used during
negotiate and during FSCTL_VALIDATE_NEGOTIATE_INFO do not need to match.

Back-port of patch 439de096ae0e1c1b8812fa202f5eba7a891d7a0a written
by Ira Cooper <ira@samba.org> and reviewed by Stefan Metzmacher <metze@samba.org>.

Fixes bug #11187 - Mac OS X 10.10.x fails Validate Negotiate Request to 4.1.x

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Wed Apr  8 23:42:50 CEST 2015 on sn-devel-104

9 years agos3: Refactor smbd_smb2_request_process_negprot
Jeremy Allison [Tue, 31 Mar 2015 23:15:59 +0000 (16:15 -0700)]
s3: Refactor smbd_smb2_request_process_negprot

Breakout smb2_protocol_dialect_match to support future work in
fsctl_validate_neg_info.

Back port of 6221937acac7017dee397d1c9846236d9fd5f613
written by Ira Cooper <ira@samba.org> and signed off
by Stefan Metzmacher <metze@samba.org>

Fixes bug #11187 - Mac OS X 10.10.x fails Validate Negotiate Request to 4.1.x

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

Signed-off-by: Jeremy Allison <jra@samba.org>
9 years agos3-passdb: Fix 'force user' with winbind default domain
Andreas Schneider [Tue, 31 Mar 2015 16:15:51 +0000 (18:15 +0200)]
s3-passdb: Fix 'force user' with winbind default domain

If we set 'winbind use default domain' and specify 'force user = user'
without a domain name we fail to log in. In this case we need to try a
lookup with the domain name.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit cd4442c7ac93e165862c9195a7c345472646aa59)

9 years agos4-process_model: Do not close random fds while forking.
Andreas Schneider [Thu, 26 Mar 2015 09:48:31 +0000 (10:48 +0100)]
s4-process_model: Do not close random fds while forking.

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

The issue has been found with nss_wrapper debug output running:
    samba4.ntvfs.cifs.krb5.base.lock

In the case here, we fork a child and close the fd without resetting
the pipe fd variable. Then the fd was used to open the nss_wrapper
hosts file which got the same fd. We forked again in the process model
called close() on the re-used fd (of the pipe variable) again without
nss_wrapper noticing.  Now Samba opened the secrets tdb and got
the same fd as nss_wrapper was using for the hosts file and next
nss_wrapper tried to parse a TDB ...

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

9 years agos3: libsmbclient: Add missing talloc stackframe.
Jeremy Allison [Thu, 26 Mar 2015 17:09:46 +0000 (10:09 -0700)]
s3: libsmbclient: Add missing talloc stackframe.

Bug 11177 - no talloc stackframe at ../source3/libsmb/clifsinfo.c:444, leaking memory

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Mar 26 22:21:30 CET 2015 on sn-devel-104

(cherry picked from commit 32cbbed979b931eeb5127629248a94d7e6f3fcfb)

9 years agos4:auth/gensec_gssapi: let gensec_gssapi_update() return NT_STATUS_LOGON_FAILURE...
Stefan Metzmacher [Fri, 13 Mar 2015 13:39:10 +0000 (14:39 +0100)]
s4:auth/gensec_gssapi: let gensec_gssapi_update() return NT_STATUS_LOGON_FAILURE for unknown errors

The 'nt_status' variable is set to NT_STATUS_OK before.

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

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

9 years agos3: client - "client use spnego principal = yes" code checks wrong name.
Jeremy Allison [Thu, 19 Mar 2015 20:10:33 +0000 (13:10 -0700)]
s3: client - "client use spnego principal = yes" code checks wrong name.

Bug 10888 - smbclient doesn't ignore "not_defined_in_RFC4178@please_ignore"

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

Code patch from <martin.wilck@ts.fujitsu.com>

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Mar 26 00:56:25 CET 2015 on sn-devel-104

(cherry picked from commit e8932b92016fc7ece3169635fbe3d98cb0caa36b)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Sat Mar 28 01:22:31 CET 2015 on sn-devel-104

9 years agodocs: Mark 'client use spnego principal' as deprecated and also a bad idea.
Jeremy Allison [Thu, 19 Mar 2015 20:09:21 +0000 (13:09 -0700)]
docs: Mark 'client use spnego principal' as deprecated and also a bad idea.

Bug 10888 - smbclient doesn't ignore "not_defined_in_RFC4178@please_ignore"

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan (metze) Metzmacher <metze@samba.org>
(cherry picked from commit c9299bd6a4e86dbec10ab7741056f331a18c44a0)

9 years agos3:winbind:grent: don't stop group enumeration when a group has no gid
Michael Adam [Mon, 19 Jan 2015 12:51:55 +0000 (13:51 +0100)]
s3:winbind:grent: don't stop group enumeration when a group has no gid

simply continue with the next group

Note: this patch introduces some code duplication to make it
easier to create minimal backport patch. Subsequent patches
will provide some refactoring to reduce the duplication.

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

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
(cherry picked from commit 24015224da1f363019d9d2da81ce533463a16abb)

9 years agos3: lib: libsmbclient: If reusing a server struct, check every cli->timout milisecond...
Jeremy Allison [Wed, 18 Mar 2015 21:15:16 +0000 (14:15 -0700)]
s3: lib: libsmbclient: If reusing a server struct, check every cli->timout miliseconds if it's still valid before use.

Uses an cli_echo() call to do so.

Based on code from <shargagan@novell.com>

Bug 11079 - libsmbclient not checking the cached connection alive status before re-using it from connection cache

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

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): Fri Mar 20 13:48:26 CET 2015 on sn-devel-104

(cherry picked from commit 4f4151ea050a5f34e42d73a4bf9448c673a35787)

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Tue Mar 24 04:50:34 CET 2015 on sn-devel-104

9 years agos3: libcli: smb1: Ensure we correctly finish a tevent req if the writev fails in...
Jeremy Allison [Thu, 19 Mar 2015 17:40:56 +0000 (10:40 -0700)]
s3: libcli: smb1: Ensure we correctly finish a tevent req if the writev fails in the SMB1 case.

We haven't added the req to the pending array yet, as SMB1 requests can
be one-way (no reply needed). So if we error out after the writev, but
before we add to the pending array we must rember to terminate our current
tevent req with a tevent_req_nterror call.

Fixes bug 11173 - SMB1 Server disconnect can cause timeout on client write error.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Fri Mar 20 05:08:25 CET 2015 on sn-devel-104

(cherry picked from commit 00d92f59257ce8fe1729becd72e13a42dfff0589)

9 years agos3: lib: ntlmssp: If NTLMSSP_NEGOTIATE_TARGET_INFO isn't set, cope with servers that...
Jeremy Allison [Mon, 9 Mar 2015 21:27:43 +0000 (14:27 -0700)]
s3: lib: ntlmssp: If NTLMSSP_NEGOTIATE_TARGET_INFO isn't set, cope with servers that don't send the 2 unused fields.

Packet traces showing such servers are found in the bug this fixes:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Thu Mar 19 12:05:56 CET 2015 on sn-devel-104

(cherry picked from commit ffe33940faa6fb762fd2483f0245448b0434be00)

9 years agos4: lib: auth: If NTLMSSP_NEGOTIATE_TARGET_INFO isn't set, cope with servers that...
Jeremy Allison [Mon, 9 Mar 2015 21:21:22 +0000 (14:21 -0700)]
s4: lib: auth: If NTLMSSP_NEGOTIATE_TARGET_INFO isn't set, cope with servers that don't send the 2 unused fields.

Packet traces showing such servers are found in the bug this fixes:

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
(cherry picked from commit 5137af570d8a173d7775754ad2e60d6d8efbe3a2)

9 years agodocs/idmap_rid: remove deprecated base_rid from example
David Disseldorp [Fri, 16 Jan 2015 15:21:24 +0000 (16:21 +0100)]
docs/idmap_rid: remove deprecated base_rid from example

The base_rid option has been deprecated for some time. Specifying a
value of 1000 (as recommended in the parameter description and example
section) can result in failed mapping of group SIDs, where RIDs do not
start at 1000.

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Mon Jan 19 09:09:22 CET 2015 on sn-devel-104

(cherry picked from commit 8466587c589f01d59294be36ad0b347f5d82a11f)

9 years agotalloc: version 2.1.2
Stefan Metzmacher [Mon, 9 Mar 2015 08:07:24 +0000 (09:07 +0100)]
talloc: version 2.1.2

Changes:
- Allow destructors to reparent the object
- Allow destructors to remove itself
- Build improvements

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

BUG: https://bugzilla.samba.org/show_bug.cgi?id=11144
Memory leak in SMB2 notify handling.

Autobuild-User(v4-1-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-1-test): Mon Mar 16 00:25:52 CET 2015 on sn-devel-104

9 years agotalloc: fix _talloc_total_limit_size prototype
Stefan Metzmacher [Tue, 27 Jan 2015 12:07:34 +0000 (13:07 +0100)]
talloc: fix _talloc_total_limit_size prototype

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
(cherry picked from commit 3929abfc6b5a3ae8a27da57d4dbee9524e3585e3)

9 years agolib: talloc: Test suite for the new destructor reparent logic.
Jeremy Allison [Wed, 4 Mar 2015 01:12:32 +0000 (17:12 -0800)]
lib: talloc: Test suite for the new destructor reparent logic.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sun Mar  8 20:52:43 CET 2015 on sn-devel-104

(cherry picked from commit 6b0cecee1b864a0589836caf9f5f2892f8cb6926)

9 years agolib: talloc: Allow destructors to reparent the object they're called on.
Jeremy Allison [Wed, 4 Mar 2015 01:02:47 +0000 (17:02 -0800)]
lib: talloc: Allow destructors to reparent the object they're called on.

If a destructor returns failure (-1) when freeing a child, talloc
must then reparent the child.

Firstly it tries the owner of any reference, next the parent of the
current object calling _talloc_free_children_internal(), and finally
the null context in the last resort.

If a destructor reparented its own object, which can be a very
desirable thing to do (a destructor can make a decision it isn't
time to die yet, and as the parent may be going away it might
want to move itself to longer-term storage) then this new parent
gets overwritten by the existing reparenting logic.

This patch checks when freeing a child if it already reparented
itself, and if it did doesn't then overwrite the new parent.

Makes destructors more flexible.

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

9 years agolib: talloc: Fix bug when calling a destructor.
Jeremy Allison [Thu, 5 Mar 2015 20:48:47 +0000 (12:48 -0800)]
lib: talloc: Fix bug when calling a destructor.

If the destructor itself calls talloc_set_destructor()
and returns -1, the new destructor set is overwritten
by talloc.

Dectect that and leave the new destructor in place.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
(cherry picked from commit 3289a5d84f73bf044e5767a6c47a3f7bf8357c08)

9 years agotalloc:build: improve detection of srcdir
Michael Adam [Fri, 20 Jun 2014 16:04:44 +0000 (18:04 +0200)]
talloc:build: improve detection of srcdir

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit cc86b4107acebf56c7bb17f59dd358615aed57b7)

9 years agotalloc: version 2.1.1
Stefan Metzmacher [Thu, 15 May 2014 12:53:49 +0000 (14:53 +0200)]
talloc: version 2.1.1

Changes:
- documentation updates
- a fix for pytalloc-util.pc
- performance improvements here and there
- fixed compiler warnings

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): Fri May 16 19:51:26 CEST 2014 on sn-devel-104

(cherry picked from commit b8e5b68de3cff8d16e4be07fdc2e780d2c3c5750)

9 years agotalloc/tests: avoid some unused variable warnings
Stefan Metzmacher [Thu, 27 Feb 2014 08:28:02 +0000 (09:28 +0100)]
talloc/tests: avoid some unused variable warnings

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 8fbb81923ddf3449b4ad1fa1a562c9fab8c74103)

9 years agotalloc: fix compiler warning
Stefan Metzmacher [Wed, 20 Nov 2013 08:58:09 +0000 (09:58 +0100)]
talloc: fix compiler warning

This avoids the following warning when using:

CFLAGS="-O3 -g -fstrict-overflow -Wstrict-overflow=5"

../talloc.c: In Funktion »talloc_is_parent«:
../talloc.c:2658:21: Warnung: assuming signed overflow does not occur when
changing X +- C1 cmp C2 to X cmp C1 +- C2 [-Wstrict-overflow]

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit de822b58476093dc43c27577d2f7074541113cc5)

9 years agotalloc: check for TALLOC_GET_TYPE_ABORT_NOOP
Stefan Metzmacher [Thu, 5 Dec 2013 07:36:13 +0000 (08:36 +0100)]
talloc: check for TALLOC_GET_TYPE_ABORT_NOOP

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit eb95fc8866dd1710b4cc2f4a4e1dc9867424def2)

9 years agotalloc: avoid a function call in TALLOC_FREE() if possible.
Stefan Metzmacher [Wed, 4 Dec 2013 14:35:37 +0000 (15:35 +0100)]
talloc: avoid a function call in TALLOC_FREE() if possible.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit b9fcfc6399eab750880ee0b9806311dd351a8ff6)

9 years agotalloc: inline talloc_get_name()
Stefan Metzmacher [Wed, 4 Dec 2013 22:22:04 +0000 (23:22 +0100)]
talloc: inline talloc_get_name()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 014eecd0b2aead3a160af0d864feddd53c85b580)

9 years agotalloc: inline more static functions
Stefan Metzmacher [Wed, 20 Nov 2013 08:57:58 +0000 (09:57 +0100)]
talloc: inline more static functions

We need the code to be as fast as possible.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 3aa35354724b88acc63f6b4439f7203d10db4e90)

9 years agotalloc: Tune talloc_vasprintf
Volker Lendecke [Fri, 10 Jan 2014 09:45:22 +0000 (10:45 +0100)]
talloc: Tune talloc_vasprintf

vsnprintf is significantly more expensive than memcpy. For the
common case where the string we print is less than a kilobyte, avoid
the second vsnprintf.

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): Thu May 15 12:49:14 CEST 2014 on sn-devel-104

(cherry picked from commit 593c8103af5a5ed6b3c915369fed5b90efb42c25)

9 years agotalloc: Update flags in pytalloc-util pkgconfig file
Lukas Slebodnik [Fri, 4 Apr 2014 11:29:39 +0000 (13:29 +0200)]
talloc: Update flags in pytalloc-util pkgconfig file

After exapnding, @LIB_RPATH@ will be -Wl,-rpatch,/usr/local/lib if rpath is
used on install. But "-Wl," will be passed to linker and should not be among
CFLAGS. Other pkgconfig files have @LIB_RPATH@ in the right place.
    @see commit 735c1cd2da15167748e92ba6de48fdb5169db587

Signed-off-by: Lukas Slebodnik <lslebodn@redhat.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Apr  4 23:50:25 CEST 2014 on sn-devel-104

(cherry picked from commit e1df75b5a965829db0c1f76673dcc824447b3ae7)

9 years agoAdd a basic guide on pytalloc.
Jelmer Vernooij [Wed, 27 Nov 2013 02:12:02 +0000 (02:12 +0000)]
Add a basic guide on pytalloc.

Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-By: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Jelmer Vernooij <jelmer@samba.org>
Autobuild-Date(master): Thu Nov 28 02:24:45 CET 2013 on sn-devel-104

(cherry picked from commit 91c1053413e1f309b2d5b215a423f37e3883aa91)

9 years agotalloc: Add a warning to talloc_reference() documentation.
Andreas Schneider [Mon, 14 Oct 2013 11:17:12 +0000 (13:17 +0200)]
talloc: Add a warning to talloc_reference() documentation.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Kai Blin <kai@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Mon Oct 14 23:05:54 CEST 2013 on sn-devel-104

(cherry picked from commit 2343df451a13115eebfd46f9247ec2ae8c3a85c0)

9 years agotalloc: Test the pooled object
Volker Lendecke [Fri, 6 Sep 2013 22:30:38 +0000 (15:30 -0700)]
talloc: Test the pooled object

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

9 years agotalloc: Add talloc_pooled_object
Volker Lendecke [Fri, 6 Sep 2013 22:15:32 +0000 (15:15 -0700)]
talloc: Add talloc_pooled_object

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

9 years agotalloc: Allow nested pools.
Volker Lendecke [Fri, 6 Sep 2013 21:52:28 +0000 (14:52 -0700)]
talloc: Allow nested pools.

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

9 years agotalloc: Add a separate pool size
Volker Lendecke [Fri, 6 Sep 2013 21:20:20 +0000 (14:20 -0700)]
talloc: Add a separate pool size

This is necessary to allow talloc pools to be objects on their own. It
is an incompatible change in the sense that talloc_get_size(pool) now
returns 0 instead of the pool size. When the talloc_pooled_object()
call is added, this will start to make sense again.

Maybe we should add a talloc_pool_size call? Or is that overkill?

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

9 years agotalloc: Put pool-specific data before the chunk
Volker Lendecke [Fri, 6 Sep 2013 21:08:43 +0000 (14:08 -0700)]
talloc: Put pool-specific data before the chunk

This is a preparation to make talloc pool real objects themselves.

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

9 years agotalloc: Introduce __talloc_with_prefix
Volker Lendecke [Fri, 6 Sep 2013 19:18:26 +0000 (12:18 -0700)]
talloc: Introduce __talloc_with_prefix

This will allow to exchange the extra talloc pool header with the
talloc_chunk structure

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

9 years agotalloc: Decouple the dual use of chunk->pool
Volker Lendecke [Fri, 6 Sep 2013 17:54:43 +0000 (10:54 -0700)]
talloc: Decouple the dual use of chunk->pool

If we want nested pools, we will have pools that are pool members. So
we will have to have a separate "next object" pointer  for pools. As
we have struct talloc_pool_chunk now, this additional pointer does not
affect normal talloc objects.

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

9 years agoFix valgrind errors with memmove and talloc pools.
Jeremy Allison [Tue, 27 Aug 2013 20:20:43 +0000 (13:20 -0700)]
Fix valgrind errors with memmove and talloc pools.

bin/smbtorture //127.0.0.1 local.talloc now runs with no valgrind errors.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: "Stefan (metze) Metzmacher" <metze@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Aug 28 02:44:17 CEST 2013 on sn-devel-104

(cherry picked from commit 617c647b8ef562ace589a11a15eb460e6db71f2a)

9 years agoAdd simple limited pool tests to test_memlimit().
Jeremy Allison [Tue, 27 Aug 2013 20:09:03 +0000 (13:09 -0700)]
Add simple limited pool tests to test_memlimit().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit cbfc3efbfd4a3a6f3b031ce8ef375d37f2c545f3)

9 years agoRemove talloc_memlimit_update(). No longer used.
Jeremy Allison [Tue, 27 Aug 2013 20:08:33 +0000 (13:08 -0700)]
Remove talloc_memlimit_update(). No longer used.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 3d0f717d437bb24f430fad788b9eb35e8fe8e0e8)

9 years agoInside _talloc_realloc(), keep track of size changes over malloc/realloc/free.
Jeremy Allison [Tue, 27 Aug 2013 20:07:04 +0000 (13:07 -0700)]
Inside _talloc_realloc(), keep track of size changes over malloc/realloc/free.

Replace the last use of talloc_memlimit_update() with talloc_memlimit_grow()/
talloc_memlimit_shrink().

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 8e2a543e088cac36a5b6bbab1a6be961fa00cc4d)

9 years agoDon't call talloc_memlimit_update() inside _talloc_realloc() when we're just manipula...
Jeremy Allison [Tue, 27 Aug 2013 20:03:27 +0000 (13:03 -0700)]
Don't call talloc_memlimit_update() inside _talloc_realloc() when we're just manipulating pool members.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 314508dd73105138d756f4ca3dfb65f1d368a9f7)

9 years agoFix a conditional check. (size - tc->size > 0) is always true if size and tc->size...
Jeremy Allison [Tue, 27 Aug 2013 19:59:04 +0000 (12:59 -0700)]
Fix a conditional check. (size - tc->size > 0) is always true if size and tc->size are unsigned.

Replace with (size > tc->size).

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 0fbcfcc824e474874c15d7c0b2ea0df408448906)

9 years agoIn _talloc_steal_internal(), correctly decrement the memory limit in the source,...
Jeremy Allison [Tue, 27 Aug 2013 19:57:43 +0000 (12:57 -0700)]
In _talloc_steal_internal(), correctly decrement the memory limit in the source, and increment in the destination.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 43860293225d14ca2c339277b42f8705322463ab)

9 years agoInside _talloc_free_internal(), always call talloc_memlimit_update_on_free() before...
Jeremy Allison [Tue, 27 Aug 2013 19:54:38 +0000 (12:54 -0700)]
Inside _talloc_free_internal(), always call talloc_memlimit_update_on_free() before we free the real memory.

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Simo Sorce <idra@samba.org>
(cherry picked from commit 6bc190d6dd7fd0ab028c39c1463477a863f6943a)