-
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat unresolvable User_Alias/Host_Alias as non-aliases in JSON output.
This matches the behavior of the sudoers parser. There is no way to tell for sure if an upper case word is an alias or a user or host name. An unresolvable command alias is never a command since it doesn't start with a '/'. GitHub issue #381
- Loading branch information
Showing
3 changed files
with
87 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"Defaults": [ | ||
{ | ||
"Binding": [ | ||
{ "username": "CLI_USR" } | ||
], | ||
"Options": [ | ||
{ "lecture": false } | ||
] | ||
}, | ||
{ | ||
"Binding": [ | ||
{ "hostname": "SUN_HST" } | ||
], | ||
"Options": [ | ||
{ "log_year": true } | ||
] | ||
}, | ||
{ | ||
"Binding": [ | ||
], | ||
"Options": [ | ||
{ "use_pty": false } | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
# | ||
# Test behavior of undefined aliases using --expand-aliases in JSON output. | ||
# https://github.com/sudo-project/sudo/issues/381 | ||
# | ||
|
||
: ${CVTSUDOERS=cvtsudoers} | ||
|
||
$CVTSUDOERS -c "" -f json -e <<EOF | ||
User_Alias CLI_USER = cli | ||
Defaults:CLI_USR !lecture | ||
Host_Alias SUN_HOST = sparc5 | ||
Defaults@SUN_HST log_year | ||
Cmnd_Alias REBOOT = /sbin/halt, /sbin/reboot, /sbin/poweroff | ||
Defaults!REBOT !use_pty | ||
EOF |