Way to tell if smb_fname->base_name is a fully qualified path

Trever L. Adams trever at middleearth.sapphiresunday.org
Wed Nov 30 17:39:27 UTC 2016


On 11/30/2016 10:14 AM, Jeremy Allison wrote:
> On Mon, Nov 28, 2016 at 09:56:04AM -0700, Trever L. Adams wrote:
>> In relation to the clean up work for Samba VirusFilter, a question of
>> supporting streams has come up. I have a solution, but the way of not
>> adding vfs_h->conn->connectpath as a prefix in the case of streams could
>> be buggy and the code is ugly.
>>
>> Is there a flag or some other cheap/clean way to check if the base_name
>> is fully qualified and not relative to the connectpath?
>>
>>     if (strncmp(connectpath, fname, strlen(connectpath)) == 0) {
>>         ...
>>     }
>>
>> is the way I am doing it, but that is very ugly. If some administrator
>> has path names that contain the same prefixes in multiple places, this
>> may also be buggy.
> Can you explain more what the exact problem is ? What pathnames
> are you seeing that are fully qualified ?
>
With most files, the virus filter code has to prepend the connectpath.
With streams_depot the connectpath appears to be already prepended, in
the case of the default setting for where the streams are stored. I am
aware it can be outside the connectpath, which is one reason I need to
fix the above.

In the case of smb_fname->base_name (fname above) with streams_depot,
when one is working with the non-default stream, contains a fully
qualified path. In other words, with the default streams_depot setting,
you end up with something like this:

Actual file: /CONNECTPATH/.streams/0F/17/02FD000000000000EF005C0400000000/:attached.txt:$DATA: Eicar-Test-Signature
Appending connect path: /CONNECTPATH//CONNECTPATH/.streams/0F/17/02FD000000000000EF005C0400000000/:attached.txt:$DATA
When not a stream and appending connect path: /CONNECTPATH/actualfile.txt

Is there any way to tell easily when one needs to prepend the connect
path and when one doesn't?

Thank you.
Trever
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 872 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20161130/32c2d583/signature.sig>


More information about the samba-technical mailing list