On 9/28/22 07:35, Erich E. Hoover wrote:
+/* decode the xattr-stored DOS attributes */ +static int get_file_xattr( char *hexattr, int attrlen ) +{
- if (attrlen > 2 && hexattr[0] == '0' && hexattr[1] == 'x')
- {
hexattr[attrlen] = 0;
return strtol( hexattr+2, NULL, 16 ) & XATTR_ATTRIBS_MASK;
- }
- return 0;
+}
I don't know where this comes from (I guess Erich does?), but this doesn't seem to match what my Samba server does:
whatsit@camazotz:~/vmshare$ attr -q -g DOSATTRIB test-file | xxd -g4 00000000: 00000400 04000000 11000000 21000000 ............!... 00000010: 00000000 00000000 c27bfa02 65c8d801 .........{..e...
I'm not sure where the first four bytes come from (it may be worth asking the Samba folks about that), but the rest seems to be from the xattr_DosInfo structure at [1].
(As an interesting side note, it seems that Samba already has a system for storing extended attributes using xattr.)
[1] https://git.samba.org/samba.git/?p=samba.git;a=blob;f=librpc/idl/xattr.idl