mirror of
https://github.com/zeek/zeek.git
synced 2025-10-14 04:28:20 +00:00
Fix uses of GetBool in bifs to use GetTrue/GetFalse
This commit is contained in:
parent
0d695ac453
commit
f4765a49a1
6 changed files with 80 additions and 80 deletions
|
@ -99,10 +99,10 @@ function set_contents_file%(cid: conn_id, direction: count, f: file%): bool
|
|||
%{
|
||||
Connection* c = sessions->FindConnection(cid);
|
||||
if ( ! c )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
c->GetRootAnalyzer()->SetContentsFile(direction, f);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Returns the file handle of the contents file of a connection.
|
||||
|
|
|
@ -63,20 +63,20 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool
|
|||
if ( ! i )
|
||||
{
|
||||
builtin_error(fmt("Could not find ID named '%s'", ID->CheckString()));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( ! i->HasVal() )
|
||||
{
|
||||
// should be impossible because initialization is enforced
|
||||
builtin_error(fmt("ID '%s' has no value", ID->CheckString()));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( ! i->IsOption() )
|
||||
{
|
||||
builtin_error(fmt("ID '%s' is not an option", ID->CheckString()));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( same_type(val->Type(), bro_broker::DataVal::ScriptDataType()) )
|
||||
|
@ -88,7 +88,7 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool
|
|||
{
|
||||
builtin_error(fmt("Incompatible type for set of ID '%s': got broker data '%s', need '%s'",
|
||||
ID->CheckString(), dv->data.get_type_name(), type_name(i->Type()->Tag())));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
auto rval = call_option_handlers_and_set_value(ID, i, std::move(val_from_data), location);
|
||||
|
@ -111,7 +111,7 @@ function Option::set%(ID: string, val: any, location: string &default=""%): bool
|
|||
|
||||
builtin_error(fmt("Incompatible type for set of ID '%s': got '%s', need '%s'",
|
||||
ID->CheckString(), type_name(val->Type()->Tag()), type_name(i->Type()->Tag())));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
auto rval = call_option_handlers_and_set_value(ID, i, {NewRef{}, val}, location);
|
||||
|
@ -148,26 +148,26 @@ function Option::set_change_handler%(ID: string, on_change: any, priority: int &
|
|||
if ( ! i )
|
||||
{
|
||||
builtin_error(fmt("Could not find ID named '%s'", ID->CheckString()));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( ! i->IsOption() )
|
||||
{
|
||||
builtin_error(fmt("ID '%s' is not an option", ID->CheckString()));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( on_change->Type()->Tag() != TYPE_FUNC )
|
||||
{
|
||||
builtin_error(fmt("Option::on_change needs function argument; got '%s' for ID '%s'",
|
||||
type_name(on_change->Type()->Tag()), ID->CheckString()));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( on_change->Type()->AsFuncType()->Flavor() != FUNC_FLAVOR_FUNCTION )
|
||||
{
|
||||
builtin_error("Option::on_change needs function argument; not hook or event");
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
const type_list* args = on_change->Type()->AsFuncType()->ArgTypes()->Types();
|
||||
|
@ -175,38 +175,38 @@ function Option::set_change_handler%(ID: string, on_change: any, priority: int &
|
|||
{
|
||||
builtin_error(fmt("Wrong number of arguments for passed function in Option::on_change for ID '%s'; expected 2 or 3, got %d",
|
||||
ID->CheckString(), args->length()));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( (*args)[0]->Tag() != TYPE_STRING )
|
||||
{
|
||||
builtin_error(fmt("First argument of passed function has to be string in Option::on_change for ID '%s'; got '%s'",
|
||||
ID->CheckString(), type_name((*args)[0]->Tag())));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( ! same_type((*args)[1], i->Type()) )
|
||||
{
|
||||
builtin_error(fmt("Second argument of passed function has to be %s in Option::on_change for ID '%s'; got '%s'",
|
||||
type_name(i->Type()->Tag()), ID->CheckString(), type_name((*args)[1]->Tag())));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( args->length() == 3 && (*args)[2]->Tag() != TYPE_STRING )
|
||||
{
|
||||
builtin_error(fmt("Third argument of passed function has to be string in Option::on_change for ID '%s'; got '%s'",
|
||||
ID->CheckString(), type_name((*args)[2]->Tag())));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( ! same_type(on_change->Type()->AsFuncType()->YieldType(), i->Type()) )
|
||||
{
|
||||
builtin_error(fmt("Passed function needs to return type '%s' for ID '%s'; got '%s'",
|
||||
type_name(i->Type()->Tag()), ID->CheckString(), type_name(on_change->Type()->AsFuncType()->YieldType()->Tag())));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
auto* func = on_change->AsFunc();
|
||||
i->AddOptionHandler({NewRef{}, func}, -priority);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
|
|
@ -481,7 +481,7 @@ expr:
|
|||
{
|
||||
set_location(@2, @4);
|
||||
$$ = add_and_assign_local({AdoptRef{}, $2}, {AdoptRef{}, $4},
|
||||
{AdoptRef{}, val_mgr->GetBool(1)}).release();
|
||||
{AdoptRef{}, val_mgr->GetTrue()}).release();
|
||||
}
|
||||
|
||||
| expr '[' expr_list ']'
|
||||
|
|
|
@ -25,7 +25,7 @@ function Reporter::info%(msg: string%): bool
|
|||
reporter->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
reporter->Info("%s", msg->CheckString());
|
||||
reporter->PopLocation();
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a message that warns of a potential problem.
|
||||
|
@ -40,7 +40,7 @@ function Reporter::warning%(msg: string%): bool
|
|||
reporter->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
reporter->Warning("%s", msg->CheckString());
|
||||
reporter->PopLocation();
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a non-fatal error indicative of a definite problem that should
|
||||
|
@ -56,7 +56,7 @@ function Reporter::error%(msg: string%): bool
|
|||
reporter->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
reporter->Error("%s", msg->CheckString());
|
||||
reporter->PopLocation();
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a fatal error on stderr and terminates program execution.
|
||||
|
@ -69,7 +69,7 @@ function Reporter::fatal%(msg: string%): bool
|
|||
reporter->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
reporter->FatalError("%s", msg->CheckString());
|
||||
reporter->PopLocation();
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a fatal error on stderr and terminates program execution
|
||||
|
@ -83,7 +83,7 @@ function Reporter::fatal_error_with_core%(msg: string%): bool
|
|||
reporter->PushLocation(frame->GetCall()->GetLocationInfo());
|
||||
reporter->FatalErrorWithCore("%s", msg->CheckString());
|
||||
reporter->PopLocation();
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a "net" weird.
|
||||
|
@ -94,7 +94,7 @@ function Reporter::fatal_error_with_core%(msg: string%): bool
|
|||
function Reporter::net_weird%(name: string%): bool
|
||||
%{
|
||||
reporter->Weird(name->CheckString());
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a "flow" weird.
|
||||
|
@ -109,7 +109,7 @@ function Reporter::net_weird%(name: string%): bool
|
|||
function Reporter::flow_weird%(name: string, orig: addr, resp: addr%): bool
|
||||
%{
|
||||
reporter->Weird(orig->AsAddr(), resp->AsAddr(), name->CheckString());
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a "conn" weird.
|
||||
|
@ -124,7 +124,7 @@ function Reporter::flow_weird%(name: string, orig: addr, resp: addr%): bool
|
|||
function Reporter::conn_weird%(name: string, c: connection, addl: string &default=""%): bool
|
||||
%{
|
||||
reporter->Weird(c, name->CheckString(), addl->CheckString());
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Generates a "file" weird.
|
||||
|
@ -142,10 +142,10 @@ function Reporter::file_weird%(name: string, f: fa_file, addl: string &default="
|
|||
auto file = file_mgr->LookupFile(fuid->CheckString());
|
||||
|
||||
if ( ! file )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
reporter->Weird(file, name->CheckString(), addl->CheckString());
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Gets the weird sampling whitelist
|
||||
|
@ -185,7 +185,7 @@ function Reporter::set_weird_sampling_whitelist%(weird_sampling_whitelist: strin
|
|||
delete k;
|
||||
}
|
||||
reporter->SetWeirdSamplingWhitelist(whitelist_set);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Gets the current weird sampling threshold
|
||||
|
@ -204,7 +204,7 @@ function Reporter::get_weird_sampling_threshold%(%) : count
|
|||
function Reporter::set_weird_sampling_threshold%(weird_sampling_threshold: count%) : bool
|
||||
%{
|
||||
reporter->SetWeirdSamplingThreshold(weird_sampling_threshold);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
|
||||
|
@ -224,7 +224,7 @@ function Reporter::get_weird_sampling_rate%(%) : count
|
|||
function Reporter::set_weird_sampling_rate%(weird_sampling_rate: count%) : bool
|
||||
%{
|
||||
reporter->SetWeirdSamplingRate(weird_sampling_rate);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Gets the current weird sampling duration.
|
||||
|
@ -244,5 +244,5 @@ function Reporter::get_weird_sampling_duration%(%) : interval
|
|||
function Reporter::set_weird_sampling_duration%(weird_sampling_duration: interval%) : bool
|
||||
%{
|
||||
reporter->SetWeirdSamplingDuration(weird_sampling_duration);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
|
|
@ -627,9 +627,9 @@ function is_ascii%(str: string%): bool
|
|||
|
||||
for ( int i = 0; i < n; ++i )
|
||||
if ( s[i] > 127 )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Replaces non-printable characters in a string with escaped sequences. The
|
||||
|
|
92
src/zeek.bif
92
src/zeek.bif
|
@ -364,8 +364,8 @@ function setenv%(var: string, val: string%): bool
|
|||
val->AsString()->CheckString(), 1);
|
||||
|
||||
if ( result < 0 )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetFalse();
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Shuts down the Zeek process immediately.
|
||||
|
@ -388,10 +388,10 @@ function exit%(code: int%): any
|
|||
function terminate%(%): bool
|
||||
%{
|
||||
if ( terminating )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
terminate_processing();
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
%%{
|
||||
|
@ -520,7 +520,7 @@ function piped_exec%(program: string, to_write: string%): bool
|
|||
if ( ! f )
|
||||
{
|
||||
reporter->Error("Failed to popen %s", prog);
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
const u_char* input_data = to_write->Bytes();
|
||||
|
@ -533,10 +533,10 @@ function piped_exec%(program: string, to_write: string%): bool
|
|||
if ( bytes_written != input_data_len )
|
||||
{
|
||||
reporter->Error("Failed to write all given data to %s", prog);
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
%%{
|
||||
|
@ -2047,7 +2047,7 @@ function do_profiling%(%) : any
|
|||
function is_local_interface%(ip: addr%) : bool
|
||||
%{
|
||||
if ( ip->AsAddr().IsLoopback() )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
|
||||
list<IPAddr> addrs;
|
||||
|
||||
|
@ -2079,10 +2079,10 @@ function is_local_interface%(ip: addr%) : bool
|
|||
for ( it = addrs.begin(); it != addrs.end(); ++it )
|
||||
{
|
||||
if ( *it == ip->AsAddr() )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
}
|
||||
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
%}
|
||||
|
||||
## Write rule matcher statistics (DFA states, transitions, memory usage, cache
|
||||
|
@ -2098,7 +2098,7 @@ function dump_rule_stats%(f: file%): bool
|
|||
if ( rule_matcher )
|
||||
rule_matcher->DumpStats(f);
|
||||
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Checks if Zeek is terminating.
|
||||
|
@ -2132,9 +2132,9 @@ function gethostname%(%) : string
|
|||
function is_v4_addr%(a: addr%): bool
|
||||
%{
|
||||
if ( a->AsAddr().GetFamily() == IPv4 )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
else
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
%}
|
||||
|
||||
## Returns whether an address is IPv6 or not.
|
||||
|
@ -2145,9 +2145,9 @@ function is_v4_addr%(a: addr%): bool
|
|||
function is_v6_addr%(a: addr%): bool
|
||||
%{
|
||||
if ( a->AsAddr().GetFamily() == IPv6 )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
else
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
%}
|
||||
|
||||
## Returns whether a subnet specification is IPv4 or not.
|
||||
|
@ -2158,9 +2158,9 @@ function is_v6_addr%(a: addr%): bool
|
|||
function is_v4_subnet%(s: subnet%): bool
|
||||
%{
|
||||
if ( s->AsSubNet().Prefix().GetFamily() == IPv4 )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
else
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
%}
|
||||
|
||||
## Returns whether a subnet specification is IPv6 or not.
|
||||
|
@ -2171,9 +2171,9 @@ function is_v4_subnet%(s: subnet%): bool
|
|||
function is_v6_subnet%(s: subnet%): bool
|
||||
%{
|
||||
if ( s->AsSubNet().Prefix().GetFamily() == IPv6 )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
else
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
%}
|
||||
|
||||
|
||||
|
@ -3279,9 +3279,9 @@ function get_port_transport_proto%(p: port%): transport_proto
|
|||
function connection_exists%(c: conn_id%): bool
|
||||
%{
|
||||
if ( sessions->FindConnection(c) )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
else
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
%}
|
||||
|
||||
## Returns the :zeek:type:`connection` record for a given connection identifier.
|
||||
|
@ -3359,7 +3359,7 @@ function dump_current_packet%(file_name: string%) : bool
|
|||
|
||||
if ( ! current_pktsrc ||
|
||||
! current_pktsrc->GetCurrentPacket(&pkt) )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
if ( addl_pkt_dumper && addl_pkt_dumper->Path() != file_name->CheckString())
|
||||
{
|
||||
|
@ -3942,7 +3942,7 @@ function mmdb_open_location_db%(f: string%) : bool
|
|||
#ifdef USE_GEOIP
|
||||
return val_mgr->GetBool(mmdb_open_loc(f->CheckString()));
|
||||
#else
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
@ -3959,7 +3959,7 @@ function mmdb_open_asn_db%(f: string%) : bool
|
|||
#ifdef USE_GEOIP
|
||||
return val_mgr->GetBool(mmdb_open_asn(f->CheckString()));
|
||||
#else
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
#endif
|
||||
%}
|
||||
|
||||
|
@ -4259,7 +4259,7 @@ function disable_analyzer%(cid: conn_id, aid: count, err_if_no_conn: bool &defau
|
|||
if ( ! c )
|
||||
{
|
||||
reporter->Error("cannot find connection");
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
analyzer::Analyzer* a = c->FindAnalyzer(aid);
|
||||
|
@ -4267,7 +4267,7 @@ function disable_analyzer%(cid: conn_id, aid: count, err_if_no_conn: bool &defau
|
|||
{
|
||||
if ( err_if_no_conn )
|
||||
reporter->Error("connection does not have analyzer specified to disable");
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
|
||||
if ( prevent )
|
||||
|
@ -4295,10 +4295,10 @@ function skip_further_processing%(cid: conn_id%): bool
|
|||
%{
|
||||
Connection* c = sessions->FindConnection(cid);
|
||||
if ( ! c )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
c->SetSkip(1);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Controls whether packet contents belonging to a connection should be
|
||||
|
@ -4325,10 +4325,10 @@ function set_record_packets%(cid: conn_id, do_record: bool%): bool
|
|||
%{
|
||||
Connection* c = sessions->FindConnection(cid);
|
||||
if ( ! c )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
c->SetRecordPackets(do_record);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Sets an individual inactivity timeout for a connection and thus
|
||||
|
@ -4420,7 +4420,7 @@ function close%(f: file%): bool
|
|||
function write_file%(f: file, data: string%): bool
|
||||
%{
|
||||
if ( ! f )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
return val_mgr->GetBool(f->Write((const char*) data->Bytes(), data->Len()));
|
||||
%}
|
||||
|
@ -4476,14 +4476,14 @@ function mkdir%(f: string%): bool
|
|||
// check if already exists and is directory.
|
||||
if ( errno == EEXIST && stat(filename, &filestat) == 0
|
||||
&& S_ISDIR(filestat.st_mode) )
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
|
||||
builtin_error(fmt("cannot create directory '%s': %s", filename,
|
||||
strerror(error)));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
else
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
|
||||
|
@ -4505,10 +4505,10 @@ function rmdir%(d: string%): bool
|
|||
{
|
||||
builtin_error(fmt("cannot remove directory '%s': %s", dirname,
|
||||
strerror(errno)));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
else
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Removes a file from a directory.
|
||||
|
@ -4529,10 +4529,10 @@ function unlink%(f: string%): bool
|
|||
{
|
||||
builtin_error(fmt("cannot unlink file '%s': %s", filename,
|
||||
strerror(errno)));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
else
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Renames a file from src_f to dst_f.
|
||||
|
@ -4555,10 +4555,10 @@ function rename%(src_f: string, dst_f: string%): bool
|
|||
{
|
||||
builtin_error(fmt("cannot rename file '%s' to '%s': %s", src_filename,
|
||||
dst_filename, strerror(errno)));
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
}
|
||||
else
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Checks whether a given file is open.
|
||||
|
@ -4743,7 +4743,7 @@ function enable_raw_output%(f: file%): any
|
|||
function install_src_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : bool
|
||||
%{
|
||||
sessions->GetPacketFilter()->AddSrc(ip->AsAddr(), tcp_flags, prob);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Installs a filter to drop packets originating from a given subnet with
|
||||
|
@ -4773,7 +4773,7 @@ function install_src_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : b
|
|||
function install_src_net_filter%(snet: subnet, tcp_flags: count, prob: double%) : bool
|
||||
%{
|
||||
sessions->GetPacketFilter()->AddSrc(snet, tcp_flags, prob);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Removes a source address filter.
|
||||
|
@ -4848,7 +4848,7 @@ function uninstall_src_net_filter%(snet: subnet%) : bool
|
|||
function install_dst_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : bool
|
||||
%{
|
||||
sessions->GetPacketFilter()->AddDst(ip->AsAddr(), tcp_flags, prob);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Installs a filter to drop packets destined to a given subnet with
|
||||
|
@ -4878,7 +4878,7 @@ function install_dst_addr_filter%(ip: addr, tcp_flags: count, prob: double%) : b
|
|||
function install_dst_net_filter%(snet: subnet, tcp_flags: count, prob: double%) : bool
|
||||
%{
|
||||
sessions->GetPacketFilter()->AddDst(snet, tcp_flags, prob);
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
## Removes a destination address filter.
|
||||
|
@ -4964,12 +4964,12 @@ function match_signatures%(c: connection, pattern_type: int, s: string,
|
|||
from_orig: bool, clear: bool%) : bool
|
||||
%{
|
||||
if ( ! rule_matcher )
|
||||
return val_mgr->GetBool(0);
|
||||
return val_mgr->GetFalse();
|
||||
|
||||
c->Match((Rule::PatternType) pattern_type, s->Bytes(), s->Len(),
|
||||
from_orig, bol, eol, clear);
|
||||
|
||||
return val_mgr->GetBool(1);
|
||||
return val_mgr->GetTrue();
|
||||
%}
|
||||
|
||||
# ===========================================================================
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue