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.
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.
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?
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.
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.metadatakMDItemFinderComment:$DATA], 86 bytes stream: [:com.apple.metadatakMDLabel_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.
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.
FYI. I have fixes for this in test right now. It's fiddlier than you thought :-). Jeremy.
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.
Ping - Justin - is this patch ok for you ? I'd like to get it into 4.0.next (and possibly 3.6.next). Jeremy.
Yep, worked for me in my standard test case. :-)
Created attachment 9100 [details] git-am fix for 4.0.x Patch back-ported to 4.0.x. Jeremy.
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.
Re-assigning to Karolin for inclusion in 4.0.x, 4.1.0 and (possibly) 3.6.x. Jeremy.
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.
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.
Re-assigning to Karolin for inclusion in 4.1.0. Jeremy.
(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?
(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.
Re-assigning to Andrew for commenting/reviewing the 3.6 patch.
I don't see why this was reassigned to samba-qa now. I'm closing this on Andrew's behalf now because the 3.6 review is no longer needed.