Bug 10083 - Sharing the root folder causes "check_reduced_name: logic error"
Sharing the root folder causes "check_reduced_name: logic error"
Status: NEW
Product: Samba 4.0
Classification: Unclassified
Component: File services
All All
: P5 normal
: ---
Assigned To: Samba QA Contact
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2013-08-13 23:10 UTC by Oussama
Modified: 2013-08-15 10:53 UTC (History)
0 users

See Also:

Example of the Samba log output (32.61 KB, text/plain)
2013-08-13 23:10 UTC, Oussama
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oussama 2013-08-13 23:10:24 UTC
Created attachment 9131 [details]
Example of the Samba log output

If you share the root directory (/) in your server, Samba will not permit you to browse folders deeper than the root directory. So if I for example try to browse "tmp" folder in the root (/) directory, the samba log output will be:

[2013/08/13 23:44:24.543888,  3] smbd/vfs.c:905(check_reduced_name)
  check_reduced_name [tmp] [/]
[2013/08/13 23:44:24.544152,  2] smbd/vfs.c:1020(check_reduced_name)
  check_reduced_name: logic error (t) in resolved_name: tmp

To make it clear: the above error appears on the Samba server when I try to access the above folder from a Samba client (Windows or Linux).

 The reason is that Samba thinks you are trying to access a symbolic link (bug in vfs.c: line 1247). The if statement that produces the above error is:
if (*p != '/') {
	DEBUG(2, ("check_reduced_name: logic error (%c) "
		"in resolved_name: %s\n",

A temporary solution is to permit following symbolic links using (follow symlinks = yes), in my case it becomes:

I have also attached an example Samba log output
path = /
comment = sysRoot
valid users = server
write list = server
admin users = server
read only = no
available = yes
browseable = yes
writable = yes
guest ok = no
public = yes
printable = no
locking = no
strict locking = no
follow symlinks = yes

Using the above example, the bug appears because the if statement in line 1247 searches for a "/" that separates the "conn_rootdir" directory and the "tmp" folder, but since the "conn_rootdir" is "/" in our case, there is no separating "/" in the path. The whole path (resolved_name) is "/tmp" and thus the *p will point on "t", and thus the test (the if statement) will fail.

But, if the "conn_rootdir" was "/srv/sharedFolder" we would have had an extra appended "/" separating it from the folder name "tmp", like this:
and the *p would have pointed on the "/" (and the test will then pass)

I hope I managed to describe the bug...

To remove the bug, I suggest modifying the if statement like this:

if (*p != '/' && conn_rootdir!='/') {
	DEBUG(2, ("check_reduced_name: logic error (%c) "
		"in resolved_name: %s\n",

Please note that I didn't test the above solution myself, but I think there are no other places to correct in the code that are related to this error.

Thank you
Comment 1 Jeremy Allison 2013-08-14 23:57:20 UTC
I'll take a look at this, but please note sharing out the root directory is a rare use-case :-).


Comment 2 Oussama 2013-08-15 10:53:30 UTC
thank you

Yes you are right :) but my brother uses Windows so he wanted an easy way to access the server root (so he do not need to SSH etc...). It is a home server, otherwise I would have thought more about security.. especially because he has admin rights..