BUGFIX: --one-role-per-agent switch had a bug that made it cut too many patterns.

This commit is contained in:
Cas Cremers 2014-06-20 17:02:23 +01:00
parent 4f252d55a7
commit e966bc88dd

View File

@ -258,23 +258,19 @@ multipleRolePrune (const System sys)
p = sys->runs[run].protocol; p = sys->runs[run].protocol;
if ((p != INTRUDER) && (!isHelperProtocol (p))) if ((p != INTRUDER) && (!isHelperProtocol (p)))
{ {
Role r; Term rolename;
Term agent;
for (r = p->roles; r != NULL; r = r->next)
{
Term role, agent;
Termlist tl; Termlist tl;
// Find mapping role->agent rolename = sys->runs[run].role->nameterm;
role = r->nameterm; agent = agentOfRun (sys, run);
agent = agentOfRunRole (sys, run, role);
// Does this agent already occur yet in the list? // Does this agent already occur yet in the list?
for (tl = agentrole; tl != NULL; tl = (tl->next)->next) for (tl = agentrole; tl != NULL; tl = (tl->next)->next)
{ {
if (isTermEqual (agent, tl->term)) if (isTermEqual (agent, tl->term))
{ {
if (!isTermEqual (role, (tl->next)->term)) if (!isTermEqual (rolename, (tl->next)->term))
{ {
// Same agent, but different role! This is not allowed. // Same agent, but different role! This is not allowed.
termlistDelete (agentrole); // cleanup termlistDelete (agentrole); // cleanup
@ -284,11 +280,10 @@ multipleRolePrune (const System sys)
} }
// Does not occur yet, so add // Does not occur yet, so add
// Note we add the elements in front, so we need to reverse the order // Note we add the elements in front, so we need to reverse the order
agentrole = termlistPrepend (agentrole, role); agentrole = termlistPrepend (agentrole, rolename);
agentrole = termlistPrepend (agentrole, agent); agentrole = termlistPrepend (agentrole, agent);
} }
} }
}
termlistDelete (agentrole); termlistDelete (agentrole);
return false; return false;
} }