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;
if ((p != INTRUDER) && (!isHelperProtocol (p)))
{
Role r;
for (r = p->roles; r != NULL; r = r->next)
{
Term role, agent;
Term rolename;
Term agent;
Termlist tl;
// Find mapping role->agent
role = r->nameterm;
agent = agentOfRunRole (sys, run, role);
rolename = sys->runs[run].role->nameterm;
agent = agentOfRun (sys, run);
// Does this agent already occur yet in the list?
for (tl = agentrole; tl != NULL; tl = (tl->next)->next)
{
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.
termlistDelete (agentrole); // cleanup
@ -284,11 +280,10 @@ multipleRolePrune (const System sys)
}
// Does not occur yet, so add
// 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);
}
}
}
termlistDelete (agentrole);
return false;
}