Bug 10605 - smbclient TAR omits remainder of directory on access denial.
Summary: smbclient TAR omits remainder of directory on access denial.
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.2.0
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
Depends on:
Reported: 2014-05-12 21:17 UTC by Alan Bowler
Modified: 2015-06-08 16:27 UTC (History)
2 users (show)

See Also:

changes to client.c clitar.c and smbclient.1 (man page) (10.00 KB, application/octet-stream)
2014-05-12 21:17 UTC, Alan Bowler
no flags Details
Original patch rebased to Samba 4.1.6 (5.52 KB, patch)
2015-05-28 07:00 UTC, Aurimas Fišeras
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Bowler 2014-05-12 21:17:15 UTC
Created attachment 9938 [details]
changes to client.c clitar.c and smbclient.1 (man page)

This cropped up while using smbclient with BackupPC.

We found that if access to a file was denied by Windows,
smbclient would issue an error and stop processing the
rest of the directory.  This became more apparent when
Windows 8.1 started putting "swapfile.sys" at the top level,
and BackupPP never reached /Users (i.e. the likely most important stuff).

I looked around and could see that other people seemed to
have similar problems, but did not find a fix.  (adminstrator
privileges did not cure busy file problems (NT_STATUS_SHARING_VIOLATION).

I have made a fairly simple change for use with backup type
usage where it is very likely that there will always be some
legitimate denials on files.

In "clitar.c" I modified the "tarmode" command to accept
an "errorskip" option.
I also changed function "do_atar" so that when errorskip is
set and an access denial occurs, it issues a message 
and returns NT_STATUS_OK so that clilist() does not
terminate the for loop.

I'm attaching diff files for the changes I made.
Comment 1 Aurimas Fišeras 2015-05-28 07:00:57 UTC
Created attachment 11097 [details]
Original patch rebased to Samba 4.1.6

We have the same problem with BackupPC and Samba >3.5

Attached is the original patch rebased to Samba 4.1.6 (for Samba version present in Ubuntu 14.04 LTS).

We now successfully use BackupPC with the patched Samba.
Comment 2 Jeremy Allison 2015-05-29 18:28:36 UTC
Unfortunately, this code in 4.2 has been completely rewritten (again). I know it's a pain, but can you check and forward port this to 4.2.latest ?

That would be much easier to include this change going forward.


Comment 3 Aurimas Fišeras 2015-05-30 06:59:06 UTC
I compiled Samba from git (Version 4.3.0pre1-DEVELOPERBUILD) – smbclient does not need this patch. It skips files with access problems by default as it did in 3.5.x.

I also checked 4.2.2 – works as it did in 3.5.x.

So, this bug affects only Samba 3.6 – 4.1
Comment 4 Alan Bowler 2015-06-03 18:08:04 UTC
Since Aurimas says that the problem is gone in 4.2
there does not seem to be any point in my trying to
roll the rest of my change (the "errorskip" option
to 4.2.
Comment 5 Jeremy Allison 2015-06-05 23:27:05 UTC
Ok, as it's already fixed in 4.2 I'm going to close this out.

Thanks a lot for your help !

Comment 6 Björn Jacke 2015-06-08 07:26:40 UTC
Jeremy: shouldn't 4.1 bet patched accordingly then?
Comment 7 Jeremy Allison 2015-06-08 16:03:58 UTC
I think 4.2 got a complete clitar rewrite, which might be a bit big to backport.

I'll check.
Comment 8 Björn Jacke 2015-06-08 16:21:28 UTC
I didn't think of a backport from 4.2. I thought of the (not so big) patch that the bug reporter(s) attached here.
Comment 9 Jeremy Allison 2015-06-08 16:27:03 UTC
Yeah, but  that patch is really ugly :-). I'll take a look.