Save the initial command run via sudo and use it when logging exit status.

Otherwise, if we are in intercept mode or logging sub-commands the
exit status will be logged with the wrong command.
This commit is contained in:
Todd C. Miller
2022-06-30 11:10:43 -06:00
parent 3badff39ca
commit 885abf48d7
5 changed files with 33 additions and 12 deletions

View File

@@ -103,6 +103,7 @@ struct sudo_user {
char *cmnd_args;
char *cmnd_base;
char *cmnd_safe;
char *cmnd_saved;
char *class_name;
char *krb5_ccname;
struct gid_list *gid_list;
@@ -245,6 +246,7 @@ struct sudo_user {
#define user_srunhost (sudo_user.srunhost)
#define user_ccname (sudo_user.krb5_ccname)
#define safe_cmnd (sudo_user.cmnd_safe)
#define saved_cmnd (sudo_user.cmnd_saved)
#define cmnd_fd (sudo_user.execfd)
#define login_class (sudo_user.class_name)
#define runas_pw (sudo_user._runas_pw)