mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 12:08:20 +00:00
Merge branch 'master' into topic/policy-scripts-new
This commit is contained in:
commit
f0143c3c5f
10 changed files with 135 additions and 143 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 54f3ff4e6627d4a44d1e014e8e581e4e9dfed8c3
|
Subproject commit 8843da57dc8aee433550727dcbd1199824ca9da4
|
|
@ -1 +1 @@
|
||||||
Subproject commit d9bfa3e7c25aa0fdc27a1f8520f2bb474ecd44af
|
Subproject commit 1bf5407722ef5910bafd513bcec6a51b280eeb10
|
|
@ -63,10 +63,7 @@ endmacro(SetPackageVersion)
|
||||||
#
|
#
|
||||||
# Darwin - PackageMaker
|
# Darwin - PackageMaker
|
||||||
# Linux - RPM if the platform has rpmbuild installed
|
# Linux - RPM if the platform has rpmbuild installed
|
||||||
# DEB is ommitted because CPack does not give enough
|
# DEB if the platform has dpkg-shlibdeps installed
|
||||||
# control over how the package is created and lacks support
|
|
||||||
# for automatic dependency detection.
|
|
||||||
#
|
|
||||||
#
|
#
|
||||||
# CPACK_GENERATOR is set by this macro
|
# CPACK_GENERATOR is set by this macro
|
||||||
# CPACK_SOURCE_GENERATOR is set by this macro
|
# CPACK_SOURCE_GENERATOR is set by this macro
|
||||||
|
@ -77,9 +74,14 @@ macro(SetPackageGenerators)
|
||||||
list(APPEND CPACK_GENERATOR PackageMaker)
|
list(APPEND CPACK_GENERATOR PackageMaker)
|
||||||
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
find_program(RPMBUILD_EXE rpmbuild)
|
find_program(RPMBUILD_EXE rpmbuild)
|
||||||
|
find_program(DPKGSHLIB_EXE dpkg-shlibdeps)
|
||||||
if (RPMBUILD_EXE)
|
if (RPMBUILD_EXE)
|
||||||
set(CPACK_GENERATOR ${CPACK_GENERATOR} RPM)
|
set(CPACK_GENERATOR ${CPACK_GENERATOR} RPM)
|
||||||
endif ()
|
endif ()
|
||||||
|
if (DPKGSHLIB_EXE)
|
||||||
|
set(CPACK_GENERATOR ${CPACK_GENERATOR} DEB)
|
||||||
|
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS true)
|
||||||
|
endif ()
|
||||||
endif ()
|
endif ()
|
||||||
endmacro(SetPackageGenerators)
|
endmacro(SetPackageGenerators)
|
||||||
|
|
||||||
|
@ -159,11 +161,27 @@ macro(SetPackageInstallScripts VERSION)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
||||||
|
# DEB packages can automatically handle configuration files
|
||||||
|
# if provided in a "conffiles" file in the packaging
|
||||||
|
set(conffiles_file ${CMAKE_CURRENT_BINARY_DIR}/conffiles)
|
||||||
|
if (INSTALLED_CONFIG_FILES)
|
||||||
|
string(REPLACE " " ";" conffiles ${INSTALLED_CONFIG_FILES})
|
||||||
|
endif ()
|
||||||
|
file(WRITE ${conffiles_file} "")
|
||||||
|
foreach (_file ${conffiles})
|
||||||
|
file(APPEND ${conffiles_file} "${_file}\n")
|
||||||
|
endforeach ()
|
||||||
|
|
||||||
|
list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/conffiles)
|
||||||
|
|
||||||
|
# RPMs don't need any explicit direction regarding config files.
|
||||||
|
|
||||||
# Leaving the set of installed config files empty will just
|
# Leaving the set of installed config files empty will just
|
||||||
# bypass the logic in the pre/post install scripts and let
|
# bypass the logic in the default pre/post install scripts and let
|
||||||
# the RPM do their own thing (regarding backups, etc.)
|
# the RPMs/DEBs do their own thing (regarding backups, etc.)
|
||||||
# when upgrading packages.
|
# when upgrading packages.
|
||||||
set (INSTALLED_CONFIG_FILES "")
|
set(INSTALLED_CONFIG_FILES "")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_preinstall.sh.in)
|
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_preinstall.sh.in)
|
||||||
|
@ -171,10 +189,16 @@ macro(SetPackageInstallScripts VERSION)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_preinstall.sh.in
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_preinstall.sh.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh
|
${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_preinstall.sh.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/preinst
|
||||||
|
@ONLY)
|
||||||
set(CPACK_PREFLIGHT_SCRIPT
|
set(CPACK_PREFLIGHT_SCRIPT
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh)
|
${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh)
|
||||||
set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
|
set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh)
|
${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh)
|
||||||
|
list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/preinst)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_postupgrade.sh.in)
|
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_postupgrade.sh.in)
|
||||||
|
@ -182,10 +206,16 @@ macro(SetPackageInstallScripts VERSION)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_postupgrade.sh.in
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_postupgrade.sh.in
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh
|
${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh
|
||||||
@ONLY)
|
@ONLY)
|
||||||
|
configure_file(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_postupgrade.sh.in
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/postinst
|
||||||
|
@ONLY)
|
||||||
set(CPACK_POSTUPGRADE_SCRIPT
|
set(CPACK_POSTUPGRADE_SCRIPT
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh)
|
${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh)
|
||||||
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
|
set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh)
|
${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh)
|
||||||
|
list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/postinst)
|
||||||
endif ()
|
endif ()
|
||||||
endmacro(SetPackageInstallScripts)
|
endmacro(SetPackageInstallScripts)
|
||||||
|
|
||||||
|
|
|
@ -48,21 +48,13 @@ if [ -n "${sampleFiles}" ]; then
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# make sure that world-writeable dirs have the sticky bit set
|
# Set up world writeable spool and logs directory for broctl, making sure
|
||||||
# so that unprivileged can't rename/remove files within
|
# to set the sticky bit so that unprivileged users can't rename/remove files.
|
||||||
|
# (CMake/CPack is supposed to install them, but has problems with empty dirs)
|
||||||
if [ -d /var/opt/bro/spool ]; then
|
if [ -n "@EMPTY_WORLD_DIRS@" ]; then
|
||||||
chmod +t /var/opt/bro/spool
|
for dir in "@EMPTY_WORLD_DIRS@"; do
|
||||||
fi
|
mkdir -p ${dir}
|
||||||
|
chmod 777 ${dir}
|
||||||
if [ -d /var/opt/bro/spool/tmp ]; then
|
chmod +t ${dir}
|
||||||
chmod +t /var/opt/bro/spool/tmp
|
done
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d /var/opt/bro/spool/policy ]; then
|
|
||||||
chmod +t /var/opt/bro/spool/policy
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -d /var/opt/bro/logs ]; then
|
|
||||||
chmod +t /var/opt/bro/logs
|
|
||||||
fi
|
fi
|
||||||
|
|
52
make-deb-packages
Executable file
52
make-deb-packages
Executable file
|
@ -0,0 +1,52 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# This script generates binary DEB packages.
|
||||||
|
# They can be found in build/ after running.
|
||||||
|
|
||||||
|
prefix=/opt/bro
|
||||||
|
|
||||||
|
# CMake/CPack versions before 2.8.2 have bugs that can create bad packages
|
||||||
|
CMAKE_PACK_REQ=2.8.2
|
||||||
|
CMAKE_VER=`cmake -version`
|
||||||
|
|
||||||
|
if [ "${CMAKE_VER}" \< "${CMAKE_PACK_REQ}" ]; then
|
||||||
|
echo "Package creation requires CMake > 2.8.2" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The DEB CPack generator depends on `dpkg-shlibdeps` to automatically
|
||||||
|
# determine what dependencies to set for the packages
|
||||||
|
type dpkg-shlibdeps > /dev/null 2>&1 || {
|
||||||
|
echo "\
|
||||||
|
Creating DEB packages requires the `dpkg-shlibs` command, usually provided by
|
||||||
|
the 'dpkg-dev' package, please install it first.
|
||||||
|
" >&2;
|
||||||
|
exit 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
# During the packaging process, `dpkg-shlibs` will fail if used on a library
|
||||||
|
# that links to other internal/project libraries unless an RPATH is used or
|
||||||
|
# we set LD_LIBRARY_PATH such that it can find the internal/project library
|
||||||
|
# in the temporary packaging tree.
|
||||||
|
export LD_LIBRARY_PATH=./${prefix}/lib
|
||||||
|
|
||||||
|
# Minimum Bro
|
||||||
|
./configure --prefix=${prefix} --disable-broccoli --disable-broctl \
|
||||||
|
--pkg-name-prefix=Bro --binary-package
|
||||||
|
( cd build && make package )
|
||||||
|
|
||||||
|
# Full Bro package
|
||||||
|
./configure --prefix=${prefix} --pkg-name-prefix=Bro-all --binary-package
|
||||||
|
( cd build && make package )
|
||||||
|
|
||||||
|
# Broccoli
|
||||||
|
cd aux/broccoli
|
||||||
|
./configure --prefix=${prefix} --binary-package
|
||||||
|
( cd build && make package && mv Broccoli*.deb ../../../build/ )
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
# Broctl
|
||||||
|
cd aux/broctl
|
||||||
|
./configure --prefix=${prefix} --binary-package
|
||||||
|
( cd build && make package && mv Broctl*.deb ../../../build/ )
|
||||||
|
cd ../..
|
29
src/Var.cc
29
src/Var.cc
|
@ -242,15 +242,26 @@ void add_type(ID* id, BroType* t, attr_list* attr, int /* is_event */)
|
||||||
// t->GetTypeID() is true.
|
// t->GetTypeID() is true.
|
||||||
if ( generate_documentation )
|
if ( generate_documentation )
|
||||||
{
|
{
|
||||||
if ( t->Tag() == TYPE_RECORD )
|
switch ( t->Tag() ) {
|
||||||
{
|
// Only "shallow" copy types that may contain records because
|
||||||
// Only "shallow" copy record types because we want to be able
|
// we want to be able to see additions to the original record type's
|
||||||
// to see additions to the original type's list of fields
|
// list of fields
|
||||||
|
case TYPE_RECORD:
|
||||||
tnew = new RecordType(t->AsRecordType()->Types());
|
tnew = new RecordType(t->AsRecordType()->Types());
|
||||||
}
|
break;
|
||||||
|
case TYPE_TABLE:
|
||||||
else
|
tnew = new TableType(t->AsTableType()->Indices(),
|
||||||
{
|
t->AsTableType()->YieldType());
|
||||||
|
break;
|
||||||
|
case TYPE_VECTOR:
|
||||||
|
tnew = new VectorType(t->AsVectorType()->YieldType());
|
||||||
|
break;
|
||||||
|
case TYPE_FUNC:
|
||||||
|
tnew = new FuncType(t->AsFuncType()->Args(),
|
||||||
|
t->AsFuncType()->YieldType(),
|
||||||
|
t->AsFuncType()->IsEvent());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
SerializationFormat* form = new BinarySerializationFormat();
|
SerializationFormat* form = new BinarySerializationFormat();
|
||||||
form->StartWrite();
|
form->StartWrite();
|
||||||
CloneSerializer ss(form);
|
CloneSerializer ss(form);
|
||||||
|
@ -267,7 +278,7 @@ void add_type(ID* id, BroType* t, attr_list* attr, int /* is_event */)
|
||||||
tnew = t->Unserialize(&uinfo);
|
tnew = t->Unserialize(&uinfo);
|
||||||
|
|
||||||
delete [] data;
|
delete [] data;
|
||||||
}
|
}
|
||||||
|
|
||||||
tnew->SetTypeID(copy_string(id->Name()));
|
tnew->SetTypeID(copy_string(id->Name()));
|
||||||
}
|
}
|
||||||
|
|
|
@ -1093,8 +1093,10 @@ decl:
|
||||||
new RecordType(fake_type_decl_list);
|
new RecordType(fake_type_decl_list);
|
||||||
ID* fake = create_dummy_id($3, fake_record);
|
ID* fake = create_dummy_id($3, fake_record);
|
||||||
fake_type_decl_list = 0;
|
fake_type_decl_list = 0;
|
||||||
current_reST_doc->AddRedef(
|
BroDocObj* o =
|
||||||
new BroDocObj(fake, reST_doc_comments, true));
|
new BroDocObj(fake, reST_doc_comments, true);
|
||||||
|
o->SetRole(true);
|
||||||
|
current_reST_doc->AddRedef(o);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -279,7 +279,7 @@ Redefinitions
|
||||||
|
|
||||||
document the "SimpleEnum" redef here
|
document the "SimpleEnum" redef here
|
||||||
|
|
||||||
.. bro:type:: Example::SimpleRecord
|
:bro:type:`Example::SimpleRecord`
|
||||||
|
|
||||||
:Type: :bro:type:`record`
|
:Type: :bro:type:`record`
|
||||||
|
|
||||||
|
|
|
@ -1,99 +0,0 @@
|
||||||
.. Automatically generated. Do not edit.
|
|
||||||
|
|
||||||
autogen-reST-record-add.bro
|
|
||||||
===========================
|
|
||||||
|
|
||||||
:download:`Original Source File <autogen-reST-record-add.bro>`
|
|
||||||
|
|
||||||
Overview
|
|
||||||
--------
|
|
||||||
|
|
||||||
|
|
||||||
Summary
|
|
||||||
~~~~~~~
|
|
||||||
State Variables
|
|
||||||
###############
|
|
||||||
===================================== =
|
|
||||||
:bro:id:`a`: :bro:type:`my_record`
|
|
||||||
|
|
||||||
:bro:id:`b`: :bro:type:`super_record`
|
|
||||||
===================================== =
|
|
||||||
|
|
||||||
Types
|
|
||||||
#####
|
|
||||||
============================================ =
|
|
||||||
:bro:type:`my_record`: :bro:type:`record`
|
|
||||||
|
|
||||||
:bro:type:`super_record`: :bro:type:`record`
|
|
||||||
============================================ =
|
|
||||||
|
|
||||||
Functions
|
|
||||||
#########
|
|
||||||
===================================== =
|
|
||||||
:bro:id:`test_func`: :bro:type:`func`
|
|
||||||
===================================== =
|
|
||||||
|
|
||||||
Redefinitions
|
|
||||||
#############
|
|
||||||
========================================= =
|
|
||||||
:bro:type:`my_record`: :bro:type:`record`
|
|
||||||
========================================= =
|
|
||||||
|
|
||||||
Public Interface
|
|
||||||
----------------
|
|
||||||
State Variables
|
|
||||||
~~~~~~~~~~~~~~~
|
|
||||||
.. bro:id:: a
|
|
||||||
|
|
||||||
:Type: :bro:type:`my_record`
|
|
||||||
:Default:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
{
|
|
||||||
field1=<uninitialized>
|
|
||||||
field2=<uninitialized>
|
|
||||||
field3=<uninitialized>
|
|
||||||
}
|
|
||||||
|
|
||||||
.. bro:id:: b
|
|
||||||
|
|
||||||
:Type: :bro:type:`super_record`
|
|
||||||
:Default:
|
|
||||||
|
|
||||||
::
|
|
||||||
|
|
||||||
{
|
|
||||||
rec=[field1=<uninitialized>, field2=<uninitialized>, field3=<uninitialized>]
|
|
||||||
}
|
|
||||||
|
|
||||||
Types
|
|
||||||
~~~~~
|
|
||||||
.. bro:type:: my_record
|
|
||||||
|
|
||||||
:Type: :bro:type:`record`
|
|
||||||
|
|
||||||
field1: :bro:type:`bool`
|
|
||||||
|
|
||||||
field2: :bro:type:`string`
|
|
||||||
|
|
||||||
.. bro:type:: super_record
|
|
||||||
|
|
||||||
:Type: :bro:type:`record`
|
|
||||||
|
|
||||||
rec: :bro:type:`my_record`
|
|
||||||
|
|
||||||
Functions
|
|
||||||
~~~~~~~~~
|
|
||||||
.. bro:id:: test_func
|
|
||||||
|
|
||||||
:Type: :bro:type:`function` () : :bro:type:`void`
|
|
||||||
|
|
||||||
Redefinitions
|
|
||||||
~~~~~~~~~~~~~
|
|
||||||
.. bro:type:: my_record
|
|
||||||
|
|
||||||
:Type: :bro:type:`record`
|
|
||||||
|
|
||||||
field3: :bro:type:`count` :bro:attr:`&optional`
|
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
# @TEST-EXEC: bro --doc-scripts %INPUT
|
# @TEST-EXEC: bro --doc-scripts %INPUT
|
||||||
# @TEST-EXEC: btest-diff autogen-reST-record-add.rst
|
|
||||||
|
|
||||||
# When in doc mode, bro will clone declared types (see add_type() in Var.cc)
|
# When in doc mode, bro will clone declared types (see add_type() in Var.cc)
|
||||||
# in order to keep track of the identifier name associated with the new type.
|
# in order to keep track of the identifier name associated with the new type.
|
||||||
# This test makes sure that the cloning is done in a way that's compatible
|
# This test makes sure that the cloning is done in a way that's compatible
|
||||||
# with adding fields to a record type -- we want to be sure that cloning
|
# with adding fields to a record type -- we want to be sure that cloning
|
||||||
# a record that contains other record fields will correctly see field
|
# a type that contains record types will correctly see field additions to
|
||||||
# additions to those contained-records.
|
# those contained-records.
|
||||||
|
|
||||||
type my_record: record {
|
type my_record: record {
|
||||||
field1: bool;
|
field1: bool;
|
||||||
|
@ -16,17 +15,22 @@ type my_record: record {
|
||||||
type super_record: record {
|
type super_record: record {
|
||||||
rec: my_record;
|
rec: my_record;
|
||||||
};
|
};
|
||||||
|
type my_table: table[count] of my_record;
|
||||||
|
type my_vector: vector of my_record;
|
||||||
|
|
||||||
redef record my_record += {
|
redef record my_record += {
|
||||||
field3: count &optional;
|
field3: count &optional;
|
||||||
};
|
};
|
||||||
|
|
||||||
global a: my_record;
|
global a: my_record;
|
||||||
|
|
||||||
global b: super_record;
|
global b: super_record;
|
||||||
|
global c: my_table;
|
||||||
|
global d: my_vector;
|
||||||
|
|
||||||
function test_func()
|
function test_func()
|
||||||
{
|
{
|
||||||
a?$field3;
|
a?$field3;
|
||||||
b$rec?$field3;
|
b$rec?$field3;
|
||||||
}
|
c[0]$field3;
|
||||||
|
d[0]$field3;
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue