Skip to content
Snippets Groups Projects
Commit cbe1460f authored by Dan Cashman's avatar Dan Cashman Committed by android-build-merger
Browse files

Merge "treble sepolicy tests: Add removed attribute check." into oc-mr1-dev

am: 51572137

Change-Id: I2137c4aff726537196f6799d5368fa2391e7f019
parents 4b827546 51572137
No related branches found
No related tags found
No related merge requests found
...@@ -124,8 +124,8 @@ class Policy: ...@@ -124,8 +124,8 @@ class Policy:
yield Rule yield Rule
def GetAllTypes(self): def GetAllTypes(self, isAttr):
TypeIterP = self.__libsepolwrap.init_type_iter(self.__policydbP, None, False) TypeIterP = self.__libsepolwrap.init_type_iter(self.__policydbP, None, isAttr)
if (TypeIterP == None): if (TypeIterP == None):
sys.exit("Failed to initialize type iterator") sys.exit("Failed to initialize type iterator")
buf = create_string_buffer(self.__BUFSIZE) buf = create_string_buffer(self.__BUFSIZE)
......
...@@ -98,13 +98,15 @@ int get_type(char *out, size_t max_size, void *policydbp, void *type_iterp) ...@@ -98,13 +98,15 @@ int get_type(char *out, size_t max_size, void *policydbp, void *type_iterp)
break; break;
} }
} }
if (i->bit >= i->length) while (i->bit < i->length &&
return 1; ((i->alltypes == TYPE_ITER_ALLATTRS
while ((i->alltypes == TYPE_ITER_ALLATTRS
&& db->type_val_to_struct[i->bit]->flavor != TYPE_ATTRIB) && db->type_val_to_struct[i->bit]->flavor != TYPE_ATTRIB)
|| (i->alltypes == TYPE_ITER_ALLTYPES || (i->alltypes == TYPE_ITER_ALLTYPES
&& db->type_val_to_struct[i->bit]->flavor != TYPE_TYPE)) && db->type_val_to_struct[i->bit]->flavor != TYPE_TYPE))) {
i->bit++; i->bit++;
}
if (i->bit >= i->length)
return 1;
len = snprintf(out, max_size, "%s", db->p_type_val_to_name[i->bit]); len = snprintf(out, max_size, "%s", db->p_type_val_to_name[i->bit]);
if (len >= max_size) { if (len >= max_size) {
std::cerr << "type name exceeds buffer size." << std::endl; std::cerr << "type name exceeds buffer size." << std::endl;
......
...@@ -155,8 +155,8 @@ def GetAttributes(pol): ...@@ -155,8 +155,8 @@ def GetAttributes(pol):
def GetAllTypes(pol, oldpol): def GetAllTypes(pol, oldpol):
global alltypes global alltypes
global oldalltypes global oldalltypes
alltypes = pol.GetAllTypes() alltypes = pol.GetAllTypes(False)
oldalltypes = oldpol.GetAllTypes() oldalltypes = oldpol.GetAllTypes(False)
def setup(pol): def setup(pol):
GetAllDomains(pol) GetAllDomains(pol)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment