mirror of
https://github.com/zeek/zeek.git
synced 2025-10-17 05:58:20 +00:00
Merge remote-tracking branch 'origin/topic/dnthayer/remove-unused-code'
* origin/topic/dnthayer/remove-unused-code: Remove deprecated attribute &disable_print_hook Remove unused argument of helper function Remove deprecated built-in functions Remove unused reserved keyword "this" Closes #885.
This commit is contained in:
commit
c412678e13
12 changed files with 24 additions and 134 deletions
12
NEWS
12
NEWS
|
@ -18,7 +18,17 @@ New Functionality
|
|||
Changed Functionality
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
- TODO: Update.
|
||||
- We removed the following, already deprecated, functionality:
|
||||
|
||||
* Scripting language:
|
||||
- &disable_print_hook attribute.
|
||||
|
||||
* BiF functions:
|
||||
- parse_dotted_addr(), dump_config(),
|
||||
make_connection_persistent(), generate_idmef(),
|
||||
split_complete()
|
||||
|
||||
- "this" is no longer a reserved keyword.
|
||||
|
||||
|
||||
Bro 2.1
|
||||
|
|
|
@ -29,7 +29,7 @@ class BroLexer(RegexLexer):
|
|||
r'|vector)\b', Keyword.Type),
|
||||
(r'(T|F)\b', Keyword.Constant),
|
||||
(r'(&)((?:add|delete|expire)_func|attr|(create|read|write)_expire'
|
||||
r'|default|disable_print_hook|raw_output|encrypt|group|log'
|
||||
r'|default|raw_output|encrypt|group|log'
|
||||
r'|mergeable|optional|persistent|priority|redef'
|
||||
r'|rotate_(?:interval|size)|synchronized)\b', bygroups(Punctuation,
|
||||
Keyword)),
|
||||
|
|
Binary file not shown.
|
@ -600,10 +600,6 @@ scripting language supports the following built-in attributes.
|
|||
|
||||
.. TODO: needs to be documented.
|
||||
|
||||
.. bro:attr:: &disable_print_hook
|
||||
|
||||
Deprecated. Will be removed.
|
||||
|
||||
.. bro:attr:: &raw_output
|
||||
|
||||
Opens a file in raw mode, i.e., non-ASCII characters are not
|
||||
|
|
|
@ -15,7 +15,7 @@ const char* attr_name(attr_tag t)
|
|||
"&add_func", "&delete_func", "&expire_func",
|
||||
"&read_expire", "&write_expire", "&create_expire",
|
||||
"&persistent", "&synchronized", "&postprocessor",
|
||||
"&encrypt", "&match", "&disable_print_hook",
|
||||
"&encrypt", "&match",
|
||||
"&raw_output", "&mergeable", "&priority",
|
||||
"&group", "&log", "&error_handler", "&type_column",
|
||||
"(&tracked)",
|
||||
|
@ -385,11 +385,6 @@ void Attributes::CheckAttr(Attr* a)
|
|||
// FIXME: Check here for global ID?
|
||||
break;
|
||||
|
||||
case ATTR_DISABLE_PRINT_HOOK:
|
||||
if ( type->Tag() != TYPE_FILE )
|
||||
Error("&disable_print_hook only applicable to files");
|
||||
break;
|
||||
|
||||
case ATTR_RAW_OUTPUT:
|
||||
if ( type->Tag() != TYPE_FILE )
|
||||
Error("&raw_output only applicable to files");
|
||||
|
|
|
@ -28,7 +28,6 @@ typedef enum {
|
|||
ATTR_POSTPROCESSOR,
|
||||
ATTR_ENCRYPT,
|
||||
ATTR_MATCH,
|
||||
ATTR_DISABLE_PRINT_HOOK,
|
||||
ATTR_RAW_OUTPUT,
|
||||
ATTR_MERGEABLE,
|
||||
ATTR_PRIORITY,
|
||||
|
|
|
@ -514,9 +514,6 @@ void BroFile::SetAttrs(Attributes* arg_attrs)
|
|||
InitEncrypt(log_encryption_key->AsString()->CheckString());
|
||||
}
|
||||
|
||||
if ( attrs->FindAttr(ATTR_DISABLE_PRINT_HOOK) )
|
||||
DisablePrintHook();
|
||||
|
||||
if ( attrs->FindAttr(ATTR_RAW_OUTPUT) )
|
||||
EnableRawOutput();
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ public:
|
|||
RecordVal* Rotate();
|
||||
|
||||
// Set &rotate_interval, &rotate_size, &postprocessor,
|
||||
// &disable_print_hook, and &raw_output attributes.
|
||||
// and &raw_output attributes.
|
||||
void SetAttrs(Attributes* attrs);
|
||||
|
||||
// Returns the current size of the file, after fresh stat'ing.
|
||||
|
|
82
src/bro.bif
82
src/bro.bif
|
@ -4858,7 +4858,7 @@ function file_size%(f: string%) : double
|
|||
%}
|
||||
|
||||
## Disables sending :bro:id:`print_hook` events to remote peers for a given
|
||||
## file. This function is equivalent to :bro:attr:`&disable_print_hook`. In a
|
||||
## file. In a
|
||||
## distributed setup, communicating Bro instances generate the event
|
||||
## :bro:id:`print_hook` for each print statement and send it to the remote
|
||||
## side. When disabled for a particular file, these events will not be
|
||||
|
@ -4874,7 +4874,7 @@ function disable_print_hook%(f: file%): any
|
|||
%}
|
||||
|
||||
## Prevents escaping of non-ASCII characters when writing to a file.
|
||||
## This function is equivalent to :bro:attr:`&disable_print_hook`.
|
||||
## This function is equivalent to :bro:attr:`&raw_output`.
|
||||
##
|
||||
## f: The file to disable raw output for.
|
||||
##
|
||||
|
@ -5683,12 +5683,6 @@ function match_signatures%(c: connection, pattern_type: int, s: string,
|
|||
#
|
||||
# ===========================================================================
|
||||
|
||||
## Deprecated. Will be removed.
|
||||
function parse_dotted_addr%(s: string%): addr
|
||||
%{
|
||||
IPAddr a(s->CheckString());
|
||||
return new AddrVal(a);
|
||||
%}
|
||||
|
||||
|
||||
%%{
|
||||
|
@ -5788,75 +5782,3 @@ function anonymize_addr%(a: addr, cl: IPAddrAnonymizationClass%): addr
|
|||
}
|
||||
%}
|
||||
|
||||
## Deprecated. Will be removed.
|
||||
function dump_config%(%) : bool
|
||||
%{
|
||||
return new Val(persistence_serializer->WriteConfig(true), TYPE_BOOL);
|
||||
%}
|
||||
|
||||
## Deprecated. Will be removed.
|
||||
function make_connection_persistent%(c: connection%) : any
|
||||
%{
|
||||
c->MakePersistent();
|
||||
return 0;
|
||||
%}
|
||||
|
||||
%%{
|
||||
// Experimental code to add support for IDMEF XML output based on
|
||||
// notices. For now, we're implementing it as a builtin you can call on an
|
||||
// notices record.
|
||||
|
||||
#ifdef USE_IDMEF
|
||||
extern "C" {
|
||||
#include <libidmef/idmefxml.h>
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
char* port_to_string(PortVal* port)
|
||||
{
|
||||
char buf[256]; // to hold sprintf results on port numbers
|
||||
snprintf(buf, sizeof(buf), "%u", port->Port());
|
||||
return copy_string(buf);
|
||||
}
|
||||
|
||||
%%}
|
||||
|
||||
## Deprecated. Will be removed.
|
||||
function generate_idmef%(src_ip: addr, src_port: port,
|
||||
dst_ip: addr, dst_port: port%) : bool
|
||||
%{
|
||||
#ifdef USE_IDMEF
|
||||
xmlNodePtr message =
|
||||
newIDMEF_Message(newAttribute("version","1.0"),
|
||||
newAlert(newCreateTime(NULL),
|
||||
newSource(
|
||||
newNode(newAddress(
|
||||
newAttribute("category","ipv4-addr"),
|
||||
newSimpleElement("address",
|
||||
copy_string(src_ip->AsAddr().AsString().c_str())),
|
||||
NULL), NULL),
|
||||
newService(
|
||||
newSimpleElement("port",
|
||||
port_to_string(src_port)),
|
||||
NULL), NULL),
|
||||
newTarget(
|
||||
newNode(newAddress(
|
||||
newAttribute("category","ipv4-addr"),
|
||||
newSimpleElement("address",
|
||||
copy_string(dst_ip->AsAddr().AsString().c_str())),
|
||||
NULL), NULL),
|
||||
newService(
|
||||
newSimpleElement("port",
|
||||
port_to_string(dst_port)),
|
||||
NULL), NULL), NULL), NULL);
|
||||
|
||||
// if ( validateCurrentDoc() )
|
||||
printCurrentMessage(stderr);
|
||||
return new Val(1, TYPE_BOOL);
|
||||
#else
|
||||
builtin_error("Bro was not configured for IDMEF support");
|
||||
return new Val(0, TYPE_BOOL);
|
||||
#endif
|
||||
%}
|
||||
|
|
15
src/parse.y
15
src/parse.y
|
@ -2,7 +2,7 @@
|
|||
// See the file "COPYING" in the main distribution directory for copyright.
|
||||
%}
|
||||
|
||||
%expect 90
|
||||
%expect 87
|
||||
|
||||
%token TOK_ADD TOK_ADD_TO TOK_ADDR TOK_ANY
|
||||
%token TOK_ATENDIF TOK_ATELSE TOK_ATIF TOK_ATIFDEF TOK_ATIFNDEF
|
||||
|
@ -14,7 +14,7 @@
|
|||
%token TOK_NEXT TOK_OF TOK_PATTERN TOK_PATTERN_TEXT
|
||||
%token TOK_PORT TOK_PRINT TOK_RECORD TOK_REDEF
|
||||
%token TOK_REMOVE_FROM TOK_RETURN TOK_SCHEDULE TOK_SET
|
||||
%token TOK_STRING TOK_SUBNET TOK_SWITCH TOK_TABLE TOK_THIS
|
||||
%token TOK_STRING TOK_SUBNET TOK_SWITCH TOK_TABLE
|
||||
%token TOK_TIME TOK_TIMEOUT TOK_TIMER TOK_TYPE TOK_UNION TOK_VECTOR TOK_WHEN
|
||||
|
||||
%token TOK_ATTR_ADD_FUNC TOK_ATTR_ATTR TOK_ATTR_ENCRYPT TOK_ATTR_DEFAULT
|
||||
|
@ -22,7 +22,7 @@
|
|||
%token TOK_ATTR_ROTATE_SIZE TOK_ATTR_DEL_FUNC TOK_ATTR_EXPIRE_FUNC
|
||||
%token TOK_ATTR_EXPIRE_CREATE TOK_ATTR_EXPIRE_READ TOK_ATTR_EXPIRE_WRITE
|
||||
%token TOK_ATTR_PERSISTENT TOK_ATTR_SYNCHRONIZED
|
||||
%token TOK_ATTR_DISABLE_PRINT_HOOK TOK_ATTR_RAW_OUTPUT TOK_ATTR_MERGEABLE
|
||||
%token TOK_ATTR_RAW_OUTPUT TOK_ATTR_MERGEABLE
|
||||
%token TOK_ATTR_PRIORITY TOK_ATTR_GROUP TOK_ATTR_LOG TOK_ATTR_ERROR_HANDLER
|
||||
%token TOK_ATTR_TYPE_COLUMN
|
||||
|
||||
|
@ -118,7 +118,6 @@ extern const char* g_curr_debug_error;
|
|||
|
||||
#define YYLTYPE yyltype
|
||||
|
||||
Expr* bro_this = 0;
|
||||
int in_init = 0;
|
||||
int in_record = 0;
|
||||
bool resolving_global_ID = false;
|
||||
|
@ -584,12 +583,6 @@ expr:
|
|||
$$ = new ConstExpr(new PatternVal($1));
|
||||
}
|
||||
|
||||
| TOK_THIS
|
||||
{
|
||||
set_location(@1);
|
||||
$$ = bro_this->Ref();
|
||||
}
|
||||
|
||||
| '|' expr '|'
|
||||
{
|
||||
set_location(@1, @3);
|
||||
|
@ -1297,8 +1290,6 @@ attr:
|
|||
{ $$ = new Attr(ATTR_ENCRYPT); }
|
||||
| TOK_ATTR_ENCRYPT '=' expr
|
||||
{ $$ = new Attr(ATTR_ENCRYPT, $3); }
|
||||
| TOK_ATTR_DISABLE_PRINT_HOOK
|
||||
{ $$ = new Attr(ATTR_DISABLE_PRINT_HOOK); }
|
||||
| TOK_ATTR_RAW_OUTPUT
|
||||
{ $$ = new Attr(ATTR_RAW_OUTPUT); }
|
||||
| TOK_ATTR_MERGEABLE
|
||||
|
|
|
@ -306,7 +306,6 @@ string return TOK_STRING;
|
|||
subnet return TOK_SUBNET;
|
||||
switch return TOK_SWITCH;
|
||||
table return TOK_TABLE;
|
||||
this return TOK_THIS;
|
||||
time return TOK_TIME;
|
||||
timeout return TOK_TIMEOUT;
|
||||
timer return TOK_TIMER;
|
||||
|
@ -320,7 +319,6 @@ when return TOK_WHEN;
|
|||
&create_expire return TOK_ATTR_EXPIRE_CREATE;
|
||||
&default return TOK_ATTR_DEFAULT;
|
||||
&delete_func return TOK_ATTR_DEL_FUNC;
|
||||
&disable_print_hook return TOK_ATTR_DISABLE_PRINT_HOOK;
|
||||
&raw_output return TOK_ATTR_RAW_OUTPUT;
|
||||
&encrypt return TOK_ATTR_ENCRYPT;
|
||||
&error_handler return TOK_ATTR_ERROR_HANDLER;
|
||||
|
|
|
@ -311,15 +311,9 @@ static int match_prefix(int s_len, const char* s, int t_len, const char* t)
|
|||
return 1;
|
||||
}
|
||||
|
||||
Val* do_split(StringVal* str_val, RE_Matcher* re, TableVal* other_sep,
|
||||
int incl_sep, int max_num_sep)
|
||||
Val* do_split(StringVal* str_val, RE_Matcher* re, int incl_sep, int max_num_sep)
|
||||
{
|
||||
TableVal* a = new TableVal(string_array);
|
||||
ListVal* other_strings = 0;
|
||||
|
||||
if ( other_sep && other_sep->Size() > 0 )
|
||||
other_strings = other_sep->ConvertToPureList();
|
||||
|
||||
const u_char* s = str_val->Bytes();
|
||||
int n = str_val->Len();
|
||||
const u_char* end_of_s = s + n;
|
||||
|
@ -373,9 +367,6 @@ Val* do_split(StringVal* str_val, RE_Matcher* re, TableVal* other_sep,
|
|||
reporter->InternalError("RegMatch in split goes beyond the string");
|
||||
}
|
||||
|
||||
if ( other_strings )
|
||||
delete other_strings;
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
|
@ -483,7 +474,7 @@ Val* do_sub(StringVal* str_val, RE_Matcher* re, StringVal* repl, int do_all)
|
|||
##
|
||||
function split%(str: string, re: pattern%): string_array
|
||||
%{
|
||||
return do_split(str, re, 0, 0, 0);
|
||||
return do_split(str, re, 0, 0);
|
||||
%}
|
||||
|
||||
## Splits a string *once* into a two-element array of strings according to a
|
||||
|
@ -503,7 +494,7 @@ function split%(str: string, re: pattern%): string_array
|
|||
## .. bro:see:: split split_all split_n str_split
|
||||
function split1%(str: string, re: pattern%): string_array
|
||||
%{
|
||||
return do_split(str, re, 0, 0, 1);
|
||||
return do_split(str, re, 0, 1);
|
||||
%}
|
||||
|
||||
## Splits a string into an array of strings according to a pattern. This
|
||||
|
@ -523,7 +514,7 @@ function split1%(str: string, re: pattern%): string_array
|
|||
## .. bro:see:: split split1 split_n str_split
|
||||
function split_all%(str: string, re: pattern%): string_array
|
||||
%{
|
||||
return do_split(str, re, 0, 1, 0);
|
||||
return do_split(str, re, 1, 0);
|
||||
%}
|
||||
|
||||
## Splits a string a given number of times into an array of strings according
|
||||
|
@ -549,16 +540,7 @@ function split_all%(str: string, re: pattern%): string_array
|
|||
function split_n%(str: string, re: pattern,
|
||||
incl_sep: bool, max_num_sep: count%): string_array
|
||||
%{
|
||||
return do_split(str, re, 0, incl_sep, max_num_sep);
|
||||
%}
|
||||
|
||||
## Deprecated. Will be removed.
|
||||
# Reason: the parameter ``other`` does nothing.
|
||||
function split_complete%(str: string,
|
||||
re: pattern, other: string_set,
|
||||
incl_sep: bool, max_num_sep: count%): string_array
|
||||
%{
|
||||
return do_split(str, re, other->AsTableVal(), incl_sep, max_num_sep);
|
||||
return do_split(str, re, incl_sep, max_num_sep);
|
||||
%}
|
||||
|
||||
## Substitutes a given replacement string for the first occurrence of a pattern
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue