mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Check that there is only one of read, write, create_expire
This commit is contained in:
parent
8de0804712
commit
cfffb6e634
5 changed files with 36 additions and 0 deletions
21
src/Attr.cc
21
src/Attr.cc
|
@ -375,12 +375,33 @@ void Attributes::CheckAttr(Attr* a)
|
|||
case ATTR_EXPIRE_READ:
|
||||
case ATTR_EXPIRE_WRITE:
|
||||
case ATTR_EXPIRE_CREATE:
|
||||
{
|
||||
if ( type->Tag() != TYPE_TABLE )
|
||||
{
|
||||
Error("expiration only applicable to tables");
|
||||
break;
|
||||
}
|
||||
|
||||
int num_expires = 0;
|
||||
if ( attrs )
|
||||
{
|
||||
loop_over_list(*attrs, i)
|
||||
{
|
||||
Attr* a = (*attrs)[i];
|
||||
if ( a->Tag() == ATTR_EXPIRE_READ ||
|
||||
a->Tag() == ATTR_EXPIRE_WRITE ||
|
||||
a->Tag() == ATTR_EXPIRE_CREATE )
|
||||
num_expires++;
|
||||
}
|
||||
}
|
||||
|
||||
if ( num_expires > 1 )
|
||||
{
|
||||
Error("set/table can only have one of &read_expire, &write_expire, &create_expire");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
//### not easy to test this w/o knowing the ID.
|
||||
if ( ! IsGlobal() )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue