mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 09:38:19 +00:00
Bug fixes.
- Fixing a crash with an invalid pointer. - Fixing a namespacing problem with is_ftp_data_conn() and check_relay_3(). - Fixing the do-we-have-an-event-handler-defined check. Standard test-suite passes. Seth, I think you can give it a try now ...
This commit is contained in:
parent
871561939b
commit
45ebfbb2b8
8 changed files with 29 additions and 17 deletions
|
@ -14,7 +14,9 @@ const conn_closed = { TCP_CLOSED, TCP_RESET };
|
||||||
|
|
||||||
global have_FTP = F; # if true, we've loaded ftp.bro
|
global have_FTP = F; # if true, we've loaded ftp.bro
|
||||||
global have_SMTP = F; # if true, we've loaded smtp.bro
|
global have_SMTP = F; # if true, we've loaded smtp.bro
|
||||||
global is_ftp_data_conn: function(c: connection): bool;
|
|
||||||
|
# TODO: Do we have a nicer way of doing this?
|
||||||
|
export { global FTP::is_ftp_data_conn: function(c: connection): bool; }
|
||||||
|
|
||||||
# Whether to include connection state history in the logs generated
|
# Whether to include connection state history in the logs generated
|
||||||
# by record_connection.
|
# by record_connection.
|
||||||
|
@ -186,7 +188,7 @@ function determine_service_non_DPD(c: connection) : string
|
||||||
return i; # return first;
|
return i; # return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if ( have_FTP && is_ftp_data_conn(c) )
|
else if ( have_FTP && FTP::is_ftp_data_conn(c) )
|
||||||
return port_names[20/tcp];
|
return port_names[20/tcp];
|
||||||
|
|
||||||
else if ( [c$id$resp_h, c$id$resp_p] in RPC_server_map )
|
else if ( [c$id$resp_h, c$id$resp_p] in RPC_server_map )
|
||||||
|
|
|
@ -151,7 +151,7 @@ function do_match(c: connection, r: rule): bool
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( r$is_ftp && ! is_ftp_data_conn(c) )
|
if ( r$is_ftp && ! FTP::is_ftp_data_conn(c) )
|
||||||
return F;
|
return F;
|
||||||
|
|
||||||
return T;
|
return T;
|
||||||
|
|
|
@ -74,13 +74,14 @@ function mime_header_subject(session: mime_session_info,
|
||||||
### This is a bit clunky. These are functions we call out to, defined
|
### This is a bit clunky. These are functions we call out to, defined
|
||||||
# elsewhere. The way we really ought to do this is to have them passed
|
# elsewhere. The way we really ought to do this is to have them passed
|
||||||
# in during initialization. But for now, we presume knowledge of their
|
# in during initialization. But for now, we presume knowledge of their
|
||||||
# names in global scope.
|
# names.
|
||||||
module GLOBAL;
|
export
|
||||||
global check_relay_3:
|
{
|
||||||
function(session: MIME::mime_session_info, msg_id: string);
|
global SMTP::check_relay_3:
|
||||||
global check_relay_4:
|
function(session: MIME::mime_session_info, msg_id: string);
|
||||||
function(session: MIME::mime_session_info, content_hash: string);
|
global SMTP::check_relay_4:
|
||||||
module MIME;
|
function(session: MIME::mime_session_info, content_hash: string);
|
||||||
|
}
|
||||||
|
|
||||||
function mime_header_message_id(session: mime_session_info, name: string, arg: string)
|
function mime_header_message_id(session: mime_session_info, name: string, arg: string)
|
||||||
{
|
{
|
||||||
|
@ -107,7 +108,7 @@ function mime_header_message_id(session: mime_session_info, name: string, arg: s
|
||||||
s = t[1];
|
s = t[1];
|
||||||
|
|
||||||
if ( session$level == 1 && SMTP::process_smtp_relay )
|
if ( session$level == 1 && SMTP::process_smtp_relay )
|
||||||
check_relay_3(session, s);
|
SMTP::check_relay_3(session, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
redef mime_header_handler = {
|
redef mime_header_handler = {
|
||||||
|
|
|
@ -23,6 +23,11 @@ EventHandler::~EventHandler()
|
||||||
delete [] group;
|
delete [] group;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EventHandler::operator bool() const
|
||||||
|
{
|
||||||
|
return enabled && ((local && local->HasBodies()) || receivers.length());
|
||||||
|
}
|
||||||
|
|
||||||
FuncType* EventHandler::FType()
|
FuncType* EventHandler::FType()
|
||||||
{
|
{
|
||||||
if ( type )
|
if ( type )
|
||||||
|
|
|
@ -34,8 +34,7 @@ public:
|
||||||
void Call(val_list* vl, bool no_remote = false);
|
void Call(val_list* vl, bool no_remote = false);
|
||||||
|
|
||||||
// Returns true if there is at least one local or remote handler.
|
// Returns true if there is at least one local or remote handler.
|
||||||
operator bool() const
|
operator bool() const;
|
||||||
{ return enabled && (local || receivers.length()); }
|
|
||||||
|
|
||||||
void SetUsed() { used = true; }
|
void SetUsed() { used = true; }
|
||||||
bool Used() { return used; }
|
bool Used() { return used; }
|
||||||
|
|
|
@ -4030,7 +4030,10 @@ Val* RecordCoerceExpr::Fold(Val* v) const
|
||||||
for ( int i = 0; i < map_size; ++i )
|
for ( int i = 0; i < map_size; ++i )
|
||||||
{
|
{
|
||||||
if ( map[i] >= 0 )
|
if ( map[i] >= 0 )
|
||||||
val->Assign(i, rv->Lookup(map[i])->Ref());
|
{
|
||||||
|
Val* v = rv->Lookup(map[i]);
|
||||||
|
val->Assign(i, v ? v->Ref() : 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
val->Assign(i, 0);
|
val->Assign(i, 0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ class FuncType;
|
||||||
class Stmt;
|
class Stmt;
|
||||||
class Frame;
|
class Frame;
|
||||||
class ID;
|
class ID;
|
||||||
|
class CallExpr;
|
||||||
|
|
||||||
class Func : public BroObj {
|
class Func : public BroObj {
|
||||||
public:
|
public:
|
||||||
|
@ -36,7 +37,8 @@ public:
|
||||||
{ return priority > other.priority; } // reverse sort
|
{ return priority > other.priority; } // reverse sort
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual const vector<Body>& GetBodies() const { return bodies; }
|
const vector<Body>& GetBodies() const { return bodies; }
|
||||||
|
bool HasBodies() const { return bodies.size(); }
|
||||||
|
|
||||||
// virtual Val* Call(ListExpr* args) const = 0;
|
// virtual Val* Call(ListExpr* args) const = 0;
|
||||||
virtual Val* Call(val_list* args, Frame* parent = 0) const = 0;
|
virtual Val* Call(val_list* args, Frame* parent = 0) const = 0;
|
||||||
|
|
|
@ -1463,9 +1463,9 @@ int same_type(const BroType* t1, const BroType* t2, int is_init)
|
||||||
int same_attrs(const Attributes* a1, const Attributes* a2)
|
int same_attrs(const Attributes* a1, const Attributes* a2)
|
||||||
{
|
{
|
||||||
if ( ! a1 )
|
if ( ! a1 )
|
||||||
return (a2 != 0);
|
return (a2 == 0);
|
||||||
|
|
||||||
if ( ! a2 )
|
if ( a2 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return (*a1 == *a2);
|
return (*a1 == *a2);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue