[PATCH] smbd: Fix snapshot query on shares with DFS enabled

Jeremy Allison jra at samba.org
Wed Aug 17 15:52:31 UTC 2016

On Wed, Aug 17, 2016 at 10:12:45AM +0300, Uri Simchoni wrote:
> > 
> I've played with it some (haven't carefully reviewed it). Adding a patch
> that runs shadow-copy2 tests using both SMB3 and NT1, and a test-patch
> that puts the @GMT at the end of the path.
> The SMB3 variant fails without your snapshot listing code, but passes
> with it, no matter where the @GMT is, so I don't understand why you said
> that path/@GMT-xxx fails (tested both path\@GMT and path/@GMT).

I was running against Windows, that's why :-). Windows needs TWrp.

> IMHO smbclient should place a TWrp in its allinfo query - that's what's
> going to work against any SMB2 server. Perhaps we can also add smbclient
> functionality to access previous versions (somewhat like cd - smbclient
> keeps the dir locally and prepends it to paths. In the same way the TWrp
> can be added to any open).

I've been thinking about that. I don't want the client code to arbitrarily
scan SMB2 opens for @GMT-YYYY... paths and convert them into TWrp tokens,
so I was thinking of a modal switch (yeah sucks but I can't think of any
other way).

Like we have cli_set_backup_intent(), I think we need cli_set_previous_version(cli, time_t t).

If that is set, the SMB2 client code then scans for and removes
any @GMT-YYYY... part of the path that contains the time_t t
and sends a TWtp token containing t.

I'm trying to keep compatibility with the SMB1 path-based selection,
as well as the SMB2 TWtp based selection, which is rather hard. The
source3/client/client.c code can set a previous version time using
cli_set_previous_version() as well as append the @GMT-YYYY.. to the
path to cover both cases.

Setting cli_set_previous_version(cli, 0) removes any special casing
in the SMB2 client SMB2create code.

Thoughts ?

> For the time being, I think we should apply your shadow_copy_data()
> patches and not my patch that puts the @GMT at the end. That would make
> "allinfo" properly list previous versions against all (reasonably
> recent) versions of samba in SMB2 mode, at the expense of providing a
> not-quite-realistic test for vfs_shadow_copy2.

I need to fix the source3/modules/vfs_snapper.c code first :-).

I'll send a patch to review soon !

More information about the samba-technical mailing list