From: Todd C. Miller Date: Mon, 24 Jan 2011 20:39:14 +0000 (-0500) Subject: Prepend "list " to the command logged when "sudo -l command" is X-Git-Tag: SUDO_1_7_5~51 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f71c7a7d378b0514c69be1fc6585dc37b9758e1a;p=sudo 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 --- 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 ||