[Samba] smbclient mask command seems not to work the same way with recurse ON for mget and mput

LPC DPG lpcdpg at gmail.com
Tue Aug 25 20:58:31 UTC 2020


Dear all.

I would like to propose a possible way to make mget and mput behave more or
less the same way, rather that just changing documentation. Please, bear in
mind this is a poor attempt coming from a person with no C skills at all,
so other than testing that only filtered files are transferred, I have not
gone further. Hope at least to have been able not to corrupt any pointer,
but I'm not even sure of this...

Well, here I go (thanks a lot Andrew for pointing out
source3/client/client.c), release 4.12.6 (so sorry as this is no patching
syntax, but hope you can figure out what it means):

   2349                         } else {
++   2350                                 if
(mask_match(lname,client_get_fileselection(),false)) {
   2351                                 SAFE_FREE(quest);
   2352                                 if (asprintf(&quest,"Put file %s?
", lname) < 0) {
   2353                                         break;
   2354                                 }
   2355                                 if (prompt && !yesno(quest)) {
   2356                                         /* No */
   2357                                         continue;
   2358                                 }
   2359
   2360                                 /* Yes */
   2361                                 SAFE_FREE(rname);
   2362                                 if (asprintf(&rname, "%s%s",
client_get_cur_dir(), lname) < 0) {
   2363                                         break;
   2364                                 }
++    2365                                 } else {
++    2366                                   continue;
++    2367                                 }
   2368                         }

Does not behave exactly as mget, as it does not report files not matching
the mask, but it was only to see whether this was sufficient to have mput
do what I understood it should do according to the man page for smbclient.

Looking forward reading your remarks.

Many thanks again. Best regards.

El mar., 25 ago. 2020 a las 12:04, LPC DPG (<lpcdpg at gmail.com>) escribió:

> Dear all.
>
> Confirmed: compilation of 4.12.6 produces same result, mput + recurse
> ignores mask for files.
>
> Will you please tell me if you need further details, or which steps I
> should follow? Should I file a bug?
>
> Many thanks. Best regards.
>
> El mar., 25 ago. 2020 a las 9:52, LPC DPG (<lpcdpg at gmail.com>) escribió:
>
>> Dear Andrew.
>>
>> You are right, I should have taken a deeper look into the standard output
>> during compilation. I did just assume source4 was the one for Samba4.
>>
>> Anyway, besides the source confusion (really, even if I had found the
>> right one, following the code would have been out of my reach), I don't
>> seem to find how that is related with the documentation issue, or the
>> mput/mask/recurse commands combination issue.
>>
>> May I ask whether any of you have made the test trying to transfer
>> recursively filtered files?
>>
>> Many thanks. Best regards.
>>
>> El mar., 25 ago. 2020 a las 2:36, Andrew Bartlett (<abartlet at samba.org>)
>> escribió:
>>
>>> On Tue, 2020-08-25 at 00:49 +0200, LPC DPG via samba wrote:
>>> > Dear Jeremy.
>>> >
>>> > Really appreciate you took your time to answer. I had already
>>> > reviewed
>>> > source4/client/client.c looking for mput (cmd_mput) command, but
>>> > unluckily
>>> > saying that my C programming skills are poor woud be really
>>> > overrating them.
>>>
>>> To make things even more confusing, the code in source4/client/client.c
>>> is not the code for the smbclient you are running.  That one is for a
>>> forked copy left over from the samba3/samba4 split, which we don't
>>> install onto the system (but is still used in some testing, so can't be
>>> removed from our git repo).
>>>
>>> The one you are after is in source3/client/client.c
>>>
>>> Sorry!
>>>
>>> Andrew Bartlett
>>>
>>> --
>>> Andrew Bartlett                       https://samba.org/~abartlet/
>>> Authentication Developer, Samba Team  https://samba.org
>>> Samba Developer, Catalyst IT
>>> https://catalyst.net.nz/services/samba
>>>
>>>
>>>
>>>


More information about the samba mailing list