]> granicus.if.org Git - sudo/commitdiff
Prepend "list " to the command logged when "sudo -l command" is
authorTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 24 Jan 2011 20:39:14 +0000 (15:39 -0500)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Mon, 24 Jan 2011 20:39:14 +0000 (15:39 -0500)
used to make it clear that the command was listed, not run.

--HG--
branch : 1.7

logging.c

index 610f0457195ce51aa952e9f1334032584a1649a1..9d8d5a89e7b999a05fdab3b4cb0b4067163e1b72 100644 (file)
--- 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 ||