From: Todd C. Miller Date: Thu, 17 Mar 2011 19:48:00 +0000 (-0400) Subject: Expand quoted name checks to cover recent fixes. X-Git-Tag: SUDO_1_8_1~80^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1c0917aa3919bd806efe62e03087a0e8b22031b6;p=sudo Expand quoted name checks to cover recent fixes. --- diff --git a/plugins/sudoers/regress/testsudoers/test2.out b/plugins/sudoers/regress/testsudoers/test2.out index ad7fc3976..8f55faf42 100644 --- a/plugins/sudoers/regress/testsudoers/test2.out +++ b/plugins/sudoers/regress/testsudoers/test2.out @@ -1,9 +1,42 @@ Parses OK. +Defaults@somehost set_home +Defaults@quoted" set_home +Defaults:you set_home +Defaults:us" set_home +Defaults:%them set_home +Defaults:%: non UNIX 0 c set_home +Defaults:+net set_home +Defaults>someone set_home +Defaults>some one set_home +Runas_Alias RA1 = foo +Runas_Alias RA2 = foo" +Runas_Alias RA3 = foo:bar +Runas_Alias RA4 = foo:bar" +User_Alias UA1 = foo +User_Alias UA10 = %:C/non"UNIX"0 c +User_Alias UA11 = %:C/non_UNIX_0 c +User_Alias UA12 = %:C/non\'UNIX_3 c +User_Alias UA2 = foo.bar +User_Alias UA3 = foo" +User_Alias UA4 = foo:bar +User_Alias UA5 = foo:bar" +User_Alias UA6 = %baz +User_Alias UA7 = %baz.biz +User_Alias UA8 = %:C/non UNIX 0 c +User_Alias UA9 = %:C/non\'UNIX\'1 c -%:C/non UNIX 0 c ALL = (ALL) ALL -%:C/non\'UNIX\'1 c ALL = (ALL) ALL -%:C/non"UNIX"0 c ALL = (ALL) ALL -%:C/non_UNIX_0 c ALL = (ALL) ALL -%:C/non\'UNIX_3 c ALL = (ALL) ALL +foo hosta = (root) ALL +foo.bar hostb = (root) ALL +foo" hostc = (root) ALL +foo:bar hostd = (root) ALL +foo:bar" hoste = (root) ALL +%baz hosta = (root) ALL +%baz.biz hostb = (root) ALL +%:C/non UNIX 0 c hostc = (root) ALL +%:C/non\'UNIX\'1 c hostd = (root) ALL +%:C/non"UNIX"0 c hoste = (root) ALL +%:C/non_UNIX_0 c hostf = (root) ALL +%:C/non\'UNIX_3 c hostg = (root) ALL ++netgr hosth = (root) ALL diff --git a/plugins/sudoers/regress/testsudoers/test2.sh b/plugins/sudoers/regress/testsudoers/test2.sh index a2c0f0d10..892f0cdac 100755 --- a/plugins/sudoers/regress/testsudoers/test2.sh +++ b/plugins/sudoers/regress/testsudoers/test2.sh @@ -1,18 +1,73 @@ #!/bin/sh # -# Test quoted group names in sudoers. -# Note that a backslash is treated literally unless +# Test quoted words in sudoers. +# Note that a backslash in double quotes is treated literally unless # it is escaping a double quote. # WANT=${SRCDIR-.}/regress/testsudoers/test2.out GOT=ts_test2.out ./testsudoers -d > $GOT <"someone" set_home +Defaults>"some one" set_home + +# Check quoted command in Defaults +# XXX - not currently supported +#Defaults!"/bin/ls -l" set_home +#Defaults!"/bin/ls -l \"foo\"" set_home + +# Check quoted user, runas and host name in Cmnd_Spec +"foo" "hosta" = ("root") ALL +"foo.bar" "hostb" = ("root") ALL +"foo\"" "hostc" = ("root") ALL +"foo:bar" "hostd" = ("root") ALL +"foo:bar\"" "hoste" = ("root") ALL + +# Check quoted group/netgroup name in Cmnd_Spec +"%baz" "hosta" = ("root") ALL +"%baz.biz" "hostb" = ("root") ALL +"%:C/non UNIX 0 c" "hostc" = ("root") ALL +"%:C/non\'UNIX\'1 c" "hostd" = ("root") ALL +"%:C/non\"UNIX\"0 c" "hoste" = ("root") ALL +"%:C/non_UNIX_0 c" "hostf" = ("root") ALL +"%:C/non\'UNIX_3 c" "hostg" = ("root") ALL +"+netgr" "hosth" = ("root") ALL EOF # Check results