The Samba-Bugzilla – Bug 10038
Enhance 'net' command to exit with mapped error codes.
Last modified: 2018-10-09 06:32:04 UTC
In order to trap exact NT_STATUS error code of a 'net' command from inside a process, it is beneficial to make 'net' command exit with a mapping error code instead of just returning status.
Currently 'net' command emits detailed error code but this is done either to a debug log file or to the stdout depending on the configuration.
In order to get this specific NT_STATUS error code one has to parse the file or the stdout, looking for a specific string like "Failed to join.." etc.
This becomes clumsy or break in case the error string changed later.
It would be good if we make 'net' command exit with specific mapped error codes so that programs using 'net' can capture error condition in a better way in a SIGCHLD handler.
(In reply to ravindra from comment #0)
Have you tested on latest samba-4.7.1-9.el7_5.x86_64
# net ads join -U <> -d 10
password: Entered wrong password
Failed to join domain: failed to lookup DC info for domain 'ATEST' over rpc: The attempted logon is invalid. This is either due to a bad username or authentication information.
return code = -1