Bug 14403 - Cannot rename directory to a single character in the root of a share
Summary: Cannot rename directory to a single character in the root of a share
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.10.4
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2020-06-05 10:52 UTC by Chris
Modified: 2020-07-07 07:03 UTC (History)
2 users (show)

See Also:

raw patch for master. (949 bytes, patch)
2020-06-30 18:57 UTC, Jeremy Allison
no flags Details
git-am fix for 4.12.next, 4.11.next. (2.71 KB, patch)
2020-07-01 19:11 UTC, Jeremy Allison
bjacke: review+
slow: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Chris 2020-06-05 10:52:53 UTC
Using smbclient and libsmbclient on CentOS 7. When trying to rename a directory to a single character name in the root of a share it fails with NT_STATUS_INFO_LENGTH_MISMATCH

smb: \> rename ZZZ Z

The same operation in a subfolder is fine:-

smb: \> rename ZZZ\Test ZZZ\T
Comment 1 Ralph Böhme 2020-06-05 10:58:33 UTC
This work in current master.

Which Samba version are you using? Also, any special smb.conf settings? Please share your smb.conf.
Comment 2 Chris 2020-06-05 12:32:28 UTC
This is the latest version of smbclient available through the CentOS repos.

smbclient -V


Version 4.10.4

yum info samba-client


Name        : samba-client
Arch        : x86_64
Version     : 4.10.4
Release     : 11.el7_8

smb.conf is just defaults.

File server is Windows 2008.
Comment 3 Björn Jacke 2020-06-23 21:05:24 UTC
this does not happen with Samba on the server side but it actually happens with Windows on the server side. Here is smbclient 4.12.2 against Win 7:

smb: \> mkdir ZZZ
smb: \> rename ZZZ Z
smb: \> rename ZZZ ZZ
smb: \>
Comment 4 Jeremy Allison 2020-06-30 18:08:24 UTC
Taking a look at this and it's repeatable, but very strange..

I need to get a trace from a Windows client doing the same thing I think.
Comment 5 Jeremy Allison 2020-06-30 18:57:14 UTC
Created attachment 16100 [details]
raw patch for master.

This fixes the problem here. Looks to me like Windows server has a problem in that it complains if the SMB_FILE_RENAME_INFORMATION buffer size is less than 24 bytes.

I'll take a look in the protocol spec docs to see if this is documented anywhere.
Comment 6 Jeremy Allison 2020-06-30 18:58:23 UTC
(In reply to Björn Jacke from comment #3)

Björn, can you check the patch I just uploaded ? Not sure how to write a test for this as it's a restriction that Windows server seems to have that we don't.
Comment 7 Björn Jacke 2020-06-30 23:07:38 UTC
(In reply to Jeremy Allison from comment #6)
works ! :) (tested with 2012 R2, where it also failed before)
Comment 8 Jeremy Allison 2020-07-01 19:11:38 UTC
Created attachment 16103 [details]
git-am fix for 4.12.next, 4.11.next.

Cherry-pick from master. Applies cleanly to 4.12.next, 4.11.next.
Comment 9 Ralph Böhme 2020-07-01 19:13:45 UTC
Reassigning to Karolin for inclusion in 4.11 and 4.12.
Comment 10 Karolin Seeger 2020-07-03 09:34:15 UTC
(In reply to Ralph Böhme from comment #9)
Pushed to autobuild-v4-{12,11}-test.
Comment 11 Karolin Seeger 2020-07-07 07:03:38 UTC
(In reply to Karolin Seeger from comment #10)
Pushed to both branches.
Closing out bug report.