samba.git
10 years agos3:smbd: use sconn->smb1.sessions.max_send = SMB_BUFFER_SIZE_MAX
Stefan Metzmacher [Fri, 6 Dec 2013 12:50:49 +0000 (13:50 +0100)]
s3:smbd: use sconn->smb1.sessions.max_send = SMB_BUFFER_SIZE_MAX

SMB_BUFFER_SIZE_MAX is UINT16_MAX and the largest value a client
can possibly specify in the session setup request.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10422
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5cd5c1613996ecebdcd632e932957947f4c27308)

10 years agos3:smbd: use SMB_BUFFER_SIZE_MIN/MAX to limit lp_max_xmit()
Stefan Metzmacher [Fri, 6 Dec 2013 12:45:35 +0000 (13:45 +0100)]
s3:smbd: use SMB_BUFFER_SIZE_MIN/MAX to limit lp_max_xmit()

The current limit of 128*1024 causes problems as the value has to be
<= UINT16_MAX otherwise some clients get confused, as they want to
use the MaxBufferSize value from the negprot response (uint32_t)
for the MaxBufferSize value in thet session setup request (uint16_t).
E.g. Windows 7 (as client) sends MaxBufferSize = 0 if the server value
is > UINT16_MAX.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10422
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit a349b0bef9085fd139640ec92399bc63d8029cb9)

10 years agos3:include: let CLI_BUFFER_SIZE be an alias of SMB_BUFFER_SIZE_MAX
Stefan Metzmacher [Fri, 6 Dec 2013 12:57:15 +0000 (13:57 +0100)]
s3:include: let CLI_BUFFER_SIZE be an alias of SMB_BUFFER_SIZE_MAX

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10422
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 7f3faa1f1837870195352253fe220e0677565d9e)

10 years agolibcli/smb: add SMB_BUFFER_SIZE_MIN/MAX defines
Stefan Metzmacher [Fri, 6 Dec 2013 12:28:35 +0000 (13:28 +0100)]
libcli/smb: add SMB_BUFFER_SIZE_MIN/MAX defines

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10422
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 900839e2216048a614f2f0aeb1f79092fc93334f)

10 years agos3:param: avoid using BUFFER_SIZE to limit the lp_min_receive_file_size()
Stefan Metzmacher [Wed, 19 Feb 2014 12:59:07 +0000 (13:59 +0100)]
s3:param: avoid using BUFFER_SIZE to limit the lp_min_receive_file_size()

There's really no reason to add such limit.

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

10 years agos3:client: only limit the buffer by the given length 'n'
Stefan Metzmacher [Wed, 19 Feb 2014 12:57:28 +0000 (13:57 +0100)]
s3:client: only limit the buffer by the given length 'n'

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

10 years agos3:torture: use CLI_BUFFER_SIZE instead of BUFFER_SIZE
Stefan Metzmacher [Wed, 19 Feb 2014 12:56:06 +0000 (13:56 +0100)]
s3:torture: use CLI_BUFFER_SIZE instead of BUFFER_SIZE

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

10 years agos3:utils/smbfilter: use a local variable for the packet buffer
Stefan Metzmacher [Wed, 19 Feb 2014 12:54:44 +0000 (13:54 +0100)]
s3:utils/smbfilter: use a local variable for the packet buffer

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

10 years agos3:smbd: avoid invalid lock_order panic triggered by "CTDB_SRVID_RELEASE_IP"
Stefan Metzmacher [Thu, 13 Feb 2014 14:36:27 +0000 (15:36 +0100)]
s3:smbd: avoid invalid lock_order panic triggered by "CTDB_SRVID_RELEASE_IP"

If smbd_server_connection_terminate("CTDB_SRVID_RELEASE_IP") is triggered from
within ctdbd_migrate(), we got a smb_panic complaining about invalid
lock_order, as ctdbd_migrate is called from dbwrap_fetch_locked().

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10444
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 Feb 21 14:51:51 CET 2014 on sn-devel-104
(cherry picked from commit 33f10d06baf44e31d558bc5bd926c886915322cc)

10 years agos3:lib/ctdbd_conn: let release_ip_handler return bool
Stefan Metzmacher [Mon, 17 Feb 2014 10:57:52 +0000 (11:57 +0100)]
s3:lib/ctdbd_conn: let release_ip_handler return bool

If it returns true the passed ip address matched and we
let a nested ctdb operation fail with NT_STATUS_ADDRESS_CLOSED.

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

10 years agos3:smbd: maintain smbd_server_connection->status
Stefan Metzmacher [Mon, 17 Feb 2014 11:01:12 +0000 (12:01 +0100)]
s3:smbd: maintain smbd_server_connection->status

If this isn't NT_STATUS_OK, we skip any io on the socket.

This avoids possible problems during shutdown.

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

10 years agos3:smbd: simplify exit_server_common()
Stefan Metzmacher [Mon, 17 Feb 2014 11:05:42 +0000 (12:05 +0100)]
s3:smbd: simplify exit_server_common()

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

10 years agos3:smbd: s/EVENT_FD/TEVENT_FD
Stefan Metzmacher [Mon, 18 Feb 2013 09:18:57 +0000 (10:18 +0100)]
s3:smbd: s/EVENT_FD/TEVENT_FD

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

10 years agodoc: add "spoolss: architecture" parameter usage
David Disseldorp [Mon, 14 Oct 2013 10:01:58 +0000 (12:01 +0200)]
doc: add "spoolss: architecture" parameter usage

Windows spoolss print clients only allow association of server-side
drivers with printers when the driver architecture matches the
advertised print server architecture. Samba's spoolss print server
architecture can be changed using this parameter.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Wed Oct 16 17:12:34 CEST 2013 on sn-devel-104

(cherry picked from commit b92937e64ed7ce3c7cdd4da0e263c7a53da45c49)

Fix bug #10188 - spoolss: architecture is undocumented.

10 years agos4: smbtorture: Add a proper change_notify going async followed by tdis test.
Jeremy Allison [Mon, 24 Feb 2014 18:44:59 +0000 (10:44 -0800)]
s4: smbtorture: Add a proper change_notify going async followed by tdis test.

[Bug 10344] SessionLogoff on a signed connection with an outstanding notify request crashes smbd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Mar 12 20:12:58 CET 2014 on sn-devel-104

(cherry picked from commit 9c677fff0bb0abc8d19dd67c33b3e044b1a9862e)

10 years agos4: smbtorture: Update the torture_smb2_notify_ulogoff test to demonstrate the problem.
Jeremy Allison [Tue, 28 Jan 2014 22:07:26 +0000 (14:07 -0800)]
s4: smbtorture: Update the torture_smb2_notify_ulogoff test to demonstrate the problem.

[Bug 10344] SessionLogoff on a signed connection with an outstanding notify request crashes smbd.

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

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

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

10 years agos3:smb2_tcon: cancel and wait for pending requests on tdis
Stefan Metzmacher [Mon, 10 Mar 2014 08:53:18 +0000 (09:53 +0100)]
s3:smb2_tcon: cancel and wait for pending requests on tdis

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10344
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 95f96a81083be578ee638c0cebd590228d9a4424)

10 years agos3:smb2_sesssetup: cancel and wait for pending requests on logoff
Stefan Metzmacher [Mon, 10 Mar 2014 08:53:18 +0000 (09:53 +0100)]
s3:smb2_sesssetup: cancel and wait for pending requests on logoff

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

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

10 years agos3:smb2_tcon: split smbd_smb2_tdis into an async *_send/recv pair.
Jeremy Allison [Mon, 10 Mar 2014 08:53:18 +0000 (09:53 +0100)]
s3:smb2_tcon: split smbd_smb2_tdis into an async *_send/recv pair.

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

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 195c2d84807a7580e90e288cc813a6c6ca596055)
Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agos3:smb2_sesssetup: split smbd_smb2_logoff into an async *_send/recv pair.
Jeremy Allison [Mon, 10 Mar 2014 08:53:18 +0000 (09:53 +0100)]
s3:smb2_sesssetup: split smbd_smb2_logoff into an async *_send/recv pair.

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

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit 506817dfc9d18c2c5c35d60a6e61a82917665e2d)
Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agos3:smb2_lock: return RANGE_NOT_LOCKED instead of CANCELLED for logoff and tdis
Stefan Metzmacher [Mon, 10 Mar 2014 08:47:11 +0000 (09:47 +0100)]
s3:smb2_lock: return RANGE_NOT_LOCKED instead of CANCELLED for logoff and tdis

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

10 years agos3:smb2_lock: fix whitespaces/tabs in smbd_smb2_lock_cancel()
Stefan Metzmacher [Mon, 10 Mar 2014 08:43:35 +0000 (09:43 +0100)]
s3:smb2_lock: fix whitespaces/tabs in smbd_smb2_lock_cancel()

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

10 years agos4:torture/smb2: accept NT_STATUS_RANGE_NOT_LOCKED after smb2_logoff/tdis
Stefan Metzmacher [Fri, 7 Mar 2014 11:31:19 +0000 (12:31 +0100)]
s4:torture/smb2: accept NT_STATUS_RANGE_NOT_LOCKED after smb2_logoff/tdis

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

10 years agos3: lib: Back-port tevent_queue_wait_send/recv -> smbd_tevent_queue_wait_send/recv
Jeremy Allison [Thu, 13 Mar 2014 17:06:48 +0000 (10:06 -0700)]
s3: lib: Back-port tevent_queue_wait_send/recv -> smbd_tevent_queue_wait_send/recv

Required for bugfix:

[Bug 10344] SessionLogoff on a signed connection with an outstanding notify request crashes smbd.

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

Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agotevent: fix crash bug in tevent_queue_immediate_trigger()
Stefan Metzmacher [Sat, 11 Jan 2014 07:58:05 +0000 (08:58 +0100)]
tevent: fix crash bug in tevent_queue_immediate_trigger()

Assume we we have a queue with 2 entries (A and B with triggerA() and triggerB()).
If triggerA() removes itself tevent_queue_entry_destructor() will be called
for A, this schedules the immediate event to call triggerB().
If triggerA() then also removes B by an explicit of implizit talloc_free(),
q->list is NULL, but the immediate event is still scheduled and can't be unscheduled.

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

10 years agoMerge tag 'samba-4.0.16' into v4-0-test
Stefan Metzmacher [Tue, 11 Mar 2014 19:55:57 +0000 (20:55 +0100)]
Merge tag 'samba-4.0.16' into v4-0-test

Signed-off-by: Stefan Metzmacher <metze@samba.org>
10 years agoVERSION: Bump version number up to 4.0.17.
Karolin Seeger [Tue, 11 Mar 2014 18:31:59 +0000 (19:31 +0100)]
VERSION: Bump version number up to 4.0.17.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoVERSION: Disable git snapshots for the 4.0.16 release.
Karolin Seeger [Tue, 11 Mar 2014 11:00:52 +0000 (12:00 +0100)]
VERSION: Disable git snapshots for the 4.0.16 release.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10245
CVE-2013-4496: Enforce password lockout for SAMR password
changes.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10327
CVE-2013-6442: ensure we don't lose an existing ACL when
setting owner or group owner.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoWHATSNEW: Add release notes for Samba 4.0.16.
Karolin Seeger [Tue, 11 Mar 2014 10:42:21 +0000 (11:42 +0100)]
WHATSNEW: Add release notes for Samba 4.0.16.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10245
CVE-2013-4496: Password lockout not enforced for SAMR password
changes.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10327
CVE-2013-6442: smbcacls --chown | --chgrp dacl regression

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoCVE-2013-6442: s3:smbcacls - ensure we don't lose an existing ACL when setting owner...
Jeremy Allison [Wed, 18 Dec 2013 21:56:18 +0000 (13:56 -0800)]
CVE-2013-6442: s3:smbcacls - ensure we don't lose an existing ACL when setting owner or group owner.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10327
Bug 10327 - CVE-2013-6442: smbcacls --chown | --chgrp dacl regression

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4496:Revert remainder of ce895609b04380bfc41e4f8fddc84bd2f9324340
Andrew Bartlett [Wed, 27 Nov 2013 17:50:01 +0000 (06:50 +1300)]
CVE-2013-4496:Revert remainder of ce895609b04380bfc41e4f8fddc84bd2f9324340

Part of this was removed when ChangePasswordUser was unimplemented,
but remove the remainder of this flawed commit.  Fully check the
password first, as extract_pw_from_buffer() already does a partial
check of the password because it needs a correct old password to
correctly decrypt the length.

Andrew Bartlett

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4496:samr: Remove ChangePasswordUser
Andrew Bartlett [Tue, 5 Nov 2013 03:16:46 +0000 (16:16 +1300)]
CVE-2013-4496:samr: Remove ChangePasswordUser

This old password change mechanism does not provide the plaintext to
validate against password complexity, and it is not used by modern
clients.

The missing features in both implementations (by design) were:

 - the password complexity checks (no plaintext)
 - the minimum password length (no plaintext)

Additionally, the source3 version did not check:

 - the minimum password age
 - pdb_get_pass_can_change() which checks the security
   descriptor for the 'user cannot change password' setting.
 - the password history
 - the output of the 'passwd program' if 'unix passwd sync = yes'.

Finally, the mechanism was almost useless, as it was incorrectly
only made available to administrative users with permission
to reset the password.  It is removed here so that it is not
mistakenly reinstated in the future.

Andrew Bartlett

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4496:s3:auth: fix memory leak in the ACCOUNT_LOCKED_OUT case.
Stefan Metzmacher [Tue, 5 Nov 2013 13:04:20 +0000 (14:04 +0100)]
CVE-2013-4496:s3:auth: fix memory leak in the ACCOUNT_LOCKED_OUT case.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agoCVE-2013-4496:s3-samr: Block attempts to crack passwords via repeated password changes
Andrew Bartlett [Fri, 1 Nov 2013 01:55:44 +0000 (14:55 +1300)]
CVE-2013-4496:s3-samr: Block attempts to crack passwords via repeated password changes

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agoVERSION: Disable git snapshots for the 4.0.16 release. samba-4.0.16
Karolin Seeger [Tue, 11 Mar 2014 11:00:52 +0000 (12:00 +0100)]
VERSION: Disable git snapshots for the 4.0.16 release.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10245
CVE-2013-4496: Enforce password lockout for SAMR password
changes.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10327
CVE-2013-6442: ensure we don't lose an existing ACL when
setting owner or group owner.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoWHATSNEW: Add release notes for Samba 4.0.16.
Karolin Seeger [Tue, 11 Mar 2014 10:42:21 +0000 (11:42 +0100)]
WHATSNEW: Add release notes for Samba 4.0.16.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10245
CVE-2013-4496: Password lockout not enforced for SAMR password
changes.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10327
CVE-2013-6442: smbcacls --chown | --chgrp dacl regression

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoCVE-2013-6442: s3:smbcacls - ensure we don't lose an existing ACL when setting owner...
Jeremy Allison [Wed, 18 Dec 2013 21:56:18 +0000 (13:56 -0800)]
CVE-2013-6442: s3:smbcacls - ensure we don't lose an existing ACL when setting owner or group owner.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10327
Bug 10327 - CVE-2013-6442: smbcacls --chown | --chgrp dacl regression

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4496:Revert remainder of ce895609b04380bfc41e4f8fddc84bd2f9324340
Andrew Bartlett [Wed, 27 Nov 2013 17:50:01 +0000 (06:50 +1300)]
CVE-2013-4496:Revert remainder of ce895609b04380bfc41e4f8fddc84bd2f9324340

Part of this was removed when ChangePasswordUser was unimplemented,
but remove the remainder of this flawed commit.  Fully check the
password first, as extract_pw_from_buffer() already does a partial
check of the password because it needs a correct old password to
correctly decrypt the length.

Andrew Bartlett

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4496:samr: Remove ChangePasswordUser
Andrew Bartlett [Tue, 5 Nov 2013 03:16:46 +0000 (16:16 +1300)]
CVE-2013-4496:samr: Remove ChangePasswordUser

This old password change mechanism does not provide the plaintext to
validate against password complexity, and it is not used by modern
clients.

The missing features in both implementations (by design) were:

 - the password complexity checks (no plaintext)
 - the minimum password length (no plaintext)

Additionally, the source3 version did not check:

 - the minimum password age
 - pdb_get_pass_can_change() which checks the security
   descriptor for the 'user cannot change password' setting.
 - the password history
 - the output of the 'passwd program' if 'unix passwd sync = yes'.

Finally, the mechanism was almost useless, as it was incorrectly
only made available to administrative users with permission
to reset the password.  It is removed here so that it is not
mistakenly reinstated in the future.

Andrew Bartlett

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
10 years agoCVE-2013-4496:s3:auth: fix memory leak in the ACCOUNT_LOCKED_OUT case.
Stefan Metzmacher [Tue, 5 Nov 2013 13:04:20 +0000 (14:04 +0100)]
CVE-2013-4496:s3:auth: fix memory leak in the ACCOUNT_LOCKED_OUT case.

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agoCVE-2013-4496:s3-samr: Block attempts to crack passwords via repeated password changes
Andrew Bartlett [Fri, 1 Nov 2013 01:55:44 +0000 (14:55 +1300)]
CVE-2013-4496:s3-samr: Block attempts to crack passwords via repeated password changes

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

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
10 years agoVERSION: Bump version number up to 4.0.16...
Karolin Seeger [Sun, 16 Feb 2014 20:01:42 +0000 (21:01 +0100)]
VERSION: Bump version number up to 4.0.16...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
(cherry picked from commit 20d7ec8a7b1d39f5a93e58d22720d0a333079254)

10 years agos3-spoolssd: Don't register spoolssd if epmd is not running.
Andreas Schneider [Thu, 27 Feb 2014 08:58:27 +0000 (09:58 +0100)]
s3-spoolssd: Don't register spoolssd if epmd is not running.

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

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
(cherry picked from commit 562ade624a78a11a5af0f26b04df93d76d6166bd)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Mon Mar 10 18:37:25 CET 2014 on sn-devel-104

10 years agos3:winbindd: avoid directly asking a trusted domain in wb_lookupsids*()
Gregor Beck [Thu, 20 Feb 2014 10:25:53 +0000 (11:25 +0100)]
s3:winbindd: avoid directly asking a trusted domain in wb_lookupsids*()

As a domain member we should always use a DC of our own domain.

It would be possible to pass all sids in one single dcerpc_wbint_LookupSids()
call. For now we just fix bug.

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

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10458
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 66fb0ce9557553a4c01607b517e65ac4c93841d0)

10 years agos3:winbindd: fix _wbint_LookupSids() on error
Gregor Beck [Thu, 20 Feb 2014 12:14:31 +0000 (13:14 +0100)]
s3:winbindd: fix _wbint_LookupSids() on error

We need to make sure that r->out.domains remains valid,
otherwise we're not able to marshall the response.

Note that wbint_LookupSids() has [out,ref] lsa_RefDomainList *domains,
while lsa_LookupSids() has [out,ref] lsa_RefDomainList **domains.

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

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10458
Signed-off-by: Gregor Beck <gbeck@sernet.de>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 3413e64149702136429d7b5acaa7a52c49abf564)

10 years agopidl:NDR/Client: fix dcerpc_function() with [out,ref] pointers
Stefan Metzmacher [Wed, 25 Sep 2013 23:20:10 +0000 (01:20 +0200)]
pidl:NDR/Client: fix dcerpc_function() with [out,ref] pointers

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit f50b561336c7b6c08300e6e477859d1f9fab62c2)

10 years agos3: smbd: Ensure brl_get_locks_internal() always returns a valid struct byte_range_lo...
Jeremy Allison [Fri, 28 Feb 2014 00:19:53 +0000 (16:19 -0800)]
s3: smbd: Ensure brl_get_locks_internal() always returns a valid struct byte_range_lock even if there are no locks.

brl_get_locks_internal() currently returns NULL when it can't
find any byte range locks on the file. This is an error - it
should return a valid struct byte_range_lock containing num_locks == 0
so it can be cached.

Returning NULL when there are no locks causes POSIX lock
tests to fail returning NT_STATUS_NO_MEMORY (as it thinks
it can't allocate the struct) instead of NT_STATUS_OK.

This is a back-port of git commit abf08ed544ce05ea5a6e6ea2e531b6a2d97e15cc
that went into master.

Fixes bug:

Bug 10431 - STATUS_NO_MEMORY response from Query File Posix Lock request

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

Signed-off-by: Jeremy Allison <jra@samba.org>
10 years agos3-printing: Fix obvious memory leak in printer_list_get_printer().
Jeremy Allison [Tue, 25 Feb 2014 00:18:31 +0000 (16:18 -0800)]
s3-printing: Fix obvious memory leak in printer_list_get_printer().

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ira Cooper <ira@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Tue Feb 25 13:19:37 CET 2014 on sn-devel-104

(cherry picked from commit 148bbdd8d04400b5d873f636671dd443952ca04f)

10 years agorpc_client: retry open on STATUS_PIPE_NOT_AVAILABLE
David Disseldorp [Mon, 3 Mar 2014 18:49:35 +0000 (19:49 +0100)]
rpc_client: retry open on STATUS_PIPE_NOT_AVAILABLE

Windows Server starts some named pipe services on demand, and responds
to initial open requests with STATUS_PIPE_NOT_AVAILABLE. The FssagentRpc
named pipe on Windows Server 2012 exhibits this behaviour.

This change sees rpcclient retry named pipe open requests when the
server responds with STATUS_PIPE_NOT_AVAILABLE. The retry logic is
contained in an asynchronous tevent_timer callback, to allow for
non-blocking callers.

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit ebe6627c1f0e6b488a0c456860a055fd5701e84d)
[ddiss@samba.org: rebasead for 4.1 without 46d29d46bc065d51e3f7ca6892]

Bug: https://bugzilla.samba.org/show_bug.cgi?id=10484
Initial FSRVP rpcclient requests fail with NT_STATUS_PIPE_NOT_AVAILABLE

10 years agos3: ldap client can return NT_STATUS_OK when an error occurs in a paged search.
Daniel Liberman [Wed, 22 Jan 2014 00:25:41 +0000 (16:25 -0800)]
s3: ldap client can return NT_STATUS_OK when an error occurs in a paged search.

"Inside ads_do_search_all_args(), if the first call to ads_do_paged_search_args()
fails, the proper error status is returned.

But, if the execution is already inside the loop to get all the accounts doing
several calls to ads_do_paged_search_args(), and one of these calls times out,
the status returned is from the *first* call, so success. This causes
net_ads_search() to interpret the return from ads_do_search_retry() as
success and print all the accounts returned, but it’s only a subset."

Also ensure we free previously returned results on error
in subsequent fetches.

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

Signed-off-by: Daniel Liberman <danielvl@gmail.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Richard Sharpe <realrichardsharpe@gmail.com>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Jan 23 01:40:54 CET 2014 on sn-devel-104

(cherry picked from commit b04e8b7557b82a4b96cf74db04742fb017edb3ba)

10 years agowaf: improve iconv checks
Christian Ambach [Wed, 4 Dec 2013 21:50:11 +0000 (22:50 +0100)]
waf: improve iconv checks

there are broken iconv implementations around (e.g. on AIX) that you
can compile against but that refuse any mapping requests

make sure we do the same as the autoconf-based build did and
fall back to our own code

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 15b2d1a658b3fc428c20a7a461168f464951f40f)
(cherry picked from commit f5cbfd6ce5e5a0977e5c1a53046ee883b3431246)

10 years agoheimdal_build: only enable libintl functions if everything was found
Christian Ambach [Wed, 19 Feb 2014 21:17:01 +0000 (22:17 +0100)]
heimdal_build: only enable libintl functions if everything was found

do not rely on intl.h being available but also on the functions being usable
This should fix the build on HP-UX

Bug: https://bugzilla.samba.org/show_bug.cgi?id=9911
Signed-off-by: Christian Ambach <ambi@samba.org>
Change-Id: I5dd88d2d5216b778624778455cca99b32d0be58f
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 20 01:28:24 CET 2014 on sn-devel-104

(cherry picked from commit 8f0d06fa5e654f647664727db6f12901579ec2c7)

10 years agowaf:lib/replace fix iconv checks on HP/UX
Christian Ambach [Wed, 29 Jan 2014 19:48:38 +0000 (20:48 +0100)]
waf:lib/replace fix iconv checks on HP/UX

we need to copy away the list of LDFLAGS
to be tried before modifying it instead of
just creating a new reference and then continuing
with a modified list while it should have been
reset back to the original value

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Thu Feb 13 02:01:03 CET 2014 on sn-devel-104

(cherry picked from commit 6a7c420a79cc1258528f152f4de9a0608767729f)

10 years agowaf:lib/replace gettext configure checks
Christian Ambach [Thu, 25 Jul 2013 17:41:02 +0000 (19:41 +0200)]
waf:lib/replace gettext configure checks

Make sure we only try to work with gettext if we found
the prototypes and were able to link

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Christian Ambach <ambi@samba.org>
Autobuild-Date(master): Fri Jan 17 19:30:33 CET 2014 on sn-devel-104

(cherry picked from commit da891e2101c568d2f0b9a2bda78702826ea68f3c)

10 years agowaf:lib/replace fix gettext detection
Christian Ambach [Thu, 12 Dec 2013 21:10:36 +0000 (22:10 +0100)]
waf:lib/replace fix gettext detection

if the user has specified a path for gettext, add it to CFLAGS and LDFLAGS
so we can find it during configure and build

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 31db0c8acdd68f396417e1f6504a91a40295bc89)

10 years agowaf:lib/replace change detection of gettext
Christian Ambach [Thu, 12 Dec 2013 21:12:07 +0000 (22:12 +0100)]
waf:lib/replace change detection of gettext

convert this to an automatic check: if no option is given, try to find gettext
and if found, use it
if user has specified --with-gettext, then bail out if it could not be found
in case of --without-gettext, skip all gettext related configure checks

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit a83f491810d34cc8b6eb4b0f40bbbb1440e0f84d)

10 years agowaf:lib/replace fix up libintl related checks
Christian Ambach [Thu, 2 Jan 2014 21:23:16 +0000 (22:23 +0100)]
waf:lib/replace fix up libintl related checks

on a default installation of AIX, libintl.a exists but
libintl.h does not
So check for the declarations of those functions as well
to make sure that the build works.

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit df6ddcfbfcd33274c1b768ce26829b0ad9278cd0)

10 years agowaf:lib/replace correct detection of libiconv
Christian Ambach [Thu, 2 Jan 2014 22:28:20 +0000 (23:28 +0100)]
waf:lib/replace correct detection of libiconv

add -liconv as a complete command line argument,
not all characters on their own

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

Signed-off-by: Christian Ambach <ambi@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 1a42ff7d8db63b26e2beb43268a1c4664723358e)

10 years agos3: printing: Fix problem with server taking too long to respond to a MSG_PRINTER_DRV...
Jeremy Allison [Wed, 12 Feb 2014 18:13:19 +0000 (10:13 -0800)]
s3: printing: Fix problem with server taking too long to respond to a MSG_PRINTER_DRVUPGRADE message.

Receiving a MSG_PRINTER_DRVUPGRADE causes
smbd to iterate over all printers looking
for ones that uses the driver. This is a very
expensive operation requiring a read of all
registry printer parameters.

On a system with a large number of printers,
this causes the clients to timeout (smbd
can take longer than 60 seconds to respond).

This patch fixes the problem by forwarding
the MSG_PRINTER_DRVUPGRADE to the background
lpq queue updater process and allowing it to
take care of the updating of the changeid
in the registry, allowing the smbd connected
to the client to return to processing requests
immediately.

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

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): Tue Feb 18 17:48:30 CET 2014 on sn-devel-104

(cherry picked from commit cd655715b8ee0a4e681d67b3996f71017b941401)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Sun Feb 23 04:57:30 CET 2014 on sn-devel-104

10 years agolibrpc/nbt: increase MAX_COMPONENTS limit for nbt_names.
Günther Deschner [Tue, 4 Feb 2014 15:38:46 +0000 (16:38 +0100)]
librpc/nbt: increase MAX_COMPONENTS limit for nbt_names.

domains with more then 10 subdomains are not so uncommon.

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

Guenther

Signed-off-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Günther Deschner <gd@samba.org>
Autobuild-Date(master): Thu Feb 13 16:30:50 CET 2014 on sn-devel-104

(cherry picked from commit 4e05bad0d18e351cb2a2db74860e77adea727c79)
Signed-off-by: Andreas Schneider <asn@samba.org>
10 years agodfs: always call create_conn_struct with root privileges
Garming Sam [Wed, 18 Dec 2013 20:55:44 +0000 (09:55 +1300)]
dfs: always call create_conn_struct with root privileges

This fixes a bug in dfs_samba4 identified by Daniel Müller.

create_conn_struct calls SMB_VFS_CONNECT which requires root privileges.
SMB_VFS_CONNECT in turn calls dfs_samba4_connect which connects to samdb.

Calls were made to this function without ever becoming root (notably via setup_dfs_referral)
which resulted in an error and the VFS connect failing. This happens when you have an active
directory domain controller with host msdfs = yes in smb.conf and dfs links in place.

Signed-off-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Bjoern Baumbach <bb@sernet.de>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 10 20:11:03 CET 2014 on sn-devel-104

(cherry picked from commit 24a687642de21ce872d25f16b3525003844d05f9)

Fix bug #10378 - dfs: always call create_conn_struct with root privileges.

10 years agosmbd: Fix calls to create_conn_struct_cwd to be correctly indented.
Andrew Bartlett [Mon, 7 Jan 2013 22:29:48 +0000 (09:29 +1100)]
smbd: Fix calls to create_conn_struct_cwd to be correctly indented.

These are whitespace changes only, left out of the previous commit to preserve clarity.

Andrew Bartlett.

Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 5a3e915d20bb11984c42081bf25ce09baa58e04e)

10 years agosmbd: Split create_conn_struct into a fn that does not change the working dir
Andrew Bartlett [Wed, 10 Oct 2012 02:47:49 +0000 (13:47 +1100)]
smbd: Split create_conn_struct into a fn that does not change the working dir

The python bindings do not want the current working directory changed
during operations, so we provide two functions, one providing the
original behaviour, and other providing the python bindings with just
the memory allocation and initilisation stuff.

Andrew Bartlett

Reviewed-by: Jeremy Allison <jra@samba.org>
(cherry picked from commit 6c80cf747d75e648a1d88d477bcf476e6874c4b3)

10 years agoVERSION: Bump version number up to 4.0.15...
Karolin Seeger [Sun, 16 Feb 2014 20:01:42 +0000 (21:01 +0100)]
VERSION: Bump version number up to 4.0.15...

and re-enable git snapshots.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoVERSION: Disable git snapshots for the 4.0.15 release. samba-4.0.15
Karolin Seeger [Sun, 16 Feb 2014 20:00:50 +0000 (21:00 +0100)]
VERSION: Disable git snapshots for the 4.0.15 release.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agoWHATSNEW: Add release notes for Samba 4.0.15.
Karolin Seeger [Sun, 16 Feb 2014 19:58:36 +0000 (20:58 +0100)]
WHATSNEW: Add release notes for Samba 4.0.15.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
10 years agos3:smb2_notify: fix use after free on long living notify requests
Stefan Metzmacher [Thu, 30 Jan 2014 15:12:44 +0000 (16:12 +0100)]
s3:smb2_notify: fix use after free on long living notify requests

This is a hack, but it should fix the bug:

   change_notify_add_request() talloc moves smb_request away,
   which is not expected by the smb2_notify.c code...

   smbd_smb2_notify_reply() uses tevent_req_defer_callback()
   (in older versions an immediate event) to defer the response.
   This is needed as change_notify_reply() will do more things
   after calling reply_fn() (smbd_smb2_notify_reply is this case)
   and often change_notify_remove_request() is called after
   change_notify_reply().

   change_notify_remove_request() implicitly free's the smb_request
   that was passed to change_notify_add_request().

   smbd_smb2_fake_smb_request() added the smb_request as smb2req->smb1req,
   which is expected to be available after smbd_smb2_notify_recv() returned.

The long term solution would be the following interface:

struct tevent_req *change_notify_request_send(TALLOC_CTX *mem_ctx,
                                              struct tevent_context *ev,
                                              struct files_struct *fsp,
                                              uint32_t max_length,
                                              uint32_t filter,
                                              bool recursive);
NTSTATUS change_notify_request_recv(struct tevent_req *req,
                                    TALLOC_CTX *mem_ctx,
                                    DATA_BLOB *buffer);

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

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Stefan Metzmacher <metze@samba.org>
Autobuild-Date(master): Fri Feb 14 11:18:15 CET 2014 on sn-devel-104
(cherry picked from commit e0bf930f23fe20ee00d0006a5f6c2ba1a8f592a0)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Sun Feb 16 19:18:59 CET 2014 on sn-devel-104

10 years agos3: modules: streaminfo: As we have no VFS function SMB_VFS_LLISTXATTR we can't cope...
Jeremy Allison [Fri, 7 Feb 2014 18:19:26 +0000 (10:19 -0800)]
s3: modules: streaminfo: As we have no VFS function SMB_VFS_LLISTXATTR we can't cope with a symlink when lp_posix_pathnames() is true.

Fix bug : Bug 10429 - samba returns STATUS_OBJECT_NAME_NOT_FOUND when attempting to remove dangling symlink

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Jeff Layton <jlayton@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Sat Feb  8 00:01:16 CET 2014 on sn-devel-104
(cherry picked from commit 17adbbcad7e401dd544dfa76f7ec9aeb6a847381)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Fri Feb 14 22:35:40 CET 2014 on sn-devel-104

10 years agos3: vfs_dirsort module.
Jeremy Allison [Tue, 11 Feb 2014 18:39:04 +0000 (10:39 -0800)]
s3: vfs_dirsort module.

Add raw.search torture test on a share definition with:

vfs objects = dirsort

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

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

10 years agos3: vfs_dirsort module.
Jeremy Allison [Thu, 30 Jan 2014 01:01:30 +0000 (17:01 -0800)]
s3: vfs_dirsort module.

Allow dirsort to work when multiple simultaneous
directories are open. The old code only keeps one
active private data pointer on the connection struct, opening
a second directory on the same connection will overwrite it.

This modification turns the private data pointer
into a linked list of open directories on the
connection struct, and finds the correct one by searching
on the passed in DIR *.

With this code in place, smbd passes raw.search
torture test on a share definition with:

vfs objects = dirsort

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

Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(back-ported from commit fd79652b0e598882e0c4d156bd897c29dae8ec04)

10 years agosmbd: Fix an ancient oplock bug
Volker Lendecke [Wed, 4 Sep 2013 11:57:00 +0000 (13:57 +0200)]
smbd: Fix an ancient oplock bug

If we get an oplock break response, we forgot to remove the oplock break
timeout.

Found by stopping raw.oplock.exclusive5 after the 2nd open and watching a debug
level 10 log. This amends 08a9de89 from 2007.

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

Fix bug #10436 - cancel fsp->oplock_timeout in downgrade_file_oplock().

10 years agokdc: Add belts-and-braces check that we fail if the hdb version changes
Andrew Bartlett [Mon, 13 Jan 2014 22:23:04 +0000 (11:23 +1300)]
kdc: Add belts-and-braces check that we fail if the hdb version changes

This checks both if host system run-time Heimdal has changed version,
and that the build-time version is supported.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-By: Jelmer Vernooij <jelmer@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Mon Jan 20 22:26:49 CET 2014 on sn-devel-104

(cherry picked from commit e758f4111356fafce5b5c8393648c9ea5c400601)

The last 3 patches address bug #10418 - INTERNAL ERROR: Signal 11 in the kdc
pid.

10 years agoSupport for Heimdal's unified krb5 and hdb plugin system.
Jeffrey Clark [Fri, 10 Jan 2014 23:20:14 +0000 (17:20 -0600)]
Support for Heimdal's unified krb5 and hdb plugin system.

Fixes exportkeytab and a kdc crash when building against heimdal master.

Bug-Debian: http://bugs.debian.org/732342

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
(cherry picked from commit 368208069e33a6d9b78a90f7326d5ac1bdd204f7)

10 years agoCope with first element in hdb_method having a different name in different heimdal...
Jelmer Vernooij [Sat, 23 Nov 2013 19:46:29 +0000 (19:46 +0000)]
Cope with first element in hdb_method having a different name in different heimdal versions.

It's called `interface_version` in older Heimdal versions and
`version` in newer versions.

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

(cherry picked from commit 92489bfed4e6350b6858d5e39d538f41768912ae)

10 years agosmbd: Fix memory overwrites
Volker Lendecke [Mon, 10 Feb 2014 18:08:46 +0000 (10:08 -0800)]
smbd: Fix memory overwrites

SIVAL writes 32 bit, not 16

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Michael Adam <obnox@samba.org>
Back-ported-from master git commit : 9088bde059e93a84745ec2158e2e640b5bb13844

Fix bug #10415 - *** glibc detected *** /usr/sbin/smbd: free(): invalid next
size (fast).

10 years agos3-winbind: Improve performance of wb_fill_pwent_sid2uid_done().
Volker Lendecke [Thu, 16 Jan 2014 15:10:25 +0000 (16:10 +0100)]
s3-winbind: Improve performance of wb_fill_pwent_sid2uid_done().

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

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Thu Jan 16 20:17:24 CET 2014 on sn-devel-104

(cherry picked from commit 1a43778433934530d77791edd1af538de8b1d8a3)
Signed-off-by: Andreas Schneider <asn@samba.org>
Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Fri Feb 14 00:04:34 CET 2014 on sn-devel-104

10 years agoStop use after free
Alistair Leslie-Hughes [Thu, 26 Sep 2013 22:31:00 +0000 (08:31 +1000)]
Stop use after free

Fixes bug #10087

Thanks to Man Min Yan for their analysis and providing a solution to the issue.

Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Sep 27 14:29:46 CEST 2013 on sn-devel-104
(cherry picked from commit 6bf9a774718917c3429fa1492f5b0268ae5e01c3)

10 years agos3:dir - We now pass the previously spinning directory tests on ext4.
Jeremy Allison [Mon, 13 Jan 2014 18:20:25 +0000 (10:20 -0800)]
s3:dir - We now pass the previously spinning directory tests on ext4.

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

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): Wed Jan 15 11:39:12 CET 2014 on sn-devel-104

(cherry picked from commit 0f9a189e36d8e30dfd40e42130329a0984938ddd)

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Wed Jan 29 21:39:55 CET 2014 on sn-devel-104

10 years agos3:dir - Introduce a 64-bit directory offset <-> 32 bit wire offset map using memcache.
Jeremy Allison [Sat, 11 Jan 2014 23:45:48 +0000 (15:45 -0800)]
s3:dir - Introduce a 64-bit directory offset <-> 32 bit wire offset map using memcache.

Should fix the DOS clients against 64-bit smbd's bug.

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

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

10 years agos3:dir - Add a new memcache type (non-talloc) - SMB1_SEARCH_OFFSET_MAP.
Jeremy Allison [Sat, 11 Jan 2014 21:58:46 +0000 (13:58 -0800)]
s3:dir - Add a new memcache type (non-talloc) - SMB1_SEARCH_OFFSET_MAP.

We will use this in mapping 64-bit directory offset
cookies to a 32-bit counter.

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

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

10 years agos3:dir - Map wire offsets to native directory cookies.
Jeremy Allison [Sat, 11 Jan 2014 23:04:38 +0000 (15:04 -0800)]
s3:dir - Map wire offsets to native directory cookies.

Take care of the special offsets.

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

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

10 years agos3:dir - Cope with fixed mapping of 'special' values.
Jeremy Allison [Sat, 11 Jan 2014 22:59:00 +0000 (14:59 -0800)]
s3:dir - Cope with fixed mapping of 'special' values.

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

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

10 years agos3: dir - Introduce 32-bit wire versions of the 'special' values.
Jeremy Allison [Sat, 11 Jan 2014 22:56:57 +0000 (14:56 -0800)]
s3: dir - Introduce 32-bit wire versions of the 'special' values.

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

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

10 years agos3:dir - Introduce a function to map a directory cookie to a 32-bit wire cookie.
Jeremy Allison [Sat, 11 Jan 2014 22:48:00 +0000 (14:48 -0800)]
s3:dir - Introduce a function to map a directory cookie to a 32-bit wire cookie.

Make this an identity for now.

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

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

10 years agos3:dir - In the old SMB1 search code, rename offset to wire_offset to distinguish...
Jeremy Allison [Sat, 11 Jan 2014 22:36:17 +0000 (14:36 -0800)]
s3:dir - In the old SMB1 search code, rename offset to wire_offset to distinguish between wire and native offsets.

Rename uint32 type to correct uint32_t.

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

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

10 years agoshadow_copy2: add a comment explaining why we don't talloc_zero_array().
Michael Adam [Wed, 11 Dec 2013 08:41:38 +0000 (09:41 +0100)]
shadow_copy2: add a comment explaining why we don't talloc_zero_array().

Since I stumbled over this slighly sublte point, I thought it is
worthwile to point it our in a comment.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Michael Adam <obnox@samba.org>
Autobuild-Date(master): Wed Dec 11 19:55:20 CET 2013 on sn-devel-104

(cherry picked from commit 27baff0ec96cded0446ecd7739e9d31aaeb90868)

The last 36 patches address bug #10259 - shadow_copy2 module "Previous Version"
not working in Windows 7.

Autobuild-User(v4-0-test): Karolin Seeger <kseeger@samba.org>
Autobuild-Date(v4-0-test): Mon Jan 13 12:13:18 CET 2014 on sn-devel-104

10 years agoshadow_copy2: revert expensive and unnecessary zero-initialization
Michael Adam [Wed, 11 Dec 2013 08:34:47 +0000 (09:34 +0100)]
shadow_copy2: revert expensive and unnecessary zero-initialization

I was being overly cautious. This is initialization is not
necessary, since further down in the for-loop, the memory
always gets fully initialized because the insert string is
inserted at various slash positions.

So this talloc_zero_array can be skipped: this an expensive
thing to do in virtually every VFS call.

This essentially reverts commit 249e9b4a34d8959bd94735c1921ecfc24d6a2705.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 71318d7d685f8e1e112076f84ef2d788acb83547)

10 years agodocs: Fix typos in vfs_shadow_copy2.8.xml.
Karolin Seeger [Tue, 10 Dec 2013 14:24:31 +0000 (15:24 +0100)]
docs: Fix typos in vfs_shadow_copy2.8.xml.

Signed-off-by: Karolin Seeger <kseeger@samba.org>
Reviewed-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): David Disseldorp <ddiss@samba.org>
Autobuild-Date(master): Tue Dec 10 18:49:21 CET 2013 on sn-devel-104

(cherry picked from commit c16afddeef2938e218df63b1c669caa5fb65d39c)

10 years agodocs: update the manpage of vfs_shadow_copy2
Michael Adam [Wed, 4 Dec 2013 09:27:24 +0000 (10:27 +0100)]
docs: update the manpage of vfs_shadow_copy2

Document the configuration and all the options
available for the shadow_copy2 module.

Pair-Programmed-With: Björn Baumbach <bb@sernet.de>

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Dec  6 22:26:31 CET 2013 on sn-devel-104
(cherry picked from commit f6ac6f20540f81257e1f180454b6a2c1239e85fa)

10 years agos3:modules:shadow_copy2: remove redundant documentation comment block
Michael Adam [Wed, 4 Dec 2013 14:55:19 +0000 (15:55 +0100)]
s3:modules:shadow_copy2: remove redundant documentation comment block

and refer to the manual page instead

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 6685e6512e03d9420439a730a40fcca3411a48db)

10 years agos3:modules:shadow_copy2: improve headline comment
Michael Adam [Wed, 4 Dec 2013 14:50:26 +0000 (15:50 +0100)]
s3:modules:shadow_copy2: improve headline comment

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

10 years agos3:module:shadow_copy2: add my (C)
Michael Adam [Wed, 4 Dec 2013 12:40:14 +0000 (13:40 +0100)]
s3:module:shadow_copy2: add my (C)

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

10 years agoshadow_copy2: use stored mount_point instead of recalculating.
Michael Adam [Thu, 30 May 2013 22:46:01 +0000 (00:46 +0200)]
shadow_copy2: use stored mount_point instead of recalculating.

In the case of snapdirseverywhere but NOT crossmountpoints.

This spares stat calls.
And is the only correct thing to do if the mount point was
specified in the configuration.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 6ccbc1347d3240fc3c874a1957b654456fb6234c)

10 years agoshadow_copy2: improve debug in shadow_copy2_convert() in snapdirseverywhere mode
Michael Adam [Thu, 30 May 2013 22:45:16 +0000 (00:45 +0200)]
shadow_copy2: improve debug in shadow_copy2_convert() in snapdirseverywhere mode

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 935120dbc01890e313e2902b13141d4a13fe96d5)

10 years agoshadow_copy2: fix shadow_copy2_convert() in the classical case.
Michael Adam [Thu, 23 May 2013 14:23:03 +0000 (16:23 +0200)]
shadow_copy2: fix shadow_copy2_convert() in the classical case.

I.e. the non-snapdirseverywhere case.
This in particular fixes the case of a snapdir hierarchy
that is parallel to the share or mountpoint and not subordinate.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 9ab89371c8eddad2f274736b508866e2a92b74a3)

10 years agoshadow_copy2: add some blank lines for visual separation to shadow_copy2_convert()
Michael Adam [Wed, 29 May 2013 13:06:22 +0000 (15:06 +0200)]
shadow_copy2: add some blank lines for visual separation to shadow_copy2_convert()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 86988db1f0ebd170d2bc91b6ed78f8845bfd270c)

10 years agoshadow_copy2: initialize "converted" string to null in shadow_copy2_convert()
Michael Adam [Tue, 28 May 2013 14:59:25 +0000 (16:59 +0200)]
shadow_copy2: initialize "converted" string to null in shadow_copy2_convert()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 249e9b4a34d8959bd94735c1921ecfc24d6a2705)

10 years agoshadow_copy2: fix shadow_copy2_strip_snapshot() in the classical case
Michael Adam [Wed, 29 May 2013 15:16:23 +0000 (17:16 +0200)]
shadow_copy2: fix shadow_copy2_strip_snapshot() in the classical case

I.e., fix detection of already converted names.

This is done by using the shadow_copy2_snapshot_path() function
and comparing if the input string starts with that.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 4b8d9c65f45db426716763629f1e22b0eb859a99)

10 years agoshadow_copy2: add some debug to shadow_copy2_strip_snapshot()
Michael Adam [Wed, 29 May 2013 21:57:30 +0000 (23:57 +0200)]
shadow_copy2: add some debug to shadow_copy2_strip_snapshot()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit afcb84e69f46671030710bdda1c8798235b9ace7)

10 years agoshadow_copy2: add comments explaining decisions in shadow_copy2_strip_snapshot()
Michael Adam [Wed, 29 May 2013 15:14:49 +0000 (17:14 +0200)]
shadow_copy2: add comments explaining decisions in shadow_copy2_strip_snapshot()

This should make it more easy to understand what the cases are.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
(cherry picked from commit 3d053b1ab3e0b918509e06086a54834a9ae9cdb7)