1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
Commit Graph

86517 Commits

Author SHA1 Message Date
Michael Adam
dd25679256 smbd:smb2: ignore an dhnq blob along with a dhnc in create
This is according to MS-SMB2, 3.3.5.9.7
"Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context"

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
ea51681cc2 smbd:smb2_create: fix return code for durable handle create blob combinations
According to MS-SMB2:

3.3.5.9.7 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT Create Context
3.3.5.9.12 Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 Create Context

and verified by test results.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
7b624cf856 s4:torture:smb2: add durable-v2-open.reopen2c
- create durable with v1 request
- reconnect with v2 reconnect request
==> fails

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
ba05f705a1 s4:torture:smb2: add durable-v2-open.reopen2b
- connect with durable v2
- reconnect with durable v1
=> succeeds

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
0ecfe1755e s4:torture:smb2: add durable-v2-open.create-blob
test various combinations of durable create and reconnect
request blobs, according to
MS-SMB2, 3.3.5.9.12:
"Handling the SMB2_CREATE_DURABLE_HANDLE_RECONNECT_V2 Create Context"

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
bd3b922a45 s4:torture:smb2: extend the durable-open.reopen2 test
Add tests for:
- filename and many other things don't matter in reconnect
- additionally specified DHnQ request blob is ignored.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
6fc5661640 s4:torture:smb2: extend the durable-v2-open.reopen2 test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
1bd2ab4161 smbd:smb2: successfully answer a DHnC request when the initial create was DH2Q
I.e. the durable reconnect attempt is v1 while the original create was durable
v2 including the create guid.

Implement this by skipping the create_guid verification when
the reconnect request is v1.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
9769f06977 smbd:smb2_create: add comment about validity of check reconnect blob being only one
With leases this will not be true any more.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
d8cd54962b s4:torture:smb2: add a durable-open.reopen-lease-v2 test
like durable-open.reopen2-lease but with v2 lease requets

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
43c4a65f91 s4:torture:smb2: add durable-v2-open.reopen2-lease-v2
lease v2 variant of the reopen2 test.
Test various success and failure cases.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
5647287a42 s4:torture:smb2: add smb2_lease_v2_create() wrapper to smb2_lease_v2_create_share()
that sets share all. similar to smb2_lease_create()

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
d4f4d08d6c s4:torture:smb2: add durable-v2-open.reopen2-lease
lease v1 variant of the reopen2 test

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
1f14747094 s4:torture:smb2: add durable-open.reopen2-lease test
lease-variant of the reopen2 test

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:08 +02:00
Michael Adam
6c6643c364 s4:torture:smb2: fix durable-open lease tests to pass against windows.
Fix is: reconnect with same client-guid as on the first connection.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
a31ea15203 s4:torture:smb2: add smbcli_options argument to torture_smb2_connection_ext()
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
596f802d5d s4:libcli:smb2: make smbcli_options argument to smb2_connect_(send|ext) const
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
5736f13400 s4:libcli:smb2: add the smb2_capabilities to the smbcli_options
and initialize them in lpcfg_smbcli_options() instead of
in smb2_transport_init() as previously.

This will allow us to control them from callers later.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
4e99a0fbfe s4:libcli:smb2: add the client_guid to the smbcli_options
and initialize it in lpcfg_smbcli_options() instead of
in smb2_transport_init() as previously.

Having the client guid in the smbcli_options will allow
us to control them from callers later.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
39a965ac83 s4:torture:spoolss: use smb2_connect() instead of smb2_connet_ext()
in print_test_smbd: we don't need to pass the previous_session_id.

Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:07 +02:00
Michael Adam
14e3f4bd3b s4:torture:smb2: fix a comment in the durable-open.lock-oplock test
Signed-off-by: Michael Adam <obnox@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
2013-10-05 14:04:07 +02:00
Brian Martin
8fe1f405e9 samba_backup: fix bug, add command line parameter, improve error messages
Also remove .bak suffix from tdb/ldb backups for more consistent restore procedures

Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Matthieu Patou <mat@matws.net>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Sat Oct  5 13:51:34 CEST 2013 on sn-devel-104
2013-10-05 13:51:34 +02:00
Michael Adam
6ccbc1347d 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>
2013-10-05 09:21:33 +13:00
Michael Adam
935120dbc0 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>
2013-10-05 09:21:31 +13:00
Michael Adam
9ab89371c8 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>
2013-10-05 09:21:30 +13:00
Michael Adam
86988db1f0 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>
2013-10-05 09:21:29 +13:00
Michael Adam
249e9b4a34 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>
2013-10-05 09:21:28 +13:00
Michael Adam
4b8d9c65f4 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>
2013-10-05 09:21:26 +13:00
Michael Adam
afcb84e69f 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>
2013-10-05 09:21:25 +13:00
Michael Adam
3d053b1ab3 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>
2013-10-05 09:21:24 +13:00
Michael Adam
38e108563d shadow_copy2: introduce shadow_copy2_snapshot_path()
This builds the posix snapshot path for the connection
at the provided timestamp. For the non-snapdirseverywhere case.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:22 +13:00
Michael Adam
4cc5140bbe shadow_copy2: factor shadow_copy2_posix_gmt_string() out of shadow_copy2_insert_string()
for re-use..

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:21 +13:00
Michael Adam
304a0f531c shadow_copy2: shadow_copy2_insert_string(): do not prepend a "/" in absolute mode
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:20 +13:00
Michael Adam
e86923eb52 shadow_copy2: make shadow_copy2_find_snapdir() return const char *
instead of char *. This eliminates compiler warnings.
snapdir is a const string in all occasions.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:18 +13:00
Michael Adam
dbdb436a80 shadow_copy2: in the classical case, use configured path in shadow_copy2_find_snapdir()
There is no point in searching for snapdir if not in snapdirseverywhere mode.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:17 +13:00
Michael Adam
ea898ea1ac shadow_copy2: implement disk_free
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:15 +13:00
Michael Adam
c4f9954ebb shadow_copy2: log resulting config at the end of shadow_copy2_connect()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:14 +13:00
Michael Adam
a7ca55c8da shadow_copy2: add snapshot_basepath to the config.
This is the absolute version of snapdir.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:13 +13:00
Michael Adam
d34dc1b002 shadow_copy2: add rel_connectpath to config.
This is the share root, relative to the basedir.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:11 +13:00
Michael Adam
2d5a3af4bc shadow_copy2: introduce "shadow:mountpoint" option
Possiblity to explicitly set the share's mount point.
This is useful mainly for debugging and testing purposes.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:10 +13:00
Michael Adam
ed751b9ee4 shadow_copy2: re-add the basedir option.
Disable basedir if it is not an absolute path or if
snapdirseverywhere or crossmountpoints is enabled.

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

Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Björn Baumbach <bb@sernet.de>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:09 +13:00
Michael Adam
1e887fcda0 shadow_copy2: disable "snapdir:crossmountpoints" if the snapdir is absolute.
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:07 +13:00
Michael Adam
843954989c shadow_copy2: introduce the bool "snapdir_absolute" in the config.
Not exposed but to be used internally.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:05 +13:00
Michael Adam
1ecef57435 shadow_copy2: introduce config struct and function shadow_copy2_connect()
This moves the parsing of the config to a central place.
So users of configuation don't need to call lp_parm_... all the time.

Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:01 +13:00
Michael Adam
6da7375cd8 shadow_copy2: add comment explaining the SMB level GMT format pattern
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:21:00 +13:00
Michael Adam
5c900fd930 shadow_copy2: add comment block explaining shadow_copy2_convert()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:58 +13:00
Michael Adam
5da5512985 shadow_copy2: add comment block explaining shadow_copy2_insert_string()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:56 +13:00
Michael Adam
b90d1e6ac0 shadow_copy2: add comment block explaining shadow_copy2_find_snapdir()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:55 +13:00
Michael Adam
5b494b3dea shadow_copy2: add header comment explaining have_snapdir()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:53 +13:00
Michael Adam
9361824ddd shadow_copy2: add comment header describing shadow_copy2_strip_snapshot()
Signed-off-by: Michael Adam <obnox@samba.org>

Reviewed-by: Andrew Bartlett <abartlet@samba.org>
2013-10-05 09:20:51 +13:00