- Better filter.
This commit is contained in:
parent
36ccfd776a
commit
e2aca6f3ce
@ -421,10 +421,15 @@ isClaimlabelUsed (const System sys, const Term label)
|
||||
|
||||
//! Generate a fresh claim label
|
||||
Term
|
||||
generateFreshClaimlabel (const System sys, const Role role, const Term claim)
|
||||
generateFreshClaimlabel (const System sys, const Protocol protocol,
|
||||
const Role role, const Term claim)
|
||||
{
|
||||
Term label;
|
||||
|
||||
/* Simply use the role as a prefix */
|
||||
return freshTermPrefix (role->nameterm);
|
||||
label = freshTermPrefix (role->nameterm);
|
||||
label = makeTermTuple (protocol->nameterm, label);
|
||||
return label;
|
||||
}
|
||||
|
||||
//! Create a claim and add it to the claims list, and add the role event.
|
||||
@ -435,6 +440,14 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
|
||||
Claimlist cl;
|
||||
Term labeltuple;
|
||||
|
||||
/* generate full unique label */
|
||||
/* is the label empty or used? */
|
||||
if (label == NULL || isClaimlabelUsed (sys, label))
|
||||
{
|
||||
/* simply generate a fresh one */
|
||||
label = generateFreshClaimlabel (sys, protocol, role, claim);
|
||||
}
|
||||
|
||||
if (switches.filterProtocol != NULL)
|
||||
{
|
||||
// only this protocol
|
||||
@ -446,6 +459,12 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
|
||||
}
|
||||
// and maybe also a specific label?
|
||||
if (switches.filterLabel != NULL)
|
||||
{
|
||||
if (label == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
Term t;
|
||||
|
||||
@ -461,13 +480,6 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* generate full unique label */
|
||||
/* is the label empty or used? */
|
||||
if (label == NULL || isClaimlabelUsed (sys, label))
|
||||
{
|
||||
/* simply generate a fresh one */
|
||||
label = generateFreshClaimlabel (sys, role, claim);
|
||||
}
|
||||
|
||||
// Assert: label is unique, add claimlist info
|
||||
@ -710,6 +722,7 @@ commEvent (int event, Tac tc)
|
||||
("Claim label is not unique at line %i, generating fresh label.",
|
||||
tc->lineno);
|
||||
}
|
||||
// the reported new label will be generated later in claimCreate()
|
||||
}
|
||||
|
||||
if (!isTermEqual (fromrole, thisRole->nameterm))
|
||||
|
@ -495,12 +495,12 @@ switcher (const int process, int index, int commandline)
|
||||
}
|
||||
}
|
||||
|
||||
if (detect (' ', "claim", 1))
|
||||
if (detect (' ', "filter", 1))
|
||||
{
|
||||
if (!process)
|
||||
{
|
||||
helptext ("--claim=<protocol>[,<label>]",
|
||||
"check only a certain claim");
|
||||
helptext ("--filter=<protocol>[,<label>]",
|
||||
"check only certain claims");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1,3 +1,5 @@
|
||||
- There is something weird when automatically generating claim labels
|
||||
and trying to filter on them (try eg duplicates)
|
||||
- --check is slightly f***ed up because there is no good semantics for
|
||||
the --disable intruder check. As a result, it is now too strict can
|
||||
cause correct protocols to fail. Fix.
|
||||
|
Loading…
Reference in New Issue
Block a user