Fix/cleanup the permission reporting for the dfa dumps

The permission reporting was not reporting the full set of permission
flags and was inconsistent between the dump routines.

Report permissions as the quad (allow/deny/audit/quiet) in hex.

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-By: Steve Beattie <sbeattie@ubuntu.com>
This commit is contained in:
John Johansen 2012-03-09 04:17:47 -08:00
parent 1a01b5c296
commit 37f446dd79
2 changed files with 13 additions and 11 deletions

View file

@ -223,7 +223,7 @@ extern "C" int aare_add_rule_vec(aare_ruleset_t *rules, int deny,
tree->dump(cerr);
if (deny)
cerr << " deny";
cerr << " (" << hex << allow <<"/" << audit << dec << ")";
cerr << " (0x" << hex << allow <<"/" << audit << dec << ")";
accept->dump(cerr);
cerr << "\n\n";
}

View file

@ -633,12 +633,12 @@ void DFA::dump(ostream & os)
if (*i == start || !(*i)->perms.is_null()) {
os << **i;
if (*i == start)
os << " <==";
if ((*i)->perms.allow) {
os << " (0x" << hex << (*i)->perms.allow << " "
<< (*i)->perms.deny << " "
<< (*i)->perms.audit << " "
<< (*i)->perms.audit << dec << ')';
os << " <== (allow/deny/audit/quiet)";
if (!(*i)->perms.is_null()) {
os << " (0x " << hex << (*i)->perms.allow << "/"
<< (*i)->perms.deny << "/"
<< (*i)->perms.audit << "/"
<< (*i)->perms.quiet << ')';
}
os << "\n";
}
@ -672,10 +672,12 @@ void DFA::dump_dot_graph(ostream & os)
if (*i == start) {
os << "\t\tstyle=bold" << "\n";
}
uint32_t perms = (*i)->perms.allow;
if (perms) {
os << "\t\tlabel=\"" << **i << "\\n("
<< perms << ")\"" << "\n";
if (!(*i)->perms.is_null()) {
os << "\t\tlabel=\"" << **i << "\\n(0x " << hex
<< (*i)->perms.allow << "/"
<< (*i)->perms.deny << "/"
<< (*i)->perms.audit << "/"
<< (*i)->perms.quiet << ")\"\n";
}
os << "\t]" << "\n";
}