From f71c7a7d378b0514c69be1fc6585dc37b9758e1a Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 24 Jan 2011 15:39:14 -0500 Subject: [PATCH] Prepend "list " to the command logged when "sudo -l command" is used to make it clear that the command was listed, not run. --HG-- branch : 1.7 --- logging.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/logging.c b/logging.c index 610f04571..9d8d5a89e 100644 --- a/logging.c +++ b/logging.c @@ -670,7 +670,10 @@ new_logline(message, serrno) } len += sizeof(LL_ENV_STR) + 2 + evlen; } + /* Note: we log "sudo -l command arg ..." as "list command arg ..." */ len += sizeof(LL_CMND_STR) - 1 + strlen(user_cmnd); + if (ISSET(sudo_mode, MODE_CHECK)) + len += sizeof("list ") - 1; if (user_args != NULL) len += strlen(user_args) + 1; @@ -723,8 +726,11 @@ new_logline(message, serrno) goto toobig; efree(evstr); } - if (strlcat(line, LL_CMND_STR, len) >= len || - strlcat(line, user_cmnd, len) >= len) + if (strlcat(line, LL_CMND_STR, len) >= len) + goto toobig; + if (ISSET(sudo_mode, MODE_CHECK) && strlcat(line, "list ", len) >= len) + goto toobig; + if (strlcat(line, user_cmnd, len) >= len) goto toobig; if (user_args != NULL) { if (strlcat(line, " ", len) >= len || -- 2.40.0