capable_net: check for ifconfig in different locations
PATCH 1/1 capable_net: check for ifconfig in different locations
Pardon my C-like Perl, but in current Fedora Rawhide releases we need to check for ifconfig in /usr/bin and not just /sbin.
--- tests/capable_net/test | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
tests/capable_net/test +11 -2
@@ -8,11 +8,20 @@ BEGIN { plan tests => 5 } $basedir = $0; $basedir =~ s|(.*)/[^/]*|$1|; +# Find a usable ifconfig +if (-x "/sbin/ifconfig") { + $ifconfig = "/sbin/ifconfig"; +} elsif (-x "/usr/bin/ifconfig") { + $ifconfig = "/usr/bin/ifconfig"; +} else { + BAIL_OUT("can not find a copy of ifconfig"); +} + # # Tests for the good domain. # # CAP_NET_ADMIN -$result = system "runcon -t test_ncap_t -- /sbin/ifconfig lo -promisc 2>&1"; +$result = system "runcon -t test_ncap_t -- $ifconfig lo -promisc 2>&1"; ok($result, 0); # CAP_NET_BIND_SERVICE
@@ -30,7 +39,7 @@ ok($result, 0); # # CAP_NET_ADMIN -$result = system "runcon -t test_resncap_t -- /sbin/ifconfig lo -promisc 2>&1"; +$result = system "runcon -t test_resncap_t -- $ifconfig lo -promisc 2>&1"; ok($result); # CAP_NET_BIND_SERVICE; included in can_network by fedora policy
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 4 lines · Paul Moore
Pardon my C-like Perl, but in current Fedora Rawhide releases we need to check for ifconfig in
/usr/binand not just /sbin.Signed-off-by Paul Moore <[email protected]>
Thanks, looks good, will apply.
Quoted 31 lines
--- tests/capable_net/test | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)tests/capable_net/test +10
-1@@ -8,11 +8,20 @@ BEGIN { plan tests => 5 } $basedir = $0; $basedir =~ s|(.*)/[^/]*|$1|; +# Find a usable ifconfig +if (-x "/sbin/ifconfig") { + $ifconfig = "/sbin/ifconfig"; +} elsif (-x "/usr/bin/ifconfig") { + $ifconfig = "/usr/bin/ifconfig"; +} else { + BAIL_OUT("can not find a copy of ifconfig"); +} + # # Tests for the good domain. # # CAP_NET_ADMIN -$result = system "runcon -t test_ncap_t -- /sbin/ifconfig lo -promisc 2>&1"; +$result = system "runcon -t test_ncap_t -- $ifconfig lo -promisc 2>&1"; ok($result, 0); # CAP_NET_BIND_SERVICE
tests/capable_net/test ok($result, 0); · line 45
Quoted 8 lines
tests/capable_net/test +1
-1@@ -30,7 +39,7 @@ ok($result, 0); # # CAP_NET_ADMIN -$result = system "runcon -t test_resncap_t -- /sbin/ifconfig lo -promisc 2>&1"; +$result = system "runcon -t test_resncap_t -- $ifconfig lo -promisc 2>&1"; ok($result); # CAP_NET_BIND_SERVICE; included in can_network by fedora policy
--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.