Bug 816

Summary: Avoid duplicates or wrong entry in sudo -l output
Product: Sudo Reporter: Daniele Palumbo <daniele>
Component: SudoAssignee: Todd C. Miller <Todd.Miller>
Status: NEW ---    
Severity: enhancement CC: daniele
Priority: low    
Version: 1.8.21   
Hardware: All   
OS: All   

Description Daniele Palumbo 2017-12-07 04:05:52 MST
Given the configuration
root@build-jessie-amd64:~# cat /etc/sudoers
Defaults log_output
Defaults !log_output
Defaults log_output
Defaults syslog
Defaults !syslog
Defaults !logfile
Defaults logfile=/var/log/sudo.log
root ALL = NOPASSWD: ALL
daniele ALL = NOPASSWD: ALL
root@build-jessie-amd64:~# 

The following is listed:
root@build-jessie-amd64:~# sudo -l
Matching Defaults entries for root on build-jessie-amd64:
    log_output, !log_output, log_output, syslog, !syslog, !logfile, logfile=/var/log/sudo.log

User root may run the following commands on build-jessie-amd64:
    (root) NOPASSWD: ALL
root@build-jessie-amd64:~# 

Defaults are repeated and last one has to be matched.

- For Defaults that negate the previous one only the latest should be printed.
- For entry that are written multiple time and/or fully overrinding the previous one, only the latest should be printed.