Bug 12804 - vfs_catia mixes up pathnames and extended attribute names.
Summary: vfs_catia mixes up pathnames and extended attribute names.
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-24 18:35 UTC by Jeremy Allison
Modified: 2017-06-02 07:56 UTC (History)
1 user (show)

See Also:


Attachments
Proposed patch for master. (2.20 KB, patch)
2017-05-24 23:25 UTC, Jeremy Allison
no flags Details
Correct patch for master. (3.34 KB, patch)
2017-05-25 00:12 UTC, Jeremy Allison
no flags Details
git-am fix for 4.6.next, 4.5.next. (3.48 KB, patch)
2017-05-26 21:36 UTC, Jeremy Allison
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2017-05-24 18:35:35 UTC
Some VFS functions in vfs_catia incorrectly do name conversion on EA names, not on pathnames. These are:

catia_getxattr
catia_removexattr
catia_setxattr

Fix to follow. The fact that no one has noticed this so far tells me this isn't a critical bug fix :-).
Comment 1 Jeremy Allison 2017-05-24 23:25:45 UTC
Created attachment 13234 [details]
Proposed patch for master.

I think this patch is correct, but when I run make test I get:

[662(3562)/2096 at 53m10s] samba3.vfs.fruit metadata_netatalk(nt4_dc)
smbtorture 4.7.0pre1-DEVELOPERBUILD
Using seed 1495656277
UNEXPECTED(failure): samba3.vfs.fruit metadata_netatalk.copyfile(nt4_dc)
REASON: Exception: Exception: ../source4/torture/vfs/fruit.c:2626: status was NT_STATUS_OBJECT_NAME_NOT_FOUND, expected NT_STATUS_OK: FSCTL_SRV_COPYCHUNK
UNEXPECTED(failure): samba3.vfs.fruit metadata_netatalk.rename_dir_openfile(nt4_dc)
REASON: Exception: Exception: ../source4/torture/vfs/fruit.c:2843: status was NT_STATUS_OBJECT_NAME_COLLISION, expected NT_STATUS_OK: smb2_create dir
Enabling AAPL
Comparing returned AAPL capabilities
Preparing file
Issue find
Checking find response with enriched macOS metadata
UNEXPECTED(failure): samba3.vfs.fruit metadata_netatalk.readdir_attr with names with illegal ntfs characters(nt4_dc)
REASON: Exception: Exception: ../source4/torture/vfs/fruit.c:3921: d[i].id_both_directory_info.name.s was stream_names.txt, expected test\uf022aapl: bad name
envlog: SMBD LOG of: LOCALNT4DC2
fsctl_srv_copychunk_vfs_done: copy chunk failed [NT_STATUS_OBJECT_NAME_NOT_FOUND] chunk [0] of [0]

command: /home/jeremy/src/samba/git/master/bin/smbtorture  $LOADLIST --configfile=$SMB_CONF_PATH --option='fss:sequence timeout=1' --maximum-runtime=$SELFTEST_MAXTIME --basedir=$SELFTEST_TMPDIR -
expanded command: /home/jeremy/src/samba/git/master/bin/smbtorture  $LOADLIST --configfile=/home/jeremy/src/samba/git/master/st/client/client.conf --option='fss:sequence timeout=1' --maximum-runt
ERROR: Testsuite[samba3.vfs.fruit metadata_netatalk(nt4_dc)]
REASON: Exit code was 1

I took a look at test_readdir_attr_illegal_ntfs() and found the names:

3832         const char *name = "test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */
3833         const char *fname = BASEDIR "\\test" "\xef\x80\xa2" "aapl"; /* "test:aapl" */

which I'm assuming the catia module should be mangling. I have no clue what this test is trying to do unfortunately. Ralph, can you take a look and let me know what is going wrong ?

Thanks,

Jeremy.
Comment 2 Jeremy Allison 2017-05-25 00:12:49 UTC
Created attachment 13235 [details]
Correct patch for master.

Never mind - figured it out. Catia wants to mangle
both the pathname *AND* the EA name.

That's fucked up !

It also means that strictly speaking we need to
demangle all EA names returned by catia_listxattr()
which we don't currently do.

Anyway, here is a working patch for bug:

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

which passes make test. Please review and push
if you're happy. It's still missing the listxattr
demangling, but it's no worse than we currently
do :-(.

Cheers,

        Jeremy.
Comment 3 Jeremy Allison 2017-05-26 21:36:06 UTC
Created attachment 13240 [details]
git-am fix for 4.6.next, 4.5.next.

Cherry-picked from master.
Comment 4 Ralph Böhme 2017-05-27 04:56:12 UTC
Reassigning to Karolin for inclusion in 4.5 and 4.6.
Comment 5 Karolin Seeger 2017-05-30 10:18:49 UTC
(In reply to Ralph Böhme from comment #4)
Pushed to autobuild-v4-{6,5}-test.
Comment 6 Karolin Seeger 2017-06-02 07:56:13 UTC
(In reply to Karolin Seeger from comment #5)
Pushed to both branches.
Closing out bug report.

Thanks!