PR#617: display suid bit in web ui
Merges #617 https://pagure.io/koji/pull-request/617 Fixes #616 https://pagure.io/koji/issue/616
This commit is contained in:
commit
8f78389ded
3 changed files with 24 additions and 1 deletions
2
Makefile
2
Makefile
|
|
@ -66,7 +66,7 @@ git-clean:
|
|||
|
||||
test:
|
||||
coverage erase
|
||||
PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/. coverage run \
|
||||
PYTHONPATH=hub/.:plugins/hub/.:plugins/builder/.:plugins/cli/.:cli/.:www/lib coverage run \
|
||||
--source . /usr/bin/nosetests
|
||||
coverage report
|
||||
coverage html
|
||||
|
|
|
|||
18
tests/test_www/test_util.py
Normal file
18
tests/test_www/test_util.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
import unittest
|
||||
|
||||
from kojiweb.util import formatMode
|
||||
|
||||
class TestFormatMode(unittest.TestCase):
|
||||
def test_format_mode(self):
|
||||
formats = (
|
||||
('drwxrwxr-x', 0x41fd), # dir
|
||||
('-rw-------', 0x8180), # reg. file
|
||||
('crw--w----', 0x2190), # /dev/tty0
|
||||
('brw-rw----', 0x61b0), # /dev/sda
|
||||
('lrwxrwxrwx', 0xa1ff), # symlink
|
||||
('srwxr-xr-x', 0xc1ed), # socket
|
||||
('-rwsrwsr--', 0x8db4), # suid
|
||||
)
|
||||
|
||||
for s, mode in formats:
|
||||
self.assertEqual(formatMode(mode), s)
|
||||
|
|
@ -459,6 +459,11 @@ def formatMode(mode):
|
|||
else:
|
||||
result += '-'
|
||||
|
||||
if mode & stat.S_ISUID:
|
||||
result = result[:3] + 's' + result[4:]
|
||||
if mode & stat.S_ISGID:
|
||||
result = result[:6] + 's' + result[7:]
|
||||
|
||||
return result
|
||||
|
||||
def rowToggle(template):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue