Samba from SVN can not store dos attributes into extattr under FreeBSD. This appeared after appling patch from bugzilla report #3218 3.0.20b without patch works OK, with patch works as described below. I make sure that "store dos attributes = yes" with testparm. ... [share] comment = Test Share path = /shared read only = No store dos attributes = Yes ... There is a file in the share: -rwxr--r-- 1 root wheel 0 15 ноя 14:07 1.txt root@testbsd# getextattr user DOSATTRIB 1.txt 1.txt 0x22 (File is Archive & Hidden) From WinXP computer: C:\Program Files\Far>attrib V:\4\1.txt A V:\4\1.txt i.e. file attributes was gotten from permission bits (not eas). In level 10 log: [2005/11/15 14:12:12, 1] smbd/dosmode.c:get_ea_dos_attribute(200) get_ea_dos_attributes: Cannot get attribute from EA on file .: Error = Result too large
Created attachment 1571 [details] Level 10 Log of executing attrib V:\4\1.txt
It's strange but smbclient shows correct attributes: root@testbsd# smbclient //localhost/share -U rc20 Password: Domain=[TESTD] OS=[Unix] Server=[Samba 3.0.21pre3-SVN-build-11729] smb: \> ls 4/1.txt 1.txt AH 0 Tue Nov 15 14:07:28 2005 33874 blocks of size 262144. 10513 blocks available
Ok - this is the code that got added in that bug report (#3218). /* + * The BSD implementation has a nasty habit of silently truncating + * the returned value to the size of the buffer, so we have to check + * that the buffer is large enough to fit the returned value. + */ + retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0); + if(retval > size) { + errno = ERANGE; + return -1; + } + We are calling : sizeret = SMB_VFS_GETXATTR(conn, path, SAMBA_XATTR_DOS_ATTRIB, attrstr, sizeof(attrstr)); Where attrstr is defined as an fstring (256 bytes). What I need from you is additional debug statements in your lib/system.c code in the FreeBSD specific part that prints out what retval and size in the above call. Then we need to figure out why 256 bytes isn't enough for FreeBSD to store the string "0x22" in an EA. Jeremy.
(In reply to comment #3) > Ok - this is the code that got added in that bug report (#3218). > + retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0); > > + if(retval > size) { > + errno = ERANGE; > + return -1; > + } > + Looking again on this code I see that it misses check against retval < 0 - which in this case can give that (retval > size). It's my fault, I was concentrated on setxattr() code and missed retval check for this part of the functions. Alex, can you put something like: retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0); if(retval < 0) { DEBUG(1, ("extattr_get_file error: %s\n", strerror(errno)); return -1; } if(retval > size) { Hope, it'll help to figure out, why -1 is returned... With regards, Timur.
Created attachment 1574 [details] Level 10 log after appliing patch (In reply to comment #4) > Alex, can you put something like: > > retval = extattr_get_file(path, attrnamespace, attrname, NULL, 0); > > if(retval < 0) { > DEBUG(1, ("extattr_get_file error: %s\n", strerror(errno)); > return -1; > } > > if(retval > size) { > > Hope, it'll help to figure out, why -1 is returned... I've added this code. Now attrib shows correct attributes: C:\>attrib V:\4\1.txt A S V:\4\1.txt alex@testbsd$ getextattr user DOSATTRIB /shared/4/1.txt /shared/4/1.txt 0x24 -rwxr--r-- 1 root wheel 0 15 ноя 14:07 /shared/4/1.txt Level 10 log attached.
This problem does not appear in SVN build 11739. Thanks!
(In reply to comment #6) > This problem does not appear in SVN build 11739. > Thanks! > Hi Alex! Can you try attached patch? It's supposed to do the same staff, just a bit more sane. Jerremy, can yo uapply it later on if alex confirm it works ok for him?
Created attachment 1586 [details] Additional sanity checks for FreeBSD EA emulation
Ok, I'll apply it once it gets the ok. Jeremy.
Created attachment 1587 [details] Level 10 log after last patch Hello Timur, Jeremy! After last patch from Timur storing dos attributes to EAs works OK. I've attached level 10 Log to illustrate this. Thanks again!
Applied thanks. Jeremy.