trunk: fix flask.py Flask class userspace dictionary usage.

This commit is contained in:
Chris PeBenito 2007-10-16 18:56:32 +00:00
parent 651df3ceb6
commit 32c05ccbcd

View File

@ -132,6 +132,8 @@ class Flask:
classes.append(c) classes.append(c)
if self.USERFLAG.search(line): if self.USERFLAG.search(line):
self.userspace[c] = True self.userspace[c] = True
else:
self.userspace[c] = False
continue continue
raise ParseError, ("data. Was expecting either a comment, whitespace, or class definition. ", path, number) raise ParseError, ("data. Was expecting either a comment, whitespace, or class definition. ", path, number)
@ -232,7 +234,7 @@ class Flask:
if i not in common: raise UndefinedError, (self.COMMON, path, number, i) if i not in common: raise UndefinedError, (self.COMMON, path, number, i)
inherits[c] = i inherits[c] = i
state = INHERIT state = INHERIT
if not self.userspace.has_key(c): user_commons[i] = False if not self.userspace[c]: user_commons[i] = False
continue continue
m = self.OPENB.search(line) m = self.OPENB.search(line)
@ -314,8 +316,7 @@ class Flask:
if self.inherits.has_key(c): if self.inherits.has_key(c):
i = self.inherits[c] i = self.inherits[c]
count = len(self.common[i]) count = len(self.common[i])
user = self.userspace.has_key(c) if not (mode == self.KERNEL and self.userspace[c]):
if not (mode == self.KERNEL and user):
results.append(" S_(SECCLASS_%s, %s, %s)\n" % (c.upper(), i, self.createUL(count))) results.append(" S_(SECCLASS_%s, %s, %s)\n" % (c.upper(), i, self.createUL(count)))
return results return results
@ -326,8 +327,7 @@ class Flask:
results.append(self.autogen) results.append(self.autogen)
for c in self.vectors: for c in self.vectors:
for p in self.vector[c]: for p in self.vector[c]:
user = self.userspace.has_key(c) if not (mode == self.KERNEL and self.userspace[c]):
if (mode == self.KERNEL and not user) or (mode == self.USERSPACE):
results.append(" S_(SECCLASS_%s, %s__%s, \"%s\")\n" % (c.upper(), c.upper(), p.upper(), p)) results.append(" S_(SECCLASS_%s, %s__%s, \"%s\")\n" % (c.upper(), c.upper(), p.upper(), p))
return results return results
@ -360,8 +360,7 @@ class Flask:
for p in ps: for p in ps:
columnA = "#define %s__%s " % (c.upper(), p.upper()) columnA = "#define %s__%s " % (c.upper(), p.upper())
columnA += "".join([" " for i in range(width - len(columnA))]) columnA += "".join([" " for i in range(width - len(columnA))])
user = self.userspace.has_key(c) if not (mode == self.KERNEL and self.userspace[c]):
if not (mode == self.KERNEL and user):
results.append("%s%s\n" % (columnA, self.createUL(count))) results.append("%s%s\n" % (columnA, self.createUL(count)))
count += 1 count += 1
@ -380,8 +379,7 @@ class Flask:
results.append(" S_(\"null\")\n") results.append(" S_(\"null\")\n")
for c in self.classes: for c in self.classes:
user = self.userspace.has_key(c) if mode == self.KERNEL and self.userspace[c]:
if mode == self.KERNEL and user:
results.append(" S_(NULL)\n") results.append(" S_(NULL)\n")
else: else:
results.append(" S_(\"%s\")\n" % c) results.append(" S_(\"%s\")\n" % c)
@ -419,8 +417,7 @@ class Flask:
count += 1 count += 1
columnA = "#define SECCLASS_%s " % c.upper() columnA = "#define SECCLASS_%s " % c.upper()
columnA += "".join([" " for i in range(width - len(columnA))]) columnA += "".join([" " for i in range(width - len(columnA))])
user = self.userspace.has_key(c) if not (mode == self.KERNEL and self.userspace[c]):
if not (mode == self.KERNEL and user):
results.append("%s%d\n" % (columnA, count)) results.append("%s%d\n" % (columnA, count))
results.append("\n") results.append("\n")