sudo -l cmd arg
is broken · Issue #249 · sudo-project/sudo (original) (raw)
Given this entry:
nobody ALL = (root) NOPASSWD: /usr/bin/ping xxx
As nobody
: sudo -l
shows the command, but sudo -l /usr/bin/ping xxx
fails; with debug output one can see this line:
user command "/usr/bin/ping /usr/bin/ping xxx" matches sudoers command "/usr/bin/ping xxx": false @ command_matches() ../../../plugins/sudoers/match_command.c:892
The handling for the list
pseudo command prefixes the target command array with "list"
; it adds a special case to extract the target binary at the new offset, but when there are arguments in sudoers to check it tries to match the arguments in the sudoers against the command arguments
concatentation (which obviously fails).
sudo -l /usr/bin/ping xxx
works when adding this entry:
nobody ALL = (root) NOPASSWD: /usr/bin/ping /usr/bin/ping xxx
Probably broken since a514a6e, but testing without install/suid got harder after -U
was broken (#248), so I didn't bisect it.
Using tons of global vars without clear semantics (and #define
ing normal looking var names into a global struct) and lots of special paths depending in which mode you run is just horrible.
I'm certainly looking for alternatives now, because I quite frankly think this implementation is doomed.