[Samba] smbclient: Tar create to stdout produces a broken tarball

Marc Leuser marc at mleuser.de
Mon May 2 15:23:03 UTC 2022


Hi everybody,

when running "smbclient -Tc -" to get the tarball to stdout, a debug 
message that should be sent to stderr is sent to stdout instead, which 
results in a broken archive. I'm testing version 4.15.2 on Alpine and 
have two commands to reproduce this behaviour:

/usr/bin/smbclient \\\\servername\\C\$ -U Username -E -d 1 -c tarmode\ 
full -mSMB3 -Tc - \\something > smbdump.tar
PASSWD=passwordhere /usr/bin/smbclient \\\\servername\\C\$ -U Username 
-E -d 1 -c tarmode\ full -mSMB3 -Tc - \\something > smbdump.tar

The first one puts "Password for [MYGROUP\Administrator]:" at the 
beginning of the tarball, the second one puts "tarmode is now full, 
system, hidden, noreset, noverbose" and a newline (0x0A). Initially i 
thought it's related to a specific message, but it looks like there are 
at least two of them. Interestingly, when i run the same commands with 
debug levels 0-10, the resulting files are the same. So it appears that 
it's also not just "the first debug message that gets printed".

Since the environment i'm encountering this bug in is Docker-based, i 
was able to quickly hop between versions and was able to narrow the 
scope down to two versions of smbclient i had available. 4.12.15 is 
still working, 4.14.5 has the breakage in it. Another observation is 
that the working version prints several messages to stderr which appear 
on the console, while the broken versions seem to print nothing to 
stderr at all. I've tried sifting through the source code and revisions 
but now i'm a bit lost. The only thing i found was that there seems to 
be no test for this specific case, which explains why it wasn't spotted.

Can someone else confirm this bug? And can somebody with a better 
overview of the codebase maybe spot why it's there?

Best Regards
Marc Leuser


More information about the samba mailing list