The Samba-Bugzilla – Bug 12260
smbclient prints the NT_STATUS message to stderr when cli_push fails
Last modified: 2016-09-14 08:17:56 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.