[SCM] Samba Shared Repository - branch master updated

Jeremy Allison jra at samba.org
Thu Dec 4 00:10:03 MST 2014


The branch, master has been updated
       via  c261072 docs-xml: document the interaction between "write cache size" and "aio read/write size"
       via  5e251ad s3:smbd: document the interaction between "smb2 leases" and "write cache size"
       via  7eae946 selftest:Samba3: use "smb2 leases = yes"
       via  556bf2e s3:smb2_negprot: announce support for SMB2.1 leases.
       via  44d2612 s3:param: Add "smb2 leases" parameter. Default "false".
       via  e2d80a8 s3:smb2_create: support leases and pass them down to the VFS layer.
       via  02f2684 s3:smbd: Implementation of SMB2.1 and SMB3.0 leases.
       via  91b2488 s3:smbd: add lease related helper functions to oplock.c
       via  205ef31 s3:smbd: add lease key validation functions to open.c
       via  ffbac21 s3:smbd: add lease related helper functions to open.c
       via  eb9fc01 s3:smbd: add file_find_one_fsp_from_lease_key() helper function
       via  d78b18d s3:smb2_create: validate durable reconnects with leases
       via  81a5a9e s3:smb2_create: allow durable handles with SMB2_LEASE_HANDLE
       via  b72fca5 s3:smbd: add fsp_lease_type() and get_lease_type() helper functions
       via  7ca8785 s3:vfs.h: add more elements to struct fsp_lease
       via  3e91b82 s3:locking: add downgrade_share_lease() helper function
       via  62e7e14 s3:locking: cleanup leases_db from share_mode_cleanup_disconnected()
       via  a504b84 s3:locking: ensure all share mode removal functions go through a common lease refcount manager.
       via  6b2f19a s3:open_files.idl: add data structures for SMB2.1 and SMB3.0 leases.
       via  14fac5d s3:locking: add leases_db infrastructure
       via  a199214 s3: leases: libsmbsharemodes no longer works with SMB2 leases inside our locking.tdb.
       via  498e722 s3:smb2_server: add smbd_smb2_send_lease_break() helper function
       via  a9a3995 s3:smb2_server: allow smbd_smb2_send_break() with session == NULL and tcon == NULL
       via  c22d521 s3:smbd: Add fsp_client_guid() utility function to return the connected client guid.
       via  e761c80 s3:smbd: factor out a send_break_to_none() helper function
       via  8c323f2 s4:torture:smb2: let smb2.lease.[v2_]complex1 check the R->NONE breaks
       via  99f9eee s4:torture:smb2: Add smb2.lease.v2_breaking3 test.
       via  c5b481a s4:torture:smb2: Add test that shows the client can respond to a lease break over a different connection.
      from  78b7db1 pam_winbind: fix warn_pwd_expire implementation.

https://git.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit c261072a31bed4a7f67930fed54816312a158891
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Nov 8 09:47:01 2014 +0100

    docs-xml: document the interaction between "write cache size" and "aio read/write size"
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra at samba.org>
    Autobuild-Date(master): Thu Dec  4 08:09:15 CET 2014 on sn-devel-104

commit 5e251adbed792a53652ccaa1c3277a6ebb3af6f0
Author: Stefan Metzmacher <metze at samba.org>
Date:   Sat Nov 8 09:45:59 2014 +0100

    s3:smbd: document the interaction between "smb2 leases" and "write cache size"
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 7eae9460a357071a776fecc6f3cf8cb5cb0961a3
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Oct 14 10:34:53 2014 -0700

    selftest:Samba3: use "smb2 leases = yes"
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 556bf2ee006d14eb206c701bd8d375efb940140b
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smb2_negprot: announce support for SMB2.1 leases.
    
    We only do this with "smb2 leases = yes"
    and the default values for "oplocks = yes"
    and "kernel oplocks = no".
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 44d2612822a39b980fe2b85b2a780de2f3902155
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Oct 14 10:34:53 2014 -0700

    s3:param: Add "smb2 leases" parameter. Default "false".
    
    This is currently marked as experimental!
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit e2d80a89d53fdd6794a344649c3c9728db93adce
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smb2_create: support leases and pass them down to the VFS layer.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 02f2684dd8e88f1c55bf69fa8b2aa27c1c404a3d
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smbd: Implementation of SMB2.1 and SMB3.0 leases.
    
    Pair-Programmed-With: Jeremy Allison <jra at samba.org>
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 91b2488c9ad25b35d717bca505acc9dd060be677
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smbd: add lease related helper functions to oplock.c
    
    Pair-Programmed-With: Jeremy Allison <jra at samba.org>
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 205ef314bc78a24651683f15e7cd84d8c4b96dee
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smbd: add lease key validation functions to open.c
    
    This makes sure a lease key can only be used for one specific
    file.
    
    This also handles the dynamic share file case [homes].
    
    Pair-Programmed-With: Jeremy Allison <jra at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit ffbac2112dee9933dd34263f590f0eae28efab45
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smbd: add lease related helper functions to open.c
    
    Pair-Programmed-With: Jeremy Allison <jra at samba.org>
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit eb9fc01d207ce29e68027f8958d4e8534f89a9e5
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smbd: add file_find_one_fsp_from_lease_key() helper function
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit d78b18dd8c510591452ebd17810261cf89868d5c
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smb2_create: validate durable reconnects with leases
    
    We don't support leases yet, but prepares for the comming commits.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 81a5a9e8971fad928e0a1a022e7cb841d8dbadf5
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smb2_create: allow durable handles with SMB2_LEASE_HANDLE
    
    We don't support real lease yet, but this makes use of fsp_lease_type()
    which converts a batch oplock into and RWH lease.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit b72fca52defa1fd0f7d10f2811d86bbc7c661f50
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smbd: add fsp_lease_type() and get_lease_type() helper functions
    
    These convert the oplock state into SMB2_LEASE_ flags.
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 7ca8785cae6529fe9b8f5546aaf3c15cca9458cd
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 3 17:57:37 2014 +0100

    s3:vfs.h: add more elements to struct fsp_lease
    
    We'll need a reference to the smbd_server_connection as well
    as a timeout handler.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 3e91b823e4447b936e0fafaf7807b665a51ded30
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:locking: add downgrade_share_lease() helper function
    
    Pair-Programmed-With: Jeremy Allison <jra at samba.org>
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 62e7e142aa350be8f25193bf9c39a19e354346ea
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Nov 27 19:32:46 2014 +0100

    s3:locking: cleanup leases_db from share_mode_cleanup_disconnected()
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit a504b84ec147f64c428095519099104a2cb6ff1f
Author: Jeremy Allison <jra at samba.org>
Date:   Fri Oct 10 14:32:19 2014 -0700

    s3:locking: ensure all share mode removal functions go through a common lease refcount manager.
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 6b2f19a5e6e8b3eb2a44cd24408ba4f27cfb8745
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Nov 27 18:34:56 2014 +0100

    s3:open_files.idl: add data structures for SMB2.1 and SMB3.0 leases.
    
    Pair-Programmed-With: Volker Lendecke <vl at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit 14fac5dbc05823562760ac424522fb39817ec062
Author: Volker Lendecke <vl at samba.org>
Date:   Fri Oct 10 16:36:54 2014 -0700

    s3:locking: add leases_db infrastructure
    
    Will enable us to solve the dynamic share path problem
    with leases on [homes].
    
    We're also able to give the correct error codes when a
    lease key is re-used with a different file name.
    
    Pair-Programmed-With: Jeremy Allison <jra at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit a199214dfb5fc9c2b4c9e15ccb24198065c616b9
Author: Jeremy Allison <jra at samba.org>
Date:   Wed Dec 3 17:06:08 2014 -0800

    s3: leases: libsmbsharemodes no longer works with SMB2 leases inside our locking.tdb.
    
    Remove it until a maintainer can be found.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 498e7220c553155ab6e7f383d9c4377ee92774ee
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smb2_server: add smbd_smb2_send_lease_break() helper function
    
    Pair-Programmed-With: Stefan Metzmacher <metze at samba.org>
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Signed-off-by: Stefan Metzmacher <metze at samba.org>

commit a9a39953c785e76f67ce72c776b36ad1e0130ded
Author: Stefan Metzmacher <metze at samba.org>
Date:   Thu Nov 13 11:50:14 2014 +0100

    s3:smb2_server: allow smbd_smb2_send_break() with session == NULL and tcon == NULL
    
    In future we want to use this for lease breaks and they're not attached
    to a session.
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit c22d521d26a75a71f940088b5a01d7fa924efd88
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Nov 4 21:46:14 2014 -0800

    s3:smbd: Add fsp_client_guid() utility function to return the connected client guid.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit e761c80f65c690ce2d93c30bcd8d8d9d752096a8
Author: Volker Lendecke <vl at samba.org>
Date:   Tue Oct 28 15:31:46 2014 -0700

    s3:smbd: factor out a send_break_to_none() helper function
    
    Signed-off-by: Volker Lendecke <vl at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 8c323f20dccb8d7a362e6ebb87fd6ec7739c336a
Author: Stefan Metzmacher <metze at samba.org>
Date:   Wed Dec 3 22:32:33 2014 +0100

    s4:torture:smb2: let smb2.lease.[v2_]complex1 check the R->NONE breaks
    
    Signed-off-by: Stefan Metzmacher <metze at samba.org>
    Reviewed-by: Jeremy Allison <jra at samba.org>

commit 99f9eee657fcc1c435d00a677395e5125070bf77
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Dec 2 12:58:28 2014 -0800

    s4:torture:smb2: Add smb2.lease.v2_breaking3 test.
    
    This verifies the epoch handling in the multi step break.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit c5b481a8d5ed6c7c18c14479bc0263f37ded4702
Author: Jeremy Allison <jra at samba.org>
Date:   Mon Dec 1 13:57:57 2014 -0800

    s4:torture:smb2: Add test that shows the client can respond to a lease break over a different connection.
    
    Signed-off-by: Jeremy Allison <jra at samba.org>
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 docs-xml/smbdotconf/locking/kerneloplocks.xml |   1 +
 docs-xml/smbdotconf/locking/oplocks.xml       |   1 +
 docs-xml/smbdotconf/locking/smb2leases.xml    |  31 ++
 docs-xml/smbdotconf/tuning/writecachesize.xml |   5 +
 lib/param/param_table.c                       |   9 +
 packaging/RHEL-CTDB/configure.rpm             |   1 -
 packaging/RHEL-CTDB/samba.spec.tmpl           |   3 -
 packaging/RHEL/samba.spec.tmpl                |   2 -
 selftest/knownfail                            |  13 -
 selftest/target/Samba3.pm                     |   1 +
 source3/include/smb.h                         |   1 +
 source3/include/vfs.h                         |   2 +
 source3/librpc/idl/leases_db.idl              |  23 +
 source3/librpc/idl/open_files.idl             |  36 ++
 source3/librpc/idl/wscript_build              |   1 +
 source3/librpc/wscript_build                  |   7 +-
 source3/libsmb/smb_share_modes.c              |   8 +
 source3/libsmb/smbsharemodes.pc.in            |  11 -
 source3/locking/leases_db.c                   | 387 +++++++++++++
 source3/locking/leases_db.h                   |  46 ++
 source3/locking/locking.c                     | 188 ++++++-
 source3/locking/proto.h                       |  11 +-
 source3/locking/share_mode_lock.c             |  24 +-
 source3/param/loadparm.c                      |   1 +
 source3/smbd/durable.c                        |  28 +-
 source3/smbd/fileio.c                         |   5 +
 source3/smbd/files.c                          |  39 ++
 source3/smbd/globals.h                        |  10 +-
 source3/smbd/open.c                           | 751 +++++++++++++++++++++-----
 source3/smbd/oplock.c                         | 582 ++++++++++++++++++--
 source3/smbd/proto.h                          |  22 +
 source3/smbd/server.c                         |   5 +
 source3/smbd/smb2_break.c                     | 251 ++++++++-
 source3/smbd/smb2_create.c                    | 156 +++++-
 source3/smbd/smb2_negprot.c                   |   8 +
 source3/smbd/smb2_server.c                    |  36 +-
 source3/utils/status.c                        |   9 +
 source3/wscript_build                         |  14 +-
 source4/torture/smb2/lease.c                  | 331 +++++++++++-
 39 files changed, 2805 insertions(+), 255 deletions(-)
 create mode 100644 docs-xml/smbdotconf/locking/smb2leases.xml
 create mode 100644 source3/librpc/idl/leases_db.idl
 delete mode 100644 source3/libsmb/smbsharemodes.pc.in
 create mode 100644 source3/locking/leases_db.c
 create mode 100644 source3/locking/leases_db.h


Changeset truncated at 500 lines:

diff --git a/docs-xml/smbdotconf/locking/kerneloplocks.xml b/docs-xml/smbdotconf/locking/kerneloplocks.xml
index 8e3bba5..d8fe223 100644
--- a/docs-xml/smbdotconf/locking/kerneloplocks.xml
+++ b/docs-xml/smbdotconf/locking/kerneloplocks.xml
@@ -25,5 +25,6 @@
 
 <related>oplocks</related>
 <related>level2 oplocks</related>
+<related>smb2 leases</related>
 <value type="default">no</value>
 </samba:parameter>
diff --git a/docs-xml/smbdotconf/locking/oplocks.xml b/docs-xml/smbdotconf/locking/oplocks.xml
index a56e921..a5e163b 100644
--- a/docs-xml/smbdotconf/locking/oplocks.xml
+++ b/docs-xml/smbdotconf/locking/oplocks.xml
@@ -25,5 +25,6 @@
 
 <related>kernel oplocks</related>
 <related>level2 oplocks</related>
+<related>smb2 leases</related>
 <value type="default">yes</value>
 </samba:parameter>
diff --git a/docs-xml/smbdotconf/locking/smb2leases.xml b/docs-xml/smbdotconf/locking/smb2leases.xml
new file mode 100644
index 0000000..9241bc8
--- /dev/null
+++ b/docs-xml/smbdotconf/locking/smb2leases.xml
@@ -0,0 +1,31 @@
+<samba:parameter name="smb2 leases"
+                 context="G"
+				 type="boolean"
+                 xmlns:samba="http://www.samba.org/samba/DTD/samba-doc">
+<description>
+	<para>
+	This boolean option tells <command moreinfo="none">smbd</command> whether to
+	globally negotiate SMB2 leases on file open requests. Leasing is an SMB2-only
+	feature which allows clients to aggressively cache files locally above and
+	beyond the caching allowed by SMB1 oplocks. This (experimental) parameter is
+	set to off by default until the SMB2 leasing code is declared fully stable.
+	</para>
+
+	<para>
+	This is only available with <smbconfoption name="oplocks">yes</smbconfoption>
+	and <smbconfoption name="kernel oplocks">no</smbconfoption>.
+	</para>
+
+	<para>Note that the write cache won't be used for file handles with a smb2 write lease.</para>
+
+	<para>
+	The Samba implementation of leases is currently marked as experimental!
+	</para>
+</description>
+
+<related>oplocks</related>
+<related>kernel oplocks</related>
+<related>level2 oplocks</related>
+<related>write cache size</related>
+<value type="default">no</value>
+</samba:parameter>
diff --git a/docs-xml/smbdotconf/tuning/writecachesize.xml b/docs-xml/smbdotconf/tuning/writecachesize.xml
index 12965b4..e2fa17f 100644
--- a/docs-xml/smbdotconf/tuning/writecachesize.xml
+++ b/docs-xml/smbdotconf/tuning/writecachesize.xml
@@ -21,8 +21,13 @@
 
     <para>The integer parameter specifies the size of this cache 
 		(per oplocked file) in bytes.</para>
+
+    <para>Note that the write cache won't be used for file handles with a smb2 write lease.</para>
 </description>
 
+<related>aio read size</related>
+<related>aio write size</related>
+<related>smb2 leases</related>
 <value type="default">0</value>
 <value type="example">262144<comment> for a 256k cache size per file</comment></value>
 </samba:parameter>
diff --git a/lib/param/param_table.c b/lib/param/param_table.c
index 5dbcda8..18b0628 100644
--- a/lib/param/param_table.c
+++ b/lib/param/param_table.c
@@ -3023,6 +3023,15 @@ struct parm_struct parm_table[] = {
 		.flags		= FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
 	},
 	{
+		.label		= "smb2 leases",
+		.type		= P_BOOL,
+		.p_class	= P_GLOBAL,
+		.offset		= GLOBAL_VAR(smb2_leases),
+		.special	= NULL,
+		.enum_list	= NULL,
+		.flags		= FLAG_ADVANCED,
+	},
+	{
 		.label		= "locking",
 		.type		= P_BOOL,
 		.p_class	= P_LOCAL,
diff --git a/packaging/RHEL-CTDB/configure.rpm b/packaging/RHEL-CTDB/configure.rpm
index 398a3f9..62a326c 100755
--- a/packaging/RHEL-CTDB/configure.rpm
+++ b/packaging/RHEL-CTDB/configure.rpm
@@ -53,7 +53,6 @@ CC="$CC" CFLAGS="-Wall -g -D_GNU_SOURCE -O3" ./configure -C \
 	--enable-fhs \
 	--with-pam_smbpass \
 	--with-libsmbclient \
-	--with-libsmbsharemodes \
 	--without-smbwrapper \
 	--with-pam \
 	--with-quotas \
diff --git a/packaging/RHEL-CTDB/samba.spec.tmpl b/packaging/RHEL-CTDB/samba.spec.tmpl
index c1789f2..056c00f 100644
--- a/packaging/RHEL-CTDB/samba.spec.tmpl
+++ b/packaging/RHEL-CTDB/samba.spec.tmpl
@@ -171,7 +171,6 @@ CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
 	--enable-fhs \
 	--with-pam_smbpass \
 	--with-libsmbclient \
-	--with-libsmbsharemodes \
 	--without-smbwrapper \
 	--with-pam \
 	--with-quotas \
@@ -544,8 +543,6 @@ exit 0
 %{_includedir}/libsmbclient.h
 %{_libarchdir}/libsmbclient.*
 %{_includedir}/smb_share_modes.h
-%{_libarchdir}/libsmbsharemodes.so
-%{_libarchdir}/libsmbsharemodes.so.0
 
 %{_includedir}/netapi.h
 %{_includedir}/wbclient.h
diff --git a/packaging/RHEL/samba.spec.tmpl b/packaging/RHEL/samba.spec.tmpl
index 05e46e1..ed37994 100644
--- a/packaging/RHEL/samba.spec.tmpl
+++ b/packaging/RHEL/samba.spec.tmpl
@@ -167,7 +167,6 @@ CC="$CC" CFLAGS="$RPM_OPT_FLAGS $EXTRA -D_GNU_SOURCE" ./configure \
         --with-fhs \
 	--with-pam_smbpass \
 	--with-libsmbclient \
-	--with-libsmbsharemodes \
         --without-smbwrapper \
 	--with-pam \
 	--with-quotas \
@@ -470,7 +469,6 @@ fi
 %{_includedir}/libsmbclient.h
 %{_libarchdir}/libsmbclient.*
 %{_includedir}/smb_share_modes.h
-%{_libarchdir}/libsmbsharemodes.*
 
 %{_libarchdir}/samba/*.dat
 %{_libarchdir}/samba/*.msg
diff --git a/selftest/knownfail b/selftest/knownfail
index 1c4f446..af7e7fd 100644
--- a/selftest/knownfail
+++ b/selftest/knownfail
@@ -189,25 +189,12 @@
 ^samba3.smb2.notify.valid-req
 ^samba3.smb2.notify.dir
 ^samba3.smb2.notify.rec
-^samba3.smb2.durable-open.lock-lease
 ^samba3.smb2.durable-open.delete_on_close2
-^samba3.smb2.durable-v2-open.open-lease
-^samba3.smb2.durable-v2-open.persistent-open-lease
 ^samba3.smb2.durable-v2-open.app-instance
 ^samba4.smb2.ioctl.req_resume_key\(dc\) # not supported by s4 ntvfs server
 ^samba4.smb2.ioctl.copy_chunk_\w*\(dc\)	# not supported by s4 ntvfs server
 ^samba3.smb2.dir.one
 ^samba3.smb2.dir.modify
-^samba3.smb2.lease.request
-^samba3.smb2.lease.upgrade
-^samba3.smb2.lease.break
-^samba3.smb2.lease.oplock
-^samba3.smb2.lease.multibreak
-^samba3.smb2.lease.v2_request
-^samba3.smb2.lease.v2_request_parent
-^samba3.smb2.lease.break_twice
-^samba3.smb2.lease.nobreakself
-^samba3.smb2.lease.v2_epoch1
 ^samba3.smb2.oplock.batch20
 ^samba3.smb2.oplock.stream1
 ^samba3.smb2.streams.rename
diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm
index 797179f..50c2642 100755
--- a/selftest/target/Samba3.pm
+++ b/selftest/target/Samba3.pm
@@ -1057,6 +1057,7 @@ sub provision($$$$$$)
 
 	kernel oplocks = no
 	kernel change notify = no
+	smb2 leases = yes
 
 	syslog = no
 	printing = bsd
diff --git a/source3/include/smb.h b/source3/include/smb.h
index 53d3edc..a6589db 100644
--- a/source3/include/smb.h
+++ b/source3/include/smb.h
@@ -577,6 +577,7 @@ enum remote_arch_types {RA_UNKNOWN, RA_WFWG, RA_OS2, RA_WIN95, RA_WINNT,
 #define EXCLUSIVE_OPLOCK 		OPLOCK_EXCLUSIVE
 #define BATCH_OPLOCK 			OPLOCK_BATCH
 #define LEVEL_II_OPLOCK 		OPLOCK_LEVEL_II
+#define LEASE_OPLOCK			0x100
 
 /* The following are Samba-private. */
 #define INTERNAL_OPEN_ONLY 		0x8
diff --git a/source3/include/vfs.h b/source3/include/vfs.h
index b0f00e8..e7dc079 100644
--- a/source3/include/vfs.h
+++ b/source3/include/vfs.h
@@ -205,6 +205,8 @@ struct fd_handle {
 
 struct fsp_lease {
 	size_t ref_count;
+	struct smbd_server_connection *sconn;
+	struct tevent_timer *timeout;
 	struct smb2_lease lease;
 };
 
diff --git a/source3/librpc/idl/leases_db.idl b/source3/librpc/idl/leases_db.idl
new file mode 100644
index 0000000..2ab1591
--- /dev/null
+++ b/source3/librpc/idl/leases_db.idl
@@ -0,0 +1,23 @@
+#include "idl_types.h"
+
+import "misc.idl";
+import "smb2_lease_struct.idl";
+import "file_id.idl";
+
+[
+	pointer_default(unique)
+]
+interface leases_db
+{
+	typedef [public] struct {
+		GUID client_guid;
+		smb2_lease_key lease_key;
+	} leases_db_key;
+
+	typedef [public] struct {
+		uint32 num_file_ids;
+		[size_is(num_file_ids)] file_id ids[];
+		[string,charset(UTF8)] char *filename;
+		[string,charset(UTF8)] char *stream_name;
+	} leases_db_value;
+}
diff --git a/source3/librpc/idl/open_files.idl b/source3/librpc/idl/open_files.idl
index 4278301..0a9d5fd 100644
--- a/source3/librpc/idl/open_files.idl
+++ b/source3/librpc/idl/open_files.idl
@@ -3,6 +3,8 @@
 import "server_id.idl";
 import "security.idl";
 import "file_id.idl";
+import "smb2_lease_struct.idl";
+import "misc.idl";
 
 [
 	pointer_default(unique)
@@ -10,10 +12,41 @@ import "file_id.idl";
 
 interface open_files
 {
+	typedef [public,flag(NDR_PAHEX)] struct {
+		GUID			client_guid;
+		smb2_lease_key		lease_key;
+		smb2_lease_state	current_state;
+		/*
+		 * 'breaking' indicates that we're waiting
+		 * for a lease break ack from the client
+		 * and breaking_to_requested and breaking_to_required
+		 * have a meaning.
+		 *
+		 * breaking_to_requested is the value already sent to
+		 * the client, the client needs to ack to this (or less).
+		 *
+		 * breaking_to_required is the internal value that needs to
+		 * be reached before we can reset breaking = false, this
+		 * may requires multiple roundtrips to the client, e.g.
+		 * when the lease broken to a more reduced value, while
+		 * the lease break is still in progress.
+		 *
+		 * The following can be assumed (if breaking == true):
+		 *
+		 * current_state > breaking_to_requested >= breaking_to_required
+		 */
+		boolean8		breaking;
+		smb2_lease_state	breaking_to_requested;
+		smb2_lease_state	breaking_to_required;
+		uint16			lease_version;
+		uint16			epoch;
+	} share_mode_lease;
+
 	typedef [public] struct {
 		server_id	pid;
 		hyper		op_mid;
 		uint16		op_type;
+		uint32		lease_idx;
 		uint32		access_mask;
 		uint32		share_access;
 		uint32		private_options;
@@ -29,6 +62,7 @@ interface open_files
 		 * to store this share_mode_entry on disk.
 		 */
 		[skip] boolean8	stale;
+		[skip] share_mode_lease *lease;
 	} share_mode_entry;
 
 	typedef [public] struct {
@@ -43,6 +77,8 @@ interface open_files
 		[string,charset(UTF8)] char *stream_name;
 		uint32 num_share_modes;
 		[size_is(num_share_modes)] share_mode_entry share_modes[];
+		uint32 num_leases;
+		[size_is(num_leases)] share_mode_lease leases[];
 		uint32 num_delete_tokens;
 		[size_is(num_delete_tokens)] delete_token delete_tokens[];
 		timespec old_write_time;
diff --git a/source3/librpc/idl/wscript_build b/source3/librpc/idl/wscript_build
index c38fe7b..f9b1bd7 100644
--- a/source3/librpc/idl/wscript_build
+++ b/source3/librpc/idl/wscript_build
@@ -8,6 +8,7 @@ bld.SAMBA_PIDL_LIST('PIDL',
                     '''messaging.idl libnetapi.idl open_files.idl
                        perfcount.idl secrets.idl libnet_join.idl
                        smbXsrv.idl
+                       leases_db.idl
                     ''',
                     options='--includedir=%s --header --ndr-parser' % topinclude,
                     output_dir='../gen_ndr')
diff --git a/source3/librpc/wscript_build b/source3/librpc/wscript_build
index 77ae048..5c83cf2 100644
--- a/source3/librpc/wscript_build
+++ b/source3/librpc/wscript_build
@@ -17,7 +17,7 @@ bld.SAMBA3_SUBSYSTEM('NDR_MESSAGING',
 
 bld.SAMBA3_SUBSYSTEM('NDR_OPEN_FILES',
 	source='gen_ndr/ndr_open_files.c',
-	public_deps='ndr NDR_SERVER_ID NDR_FILE_ID NDR_SECURITY'
+	public_deps='ndr NDR_SERVER_ID NDR_FILE_ID NDR_SECURITY NDR_SMB2_LEASE_STRUCT'
 	)
 
 bld.SAMBA3_SUBSYSTEM('NDR_SMBXSRV',
@@ -25,6 +25,11 @@ bld.SAMBA3_SUBSYSTEM('NDR_SMBXSRV',
 	public_deps='ndr NDR_SERVER_ID NDR_SECURITY NDR_AUTH'
 	)
 
+bld.SAMBA3_SUBSYSTEM('NDR_LEASES_DB',
+	source='gen_ndr/ndr_leases_db.c',
+	public_deps='ndr'
+	)
+
 bld.SAMBA3_SUBSYSTEM('NDR_SECRETS',
 	source='gen_ndr/ndr_secrets.c',
 	public_deps='ndr'
diff --git a/source3/libsmb/smb_share_modes.c b/source3/libsmb/smb_share_modes.c
index f2decc1..bf21bf5 100644
--- a/source3/libsmb/smb_share_modes.c
+++ b/source3/libsmb/smb_share_modes.c
@@ -2,6 +2,14 @@
    Samba share mode database library external interface library.
    Used by non-Samba products needing access to the Samba share mode db.
 
+   NOTICE FOR SAMBA 4.2.0
+
+   THIS CODE IS NON-FUNCTIONAL IN SAMBA 4.2.0 AND ABOVE DUE TO THE CHANGES IN
+   SHARE MODE DATABASE SCHEMA FOR SMB2 LEASES.
+
+   CONTACT THE AUTHOR jra at samba.org IF YOU WISH TO RE-ENABLE
+   THIS CODE.
+
    Copyright (C) Jeremy Allison 2005 - 2006
 
    sharemodes_procid functions (C) Copyright (C) Volker Lendecke 2005
diff --git a/source3/libsmb/smbsharemodes.pc.in b/source3/libsmb/smbsharemodes.pc.in
deleted file mode 100644
index fadc481..0000000
--- a/source3/libsmb/smbsharemodes.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: Samba libsmbsharemodes
-Description: A library
-Version: @PACKAGE_VERSION@
-Libs: @LIB_RPATH@ -L${libdir} -lsmbsharemodes
-Cflags: -I${includedir}
-URL: http://www.samba.org/
diff --git a/source3/locking/leases_db.c b/source3/locking/leases_db.c
new file mode 100644
index 0000000..67c93ff
--- /dev/null
+++ b/source3/locking/leases_db.c
@@ -0,0 +1,387 @@
+/*
+   Unix SMB/CIFS implementation.
+   Map lease keys to file ids
+   Copyright (C) Volker Lendecke 2013
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+#include "includes.h"
+#include "system/filesys.h"
+#include "locking/leases_db.h"
+#include "dbwrap/dbwrap.h"
+#include "dbwrap/dbwrap_open.h"
+#include "util_tdb.h"
+#include "ndr.h"
+#include "librpc/gen_ndr/ndr_leases_db.h"
+
+#undef DBGC_CLASS
+#define DBGC_CLASS DBGC_LOCKING
+
+/* the leases database handle */
+static struct db_context *leases_db;
+
+bool leases_db_init(bool read_only)
+{
+	if (leases_db) {
+		return true;
+	}
+
+	leases_db = db_open(NULL, lock_path("leases.tdb"), 0,
+			    TDB_DEFAULT|TDB_VOLATILE|TDB_CLEAR_IF_FIRST|
+			    TDB_INCOMPATIBLE_HASH,
+			    read_only ? O_RDONLY : O_RDWR|O_CREAT, 0644,
+			    DBWRAP_LOCK_ORDER_2, DBWRAP_FLAG_NONE);
+
+	if (leases_db == NULL) {
+		DEBUG(1, ("ERROR: Failed to initialise leases database\n"));
+		return false;
+	}
+
+	return true;
+}
+
+static bool leases_db_key(TALLOC_CTX *mem_ctx,
+			  const struct GUID *client_guid,
+			  const struct smb2_lease_key *lease_key,
+			  TDB_DATA *key)
+{
+	struct leases_db_key db_key = {
+		.client_guid = *client_guid,
+		.lease_key = *lease_key };
+	DATA_BLOB blob;
+	enum ndr_err_code ndr_err;
+
+	if (DEBUGLEVEL >= 10) {
+		DEBUG(10, ("%s:\n", __func__));
+		NDR_PRINT_DEBUG(leases_db_key, &db_key);
+	}
+
+	ndr_err = ndr_push_struct_blob(
+		&blob, mem_ctx, &db_key,
+		(ndr_push_flags_fn_t)ndr_push_leases_db_key);
+	if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+		DEBUG(10, ("%s: ndr_push_struct_blob_failed: %s\n",
+			   __func__, ndr_errstr(ndr_err)));
+		return false;
+	}
+
+	*key = make_tdb_data(blob.data, blob.length);
+	return true;
+}
+
+NTSTATUS leases_db_add(const struct GUID *client_guid,
+		       const struct smb2_lease_key *lease_key,
+		       const struct file_id *id,
+		       const char *filename,
+		       const char *stream_name)
+{
+	TDB_DATA db_key, db_value;
+	DATA_BLOB blob;
+	struct db_record *rec;
+	NTSTATUS status;
+	bool ok;
+	struct leases_db_value new_value;
+	struct leases_db_value *value = NULL;
+	enum ndr_err_code ndr_err;
+
+	if (!leases_db_init(false)) {
+		return NT_STATUS_INTERNAL_ERROR;
+	}
+


-- 
Samba Shared Repository


More information about the samba-cvs mailing list