Merge with Subversion repository as of r7098.

This commit is contained in:
Robin Sommer 2010-11-27 12:21:17 -08:00
parent e95adb8055
commit b0cb05de64
6 changed files with 35 additions and 7 deletions

12
CHANGES
View file

@ -2,6 +2,18 @@
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
1.6-dev.1 Sat Nov 27 12:19:47 PST 2010
- Merge with Subversion repository as of r7098. Incorporated changes:
* Rotation post-processors are now passed an additional argument
indicating whether Bro is terminating (Robin Sommer).
* Bro now consistently generates a file_opened event for all
fopen() calls. (Robin Sommer).
* You can now redefine the email_notice_to function (Robin
Sommer).
1.6-dev.0 Fri Nov 26 13:48:11 PST 2010 1.6-dev.0 Fri Nov 26 13:48:11 PST 2010

View file

@ -1 +1 @@
1.6-dev.0 1.6-dev.1

View file

@ -272,6 +272,8 @@ function build_notice_info_string_tagged(n: notice_info) : string
return cur_info; return cur_info;
} }
global email_notice_to: function(n: notice_info, dest: string) &redef;
function email_notice_to(n: notice_info, dest: string) function email_notice_to(n: notice_info, dest: string)
{ {
if ( reading_traces() || dest == "" ) if ( reading_traces() || dest == "" )

View file

@ -56,10 +56,11 @@ function run_pp(info: rotate_info)
if ( pp != "" ) if ( pp != "" )
# The date format is hard-coded here to provide a standardized # The date format is hard-coded here to provide a standardized
# script interface. # script interface.
system(fmt("%s %s %s %s %s %s", system(fmt("%s %s %s %s %s %s %s",
pp, info$new_name, info$old_name, pp, info$new_name, info$old_name,
strftime("%y-%m-%d_%H.%M.%S", info$open), strftime("%y-%m-%d_%H.%M.%S", info$open),
strftime("%y-%m-%d_%H.%M.%S", info$close), strftime("%y-%m-%d_%H.%M.%S", info$close),
bro_is_terminating() ? "1" : "0",
tag)); tag));
else else
system(fmt("/bin/mv %s %s %s", system(fmt("/bin/mv %s %s %s",

View file

@ -217,11 +217,8 @@ bool BroFile::Open(FILE* file)
return false; return false;
} }
val_list* vl = new val_list; RaiseOpenEvent();
Ref(this);
vl->append(new Val(this));
Event* event = new ::Event(::file_opened, vl);
mgr.Dispatch(event, true);
return true; return true;
} }
@ -299,6 +296,7 @@ FILE* BroFile::BringIntoCache()
return f; return f;
} }
RaiseOpenEvent();
UpdateFileSize(); UpdateFileSize();
if ( fseek(f, position, SEEK_SET) < 0 ) if ( fseek(f, position, SEEK_SET) < 0 )
@ -783,6 +781,18 @@ int BroFile::Write(const char* data, int len)
return true; return true;
} }
void BroFile::RaiseOpenEvent()
{
if ( ! ::file_opened )
return;
val_list* vl = new val_list;
Ref(this);
vl->append(new Val(this));
Event* event = new ::Event(::file_opened, vl);
mgr.Dispatch(event, true);
}
void BroFile::UpdateFileSize() void BroFile::UpdateFileSize()
{ {
struct stat s; struct stat s;

View file

@ -112,6 +112,9 @@ protected:
// Stats the file to get its current size. // Stats the file to get its current size.
void UpdateFileSize(); void UpdateFileSize();
// Raises a file_opened event.
void RaiseOpenEvent();
// Initialize encryption with the given public key. // Initialize encryption with the given public key.
void InitEncrypt(const char* keyfile); void InitEncrypt(const char* keyfile);
// Finalize encryption. // Finalize encryption.