赵晶
2020-Nov-15 09:00 UTC
[Samba] How to read NTFS ADS (alternate data steams) using libsmbclient?
Hi Samba team, We have a Windows SMB share which contains some files with ADS (alternate data streams). In our client C/C++ code that runs on a Linux client, we want to retrieve the list of ADS of a file and download all the streams, similar to what is provided by smbclient's interactive session (allinfo, get). But as we evaluate libsmbclient (as we'd like to do above in code), we don't find any such API w.r.t ADS. The closest is an API to get extended attributes, which is not ADS. http://mrs.suzu841.com/dox/samba_doxygen/group__libsmbclient.html Is there a way to query/read data streams using libsmbclient? Any suggestion is welcome. Thanks, Jing
Rowland penny
2020-Nov-15 09:48 UTC
[Samba] How to read NTFS ADS (alternate data steams) using libsmbclient?
On 15/11/2020 09:00, ?? via samba wrote:> Hi Samba team, > > We have a Windows SMB share which contains some files with ADS (alternate > data streams). In our client C/C++ code that runs on a Linux client, we > want to retrieve the list of ADS of a file and download all the streams, > similar to what is provided by smbclient's interactive session (allinfo, > get). > > But as we evaluate libsmbclient (as we'd like to do above in code), we > don't find any such API w.r.t ADS. The closest is an API to get extended > attributes, which is not ADS. > > http://mrs.suzu841.com/dox/samba_doxygen/group__libsmbclient.html > > Is there a way to query/read data streams using libsmbclient? Any > suggestion is welcome. > > Thanks, > JingYou might want to look at the code for 'vfs_streams_xattr', not sure if this will help, but it is probably the nearest Samba has to what you are asking. Rowland
Jeremy Allison
2020-Nov-16 02:14 UTC
[Samba] How to read NTFS ADS (alternate data steams) using libsmbclient?
On Sun, Nov 15, 2020 at 09:48:03AM +0000, Rowland penny via samba wrote:>On 15/11/2020 09:00, ?? via samba wrote: >>Hi Samba team, >> >>We have a Windows SMB share which contains some files with ADS (alternate >>data streams). In our client C/C++ code that runs on a Linux client, we >>want to retrieve the list of ADS of a file and download all the streams, >>similar to what is provided by smbclient's interactive session (allinfo, >>get). >> >>But as we evaluate libsmbclient (as we'd like to do above in code), we >>don't find any such API w.r.t ADS. The closest is an API to get extended >>attributes, which is not ADS. >> >>http://mrs.suzu841.com/dox/samba_doxygen/group__libsmbclient.html >> >>Is there a way to query/read data streams using libsmbclient? Any >>suggestion is welcome. >> >>Thanks, >>Jing > >You might want to look at the code for 'vfs_streams_xattr', not sure >if this will help, but it is probably the nearest Samba has to what >you are asking.Actually, that's server-side code, not client. The interface needed for this is in the libcli interface. The call you'd need is: cli_qpathinfo_streams(). libsmbclient uses this interface internally, but the problem is it's not exposed as an external stable ABI (we make changes often at the cli_XXX() layer often so we don't consider this a publised ABI). smbclient can get this information via the 'allinfo pathname' command. Can you shell script that and use output from there ?