Bug 15075 - smbclient -E doesn't work as advertised
Summary: smbclient -E doesn't work as advertised
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Tools (show other bugs)
Version: 4.15.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Jule Anger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-24 08:30 UTC by Noel Power
Modified: 2022-06-13 06:56 UTC (History)
1 user (show)

See Also:


Attachments
backport for 4.16 (4.89 KB, patch)
2022-05-24 12:35 UTC, Noel Power
asn: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Noel Power 2022-05-24 08:30:11 UTC
following the report in

https://lists.samba.org/archive/samba/2022-May/240571.html

it appears that invoking smbclient with '-E'

     -E, --stderr            Write messages to stderr instead of stdout

isn't working as expected as can be seen with the following examples


SAMBA v4.12.15
----------------


PASSWD=1234 ./bin/smbclient  \\\\192.168.100.15\\C\$ -UAdministrator  -E -d 1 -c tarmode\ full -mSMB3 -Tc - MyShare > foo.tar
tarmode is now full, system, hidden, noreset, noverbose
tar: dumped 4 files and 6 directories
Total bytes written: 1265943 (22.1 MiB/s)


tail -3 foo.tar

/Iӧ�W��.#�h./MyShare/icacls/oi_dir/000755 000000 000000 00000000000 13705601676 013447 5ustar00000000 000000 ./MyShare/icacls/oi_dir/file1.rtf000644 000000 000000 00000000007 13705601641 015151 0ustar00000000 000000 {\rtf1}./MyShare/icacls/oi_dir/nested/000755 000000 000000 00000000000 13705601741 014722 5ustar00000000 000000 ./MyShare/icacls/oi_dir/nested/file2.txt000644 000000 000000 00000000000 13705601711 016447 0ustar00000000 000000 ./MyShare/icacls/oi_dir/nested/nested_again/000755 000000 000000 00000000000 13705601752 017345 5ustar00000000 000000 ./MyShare/icacls/oi_dir/nested/nested_again/file3.txt000644 000000 000000 00000000000 13705601750 021074 0ustar00000000 000000

tar -tf foo.tar 
./MyShare/
./MyShare/icacls/
 etc. etc.


SAMBA v4.15.5
----------------


./bin/smbclient --version
Version 4.15.5


./bin/smbclient  \\\\192.168.100.15\\C\$ -UAdministrator  -E -d 1 -c tarmode\ full -mSMB3 -Tc - MyShare > foo.tar



tail -3 foo.tar 
tarmode is now full, system, hidden, noreset, noverbose
tar: dumped 4 files and 0 directories
Total bytes written: 1265943 (20.1 MiB/s)

Note the smbclient tar summary output appended to the archive

tar -tf foo.tar 
./MyShare/
./MyShare/icacls/
 etc. etc.

Note: tar isn't really 'corrupted' it still works (due to this content coming after the end of archive marker) but presumably at other debug levels contents could be corrupted
Comment 1 Noel Power 2022-05-24 08:32:11 UTC
this is since changes to migrate smbclient to new cmdline parser, treatment of '-E' was lost (commit e4474ac0a540c56548b4d15e38f2e234455e19b6)
Comment 2 Noel Power 2022-05-24 08:38:33 UTC
(In reply to Noel Power from comment #0)
>SAMBA v4.15.5
>----------------
[...]
>./bin/smbclient  \\\\192.168.100.15\\C\$ -UAdministrator  -E -d 1 -c tarmode\ full -mSMB3 -Tc - MyShare > foo.tar

should have read

PASSWD=1234 ./bin/smbclient  \\\\192.168.100.15\\C\$ -UAdministrator  -E -d 1 -c tarmode\ full -mSMB3 -Tc - MyShare > foo.tar
Comment 3 Samba QA Contact 2022-05-24 10:30:11 UTC
This bug was referenced in samba master:

5b6493043fc90a2bed5aaedad3b4511621d0b9fd
56e179817123b40c3646476563d345d8f97efff9
Comment 4 Noel Power 2022-05-24 12:35:43 UTC
Created attachment 17304 [details]
backport for 4.16
Comment 5 Noel Power 2022-05-25 08:15:21 UTC
reassign to Jule for inclusion in 4.16
Comment 6 Jule Anger 2022-05-30 07:34:09 UTC
Pushed to autobuild-v4-16-test.
Reviewed-by tag added.
Comment 7 Samba QA Contact 2022-05-30 09:11:11 UTC
This bug was referenced in samba v4-16-test:

239e0759db3d3b52ff78b326b779635900b7551e
e3de2bdb8590684dfffa9974f1b45a571845e72b
Comment 8 Jule Anger 2022-05-30 10:40:20 UTC
Closing out bug report.

Thanks!
Comment 9 Samba QA Contact 2022-06-13 06:56:10 UTC
This bug was referenced in samba v4-16-stable (Release samba-4.16.2):

239e0759db3d3b52ff78b326b779635900b7551e
e3de2bdb8590684dfffa9974f1b45a571845e72b