File: 20_old-style-ttys.py

package info (click to toggle)
selinux-basics 0.6.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 144 kB
  • sloc: python: 280; sh: 120; perl: 95; makefile: 2
file content (30 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class TestOldTTYs(TestBase):
	"""
	Check for old-style ttys that are not supported by the policies.
	These are disabled in the default kernel shipped by Debian since
	Squeeze.
	"""

	class ErrorOldTTYs(ErrorBase):
		def __init__(self, oldttys):
			self.oldttys = oldttys
		def __str__(self):
			return "Old style ttys were found."
		def fixable(self):
			return True
		def fix(self):
			success = True
			for nam in self.oldttys:
				if not os.unlink(nam):
					success = False
			return success

	@staticmethod
	def test():
		import glob

		oldttys = glob.glob("/dev/[tp]ty[abcdepqrstuvwxyz][0-9a-f]")
		if len(oldttys) > 0:
			return [TestOldTTYs.ErrorOldTTYs(oldttys)]
		return []
register_test(TestOldTTYs)