Bug 9992 - Windows error 0x800700FE when copying files with xattr names containing ":"
Windows error 0x800700FE when copying files with xattr names containing ":"
Status: ASSIGNED
Product: Samba 4.0
Classification: Unclassified
Component: File services
4.0.7
All All
: P5 normal
: ---
Assigned To: Andrew Bartlett
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-07-03 01:13 UTC by Justin Maggard
Modified: 2013-08-08 08:57 UTC (History)
1 user (show)

See Also:


Attachments
git-am patchset for master. (26.50 KB, patch)
2013-07-16 19:06 UTC, Jeremy Allison
no flags Details
git-am fix for 4.0.x (27.03 KB, patch)
2013-08-01 21:13 UTC, Jeremy Allison
abartlet: review+
Details
git-am fix for 3.6.x (20.46 KB, patch)
2013-08-02 19:47 UTC, Jeremy Allison
jra: review? (abartlet)
Details
git-am patchset for 4.1.0. (26.37 KB, patch)
2013-08-05 19:02 UTC, Jeremy Allison
abartlet: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Maggard 2013-07-03 01:13:45 UTC
When you add Finder Comments to a file over AFP when using Netatalk with xattr support enabled, you end up with xattr's named "com.apple.metadata:kMDItemFinderComment".  These xattrs prevent you from copying those files over SMB onto a Windows 7 machine.

Here is a simple reproducer you can do from a Linux machine running Samba:

$ touch foo.bar
$ setfattr -n user.: -v 1 foo.bar

Then try to drag and drop this file from your Samba share onto you Windows desktop.
Comment 1 Jeremy Allison 2013-07-03 19:02:24 UTC
Justin, can you let me know how these get stored on a Windows server that also provides the AFP protocol. That will help me determine if we need to filter them out or do some transform on the name.

I remember MS used to provide an AFP server for Windows, not sure if it's currently maintained or not.

Anyway. won't be able to do much on this until after I get back on Monday 8th.

Cheers,

Jeremy.
Comment 2 Justin Maggard 2013-07-03 19:30:29 UTC
According to Wikipedia, MS AFP support was phased out starting in Win 2k8.  And it looks like it only supported AFP 2.2, which doesn't include xattr support (it was added in AFP 3.2).  Even the 3rd-party AFP server for Windows appears to only support AFP 3.1.

Is there anything else we can do to figure this out?
Comment 3 Jeremy Allison 2013-07-08 23:06:58 UTC
Ok, then what to do is to point the client at a Mac AFP server with xattr support, get the client to generate and store these nasty EA's, then use smbclient to contact the Mac SMB1 server and query all EA's on a file.

See what the Mac SMB server returns for these names (if it returns them at all :-).

Then I'll make Samba do the same thing !

Jeremy.
Comment 4 Justin Maggard 2013-07-09 00:59:57 UTC
How can I make smbclient show xattrs?  I see is the allinfo command, which doesn't seem to list them.  Here's what the OSX SMB server returns to smbclient:

Domain=[VOLUME] OS=[Darwin] Server=[@(#)PROGRAM:smbd  PROJECT:smbx-136.20.1]
smb: \> allinfo Untitled.rtf
altname: 
create_time:    Mon Jul  8 05:29:07 PM 2013 PDT
access_time:    Mon Jul  8 05:37:10 PM 2013 PDT
write_time:     Mon Jul  8 05:29:07 PM 2013 PDT
change_time:    Mon Jul  8 05:30:10 PM 2013 PDT
attributes: A (20)
stream: [::$DATA], 309 bytes
stream: [:AFP_AfpInfo:$DATA], 60 bytes
stream: [:com.apple.metadatakMDItemFinderComment:$DATA], 86 bytes
stream: [:com.apple.metadatakMDLabel_hlsi7t7nerhynemqvydgeb26de:$DATA], 50 bytes


And here's what Samba returns:

Domain=[VOLUME] OS=[Unix] Server=[Samba 4.0.7]
smb: \> allinfo Untitled.rtf
altname: Untitled.rtf
create_time:    Mon Jul  8 05:38:04 PM 2013 PDT
access_time:    Mon Jul  8 05:44:40 PM 2013 PDT
write_time:     Mon Jul  8 05:38:04 PM 2013 PDT
change_time:    Mon Jul  8 05:38:04 PM 2013 PDT
attributes: A (20)
stream: [::$DATA], 309 bytes

I did have the same xattr's on both files; so I suppose OSX is returning them as alternate data streams rather than xattr's.  And it looks like the colons are getting replaced by 0xef 0x80 0xa2 in the stream names.  I did also verify that when I look at the xattr's locally on the Mac using the xattr command, they are indeed colons.
Comment 5 Jeremy Allison 2013-07-09 16:14:53 UTC
smbclient command:

geteas <file>

will show all EA's on a file. So this looks like it might be fixed in netatalk, in that it's not converting the EA's sent via appletalk into Samba-understood streams.

Are you running with the a streams module ?

Jeremy.
Comment 6 Jeremy Allison 2013-07-11 00:41:53 UTC
FYI. I have fixes for this in test right now.

It's fiddlier than you thought :-).

Jeremy.
Comment 7 Jeremy Allison 2013-07-16 19:06:55 UTC
Created attachment 9054 [details]
git-am patchset for master.

Includes full regression test suite and other goodies :-).

Justin, please confirm it fixes the problem for you.

Jeremy.
Comment 8 Jeremy Allison 2013-07-17 23:13:12 UTC
Ping - Justin - is this patch ok for you ? I'd like to get it into 4.0.next (and possibly 3.6.next).

Jeremy.
Comment 9 Justin Maggard 2013-07-18 08:03:35 UTC
Yep, worked for me in my standard test case. :-)
Comment 10 Jeremy Allison 2013-08-01 21:13:33 UTC
Created attachment 9100 [details]
git-am fix for 4.0.x

Patch back-ported to 4.0.x.
Jeremy.
Comment 11 Jeremy Allison 2013-08-02 19:47:51 UTC
Created attachment 9104 [details]
git-am fix for 3.6.x

Not sure if we need this for 3.6.x, but just in case.. :-).

Jeremy.
Comment 12 Jeremy Allison 2013-08-02 19:48:18 UTC
Re-assigning to Karolin for inclusion in 4.0.x, 4.1.0 and (possibly) 3.6.x.
Jeremy.
Comment 13 Karolin Seeger 2013-08-05 18:12:09 UTC
Patch does not apply to current v4-1-test branch:

user@host:/data/git/samba/v4-1-test$ git am 9992-master.patchset 
Applying: Add ea_list_has_invalid_name() function.
Applying: Ensure set_ea cannot set invalid Windows EA names.
Applying: Ensure we never return an EA name to a Windows client it can't handle.
Applying: Ensure we can't create a file using SMB2_CREATE with an invalid EA list.
Applying: Add the ability to send an NTSTATUS result back with a trans2 reply so we can return a parameter block with an error code.
Applying: Add error map of STATUS_INVALID_EA_NAME -> ERRDOS, ERRbadfile
Applying: Ensure we can't create a file using TRANS2_OPEN with an invalid EA list.
Applying: Ensure we can't create a file using NTTRANS with an invalid EA list.
Applying: Ensure we do pathname processing before SD and EA processing in NTTRANS_CREATE.
error: patch failed: source3/smbd/nttrans.c:1164
error: source3/smbd/nttrans.c: patch does not apply
Patch failed at 0009 Ensure we do pathname processing before SD and EA processing in NTTRANS_CREATE.
Comment 14 Jeremy Allison 2013-08-05 19:02:58 UTC
Created attachment 9109 [details]
git-am patchset for 4.1.0.

Sorry Karolin, looks like 4.1 and master diverged due to a fix from Volker.

Here is the 4.1.0 version of the fix.

Jeremy.
Comment 15 Jeremy Allison 2013-08-05 22:46:24 UTC
Re-assigning to Karolin for inclusion in 4.1.0.
Jeremy.
Comment 16 Karolin Seeger 2013-08-07 09:16:25 UTC
(In reply to comment #15)
> Re-assigning to Karolin for inclusion in 4.1.0.
> Jeremy.

Thanks a lot, Jeremy!

Pushed to autobuild-v4-1-test and autobuild v4-0-test.
Not sure about 3.6. Would anyone like to comment on this/review the patch for 3.6?
Comment 17 Karolin Seeger 2013-08-08 08:55:07 UTC
(In reply to comment #16)
> (In reply to comment #15)
> > Re-assigning to Karolin for inclusion in 4.1.0.
> > Jeremy.
> 
> Thanks a lot, Jeremy!
> 
> Pushed to autobuild-v4-1-test and autobuild v4-0-test.
> Not sure about 3.6. Would anyone like to comment on this/review the patch for
> 3.6?

Pushed to v4-1-test and v4-0-test.
Comment 18 Karolin Seeger 2013-08-08 08:57:26 UTC
Re-assigning to Andrew for commenting/reviewing the 3.6 patch.