Bug 14174 - cli_RNetShareEnum() called on a SMB2 connection from SMBC_opendir_ctx
Summary: cli_RNetShareEnum() called on a SMB2 connection from SMBC_opendir_ctx
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.10.9
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Blocks: 14176
  Show dependency treegraph
Reported: 2019-10-28 18:04 UTC by Elia Geretto
Modified: 2019-11-19 08:48 UTC (History)
3 users (show)

See Also:

Stack trace that shows when the error message is printed (2.63 KB, text/plain)
2019-10-28 18:04 UTC, Elia Geretto
no flags Details
git-am fix for master. (2.31 KB, patch)
2019-10-29 22:16 UTC, Jeremy Allison
no flags Details
git-am fix for 4.11.next, 4.10.next. (2.53 KB, patch)
2019-10-30 23:10 UTC, Jeremy Allison
asn: review+
jra: review? (slow)

Note You need to log in before you can comment on or make changes to this bug.
Description Elia Geretto 2019-10-28 18:04:51 UTC
Created attachment 15573 [details]
Stack trace that shows when the error message is printed

While debugging a printing issue in GNOME Control Center, I encountered the following error message in the system log:

smb1cli_req_writev_submit: called for dialect[SMB2_10] server[abc.xyz]

I am attaching the relevant stack trace to this bug report.

It appears that the issue is related to the following lines: https://gitlab.com/samba-team/samba/blob/master/source3/libsmb/libsmb_dir.c#L858-863

The protocol version is checked only against the one specified in the configuration file and not against the one that was negotiated during the session. So, when contacting a SMB2-only server, if the client supports NT1, that will be tried as well, leading to the error message.

This problem is similar to the one described in bug 14152 apparently.
Comment 1 Jeremy Allison 2019-10-29 17:47:00 UTC
Ah - completely correct. We missed this one in libsmbclient. I'll prepare a fix.
Comment 2 Jeremy Allison 2019-10-29 22:16:26 UTC
Created attachment 15577 [details]
git-am fix for master.

Fix I've submitted as a merge request.
Comment 3 Elia Geretto 2019-10-30 09:24:43 UTC
You may want to take a look at bug 14176 as well, it is related to the same code region and is masked by this bug. It's the bug I was actually looking for.
Comment 4 Jeremy Allison 2019-10-30 23:10:57 UTC
Created attachment 15589 [details]
git-am fix for 4.11.next, 4.10.next.

Cherry-picked from master.
Comment 5 Jeremy Allison 2019-11-06 23:55:12 UTC
Comment on attachment 15589 [details]
git-am fix for 4.11.next, 4.10.next.

Andreas, can you RB+ this one ? It's required before I can back-port the bug fix for:

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

which has already gone into master. Thanks !

Comment 6 Andreas Schneider 2019-11-12 11:25:33 UTC
Karolin, could you please apply the patches to the relevant branches? Thanks!
Comment 7 Karolin Seeger 2019-11-13 07:40:21 UTC
(In reply to Andreas Schneider from comment #6)
Pushed to autobuild-v4-{11,10}-test.
Comment 8 Karolin Seeger 2019-11-19 08:48:25 UTC
(In reply to Karolin Seeger from comment #7)
Pushed to both branches.
Closing out bug report.