Bug 13585 - Unable to create file/directory under root of the share due to empty dirpath during get_real_filename()
Unable to create file/directory under root of the share due to empty dirpath ...
Status: RESOLVED FIXED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services
4.9.0rc3
All All
: P5 normal
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-08-20 23:42 UTC by Anoop C S
Modified: 2018-09-06 07:11 UTC (History)
2 users (show)

See Also:


Attachments
"comprehensive" fix for master. (4.70 KB, patch)
2018-08-21 23:57 UTC, Jeremy Allison
no flags Details
git-am fix for 4.9.next, 4.8.next, 4.7.next. (1.19 KB, patch)
2018-08-22 20:56 UTC, Jeremy Allison
jra: review? (obnox)
ira: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anoop C S 2018-08-20 23:42:16 UTC
With GlusterFS as the backend(using vfs_glusterfs) file system, file/directory creation under root of the share no longer works and returns error. `smbclient` returns NT_STATUS_INVALID_PARAMETER as follows:

# smbclient \\\\<IP>\\<share> -U user%passwd
Try "help" to get a list of possible commands.
smb: \> mkdir testdir
NT_STATUS_INVALID_PARAMETER making remote directory \testdir

Additional info:
This happened when GlusterFS introduced a missing emptiness check[1] on incoming path recently while doing a getxattr as part of get_real_filename() from Samba. Even though parent_dirname() inside check_parent_exists() correctly fills '.' into dirpath it failed to update dirpath while returning from check_parent_exists() when file/directory name does not contain a '/'

see https://lists.samba.org/archive/samba-technical/2018-August/129733.html for discussions.

[1] http://git.gluster.org/cgit/glusterfs.git/commit/?id=febee007bb1a99d65300630c2a98cbb642b1c8dc
Comment 1 Jeremy Allison 2018-08-21 23:57:57 UTC
Created attachment 14441 [details]
"comprehensive" fix for master.

Complete fix - note I'm not proposing this at present as it's too big a change for this specific bug, but I think it's ultimately the correct change we might go with later so I want to record it here so I don't lose it.

A different smaller fix was proposed to samba-technical which I'll back-port once it goes in.
Comment 2 Jeremy Allison 2018-08-22 20:56:40 UTC
Created attachment 14442 [details]
git-am fix for 4.9.next, 4.8.next, 4.7.next.
Comment 3 Jeremy Allison 2018-08-22 20:56:58 UTC
Comment on attachment 14442 [details]
git-am fix for 4.9.next, 4.8.next, 4.7.next.

Cherry-picked from master.
Comment 4 Jeremy Allison 2018-08-23 18:12:14 UTC
Re-assigning to Karolin for inclusion in 4.9.next, 4.8.next, 4.7.next.

(Karolin please ignore the "comprehensive" attachment and just push the git-am fixes, that's only a place for me to record the extra patch).
Comment 5 Karolin Seeger 2018-08-28 08:56:24 UTC
(In reply to Jeremy Allison from comment #4)
Pushed to autobuild-v4-9-test and autobuild-v4-8-test, but the patch does not apply on current v4-7-test branch.
Re-assigning to Jeremy.
Comment 6 Jeremy Allison 2018-08-28 17:43:03 UTC
Karolin, can you check again on the 4.7.x branch.

In my v4-7-test branch I did a git update --rebase and got to:

b9b4e96dc4ae0d445f73eaf8d48579bba0c29cfe

commit b9b4e96dc4ae0d445f73eaf8d48579bba0c29cfe (origin/v4-7-test)
Author: Karolin Seeger <kseeger@samba.org>
Date:   Mon Aug 27 09:51:59 2018 +0200

    VERSION: Bump version up to 4.7.9...
    
    and re-enable GIT_SNAPSHOT.
    
    Signed-off-by: Karolin Seeger <kseeger@samba.org>

and then git a git-am of attachment 14442 [details]:

git am /tmp/0001-s3-smbd-Ensure-get_real_filename-copes-with-empty-pa.patch

and it applied cleanly, leaving me with:

commit f234bf25a8bec7c7793716b8c1910e0ec83531e8 (HEAD -> v4-7-test)
Author: Jeremy Allison <jra@samba.org>
Date:   Tue Aug 21 12:05:34 2018 -0700

    s3: smbd: Ensure get_real_filename() copes with empty pathnames.
    
    Needed for vfs_glusterfs, as Gluster requires "." not '\0'.
    
    Based on a fix from Anoop C S <anoopcs@redhat.com>
    
    BUG: https://bugzilla.samba.org/show_bug.cgi?id=13585
    
    Signed-off-by: Jeremy Allison <jra@samba.org>
    Reviewed-by: Ira Cooper <ira@samba.org>
    
    Autobuild-User(master): Jeremy Allison <jra@samba.org>
    Autobuild-Date(master): Wed Aug 22 21:50:41 CEST 2018 on sn-devel-144
    
    (cherry picked from commit 9c71f61ed8a31d287d343d4f2e68cb40c57a2b89)

commit b9b4e96dc4ae0d445f73eaf8d48579bba0c29cfe (origin/v4-7-test)
Author: Karolin Seeger <kseeger@samba.org>
Date:   Mon Aug 27 09:51:59 2018 +0200

    VERSION: Bump version up to 4.7.9...
    
    and re-enable GIT_SNAPSHOT.
    
    Signed-off-by: Karolin Seeger <kseeger@samba.org>
Comment 7 Karolin Seeger 2018-08-29 07:32:47 UTC
(In reply to Jeremy Allison from comment #6)
Oh, sorry, you are right.
Pushed to autobuild-v4-7-test.
Comment 8 Karolin Seeger 2018-09-06 07:11:06 UTC
Pushed to all branches.
Closing out bug report.

Thanks!