Bug 12165 - smbclient allinfo doesn't correctly return 'previous version' info over SMB1
Summary: smbclient allinfo doesn't correctly return 'previous version' info over SMB1
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Blocks: 12166
  Show dependency treegraph
Reported: 2016-08-18 18:40 UTC by Jeremy Allison
Modified: 2016-08-29 02:47 UTC (History)
3 users (show)

See Also:

git-am fix for 4.5.0 (63.61 KB, patch)
2016-08-24 23:31 UTC, Jeremy Allison
no flags Details
git-am fix for 4.5.0 (63.25 KB, patch)
2016-08-25 18:05 UTC, Uri Simchoni
jra: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2016-08-18 18:40:19 UTC
From samba-technical:

Found the problem. For SMB1 we need to call cli_shadow_copy_data()
*TWICE* in order for a Windows server to return results. Once with
bool get_names = false, in order to send the max_data_return as
16, which somehow primes the server to expect the second call,
with max_data_return of CLI_BUFFER_SIZE, which then correctly
fetches the data.

This is a Windows SMB1 bug - I'm guessing they never tested the
SMB1 server with a client that just tried a large enough value
to start with to prevent a round trip and their client always
does the '16' followed by whatever that returned.

The Windows SMB2 server works correctly though with one call with a
large enough value.

We still have the problem that when we create the paths previous
versions path to query the SMB1 server returns NT_STATUS_OBJECT_PATH_NOT_FOUND,
due to the fact we're not setting the flags2 FLAGS2_REPARSE_PATH
bit in the request when we're doing the path query. We don't
currently have capabilities to do that, so I'm going to create
another bug and add create fixes for all these things.
Comment 1 Jeremy Allison 2016-08-24 23:31:46 UTC
Created attachment 12398 [details]
git-am fix for 4.5.0

Cherry-picked from master
Comment 2 Uri Simchoni 2016-08-25 18:05:14 UTC
Created attachment 12403 [details]
git-am fix for 4.5.0

Adding one missing BUG: marker and fixing one (bug URL without "BUG:")
Comment 3 Jeremy Allison 2016-08-25 18:44:44 UTC
Comment on attachment 12403 [details]
git-am fix for 4.5.0

Thanks for the tidyup. LGTM.
Comment 4 Jeremy Allison 2016-08-25 18:45:02 UTC
Reassigning to Karolin for inclusion in 4.5.0.
Comment 5 Stefan Metzmacher 2016-08-28 16:12:49 UTC
Pushed to autobuild-v4-5-test.
Comment 6 Stefan Metzmacher 2016-08-29 02:47:41 UTC
Pushed to v4-5-test.