Bug 12260 - smbclient prints the NT_STATUS message to stderr when cli_push fails
Summary: smbclient prints the NT_STATUS message to stderr when cli_push fails
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: libsmbclient (show other bugs)
Version: 4.2.10
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Samba QA Contact
QA Contact: Samba QA Contact
Depends on:
Reported: 2016-09-13 15:31 UTC by Joshua Megerman
Modified: 2016-09-14 08:17 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Joshua Megerman 2016-09-13 15:31:54 UTC
When using smbclient to put a file on a remote system, if cli_push fails in do_put (my specific case is when the destination disk is full) the status message is printed to stderr rather than stdout, like it is for every other status message.  As a result, scripts calling smbclient and only capturing stdout are unable to see the message and may interpret the command as being successful rather than failing.

The specific line in question is line 1953 of the file source3/client/client.c:

 d_fprintf(stderr, "cli_push returned %s\n", nt_errstr(status));

All other error messages use d_printf() rather than d_fprintf(), sending the messages to stdout.

I believe the simple fix would be to change the line to:

 d_printf("cli_push returned %s\n", nt_errstr(status));

which would bring it in line with the other error messages printed by smbclient.