diff --git a/CHANGES b/CHANGES index aff232a9b7..449b5c9eb4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,27 @@ +1.6-dev.99 Fri Apr 22 22:10:03 PDT 2011 + +- Extending the connection record with a unique identifier. (Robin + Sommer) + + type connection: record { + [...] + id: string; + }; + + These identifiers very likely unique even across independent Bro + runs. + +- Delete operator for record fields. (Robin Sommer) + + "delete x$y" now resets record field "x" back to its original state + if it is either &optional or has a &default. "delete" may not be + used with non-optional/default fields. + +- Fixing bug with nested record coercions. (Robin Sommer) + +- Fixing a do_split() bug. (Seth Hall) + + 1.6-dev.94 Thu Apr 21 19:51:38 PDT 2011 - Fixing generation of config.h. (Jon Siwek) diff --git a/Makefile b/Makefile index d2620b422c..77f0626cdc 100644 --- a/Makefile +++ b/Makefile @@ -23,13 +23,13 @@ install: configured clean: configured ( cd $(BUILD) && make clean ) - ( cd $(BUILD) && make doc-clean ) + ( cd $(BUILD) && make docclean && make restclean ) doc: configured ( cd $(BUILD) && make doc ) -doc-clean: configured - ( cd $(BUILD) && make doc-clean ) +docclean: configured + ( cd $(BUILD) && make docclean && make restclean ) dist: cmake_version # Minimum Bro source package diff --git a/VERSION b/VERSION index 110b0b440a..359249d5d6 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.6-dev.94 +1.6-dev.99 diff --git a/aux/binpac b/aux/binpac index 43994f50b3..4fc13f7c69 160000 --- a/aux/binpac +++ b/aux/binpac @@ -1 +1 @@ -Subproject commit 43994f50b320ff9e1d129b87bbe3a26dbfb3e33d +Subproject commit 4fc13f7c6987b4163609e3df7a31f38501411cb7 diff --git a/aux/bro-aux b/aux/bro-aux index 3ec53f69fd..14a7cfe4ea 160000 --- a/aux/bro-aux +++ b/aux/bro-aux @@ -1 +1 @@ -Subproject commit 3ec53f69fd45d8e2c0950dc0e7af117bb3e02c0d +Subproject commit 14a7cfe4ea2ff6c7f5301dcb81a869adcd6e9834 diff --git a/aux/broccoli b/aux/broccoli index 9c5d8c8824..8843da57dc 160000 --- a/aux/broccoli +++ b/aux/broccoli @@ -1 +1 @@ -Subproject commit 9c5d8c882411dc26de8ef92ff5d77b524b9d48ee +Subproject commit 8843da57dc8aee433550727dcbd1199824ca9da4 diff --git a/aux/broctl b/aux/broctl index 7f33745957..1bf5407722 160000 --- a/aux/broctl +++ b/aux/broctl @@ -1 +1 @@ -Subproject commit 7f337459574d027559e419219e83c65d8a6e1c23 +Subproject commit 1bf5407722ef5910bafd513bcec6a51b280eeb10 diff --git a/aux/btest b/aux/btest index aee56f4632..f096c0e408 160000 --- a/aux/btest +++ b/aux/btest @@ -1 +1 @@ -Subproject commit aee56f4632c9a4224727da1b535b673a4bcb5d3b +Subproject commit f096c0e4088f2d92743e0c28077f086dff216cce diff --git a/cmake/ConfigurePackaging.cmake b/cmake/ConfigurePackaging.cmake index f77dcc0fae..6d7cb3d76f 100644 --- a/cmake/ConfigurePackaging.cmake +++ b/cmake/ConfigurePackaging.cmake @@ -63,10 +63,7 @@ endmacro(SetPackageVersion) # # Darwin - PackageMaker # Linux - RPM if the platform has rpmbuild installed -# DEB is ommitted because CPack does not give enough -# control over how the package is created and lacks support -# for automatic dependency detection. -# +# DEB if the platform has dpkg-shlibdeps installed # # CPACK_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) elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux") find_program(RPMBUILD_EXE rpmbuild) + find_program(DPKGSHLIB_EXE dpkg-shlibdeps) if (RPMBUILD_EXE) set(CPACK_GENERATOR ${CPACK_GENERATOR} RPM) endif () + if (DPKGSHLIB_EXE) + set(CPACK_GENERATOR ${CPACK_GENERATOR} DEB) + set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS true) + endif () endif () endmacro(SetPackageGenerators) @@ -159,11 +161,27 @@ macro(SetPackageInstallScripts VERSION) endif () 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 - # bypass the logic in the pre/post install scripts and let - # the RPM do their own thing (regarding backups, etc.) + # bypass the logic in the default pre/post install scripts and let + # the RPMs/DEBs do their own thing (regarding backups, etc.) # when upgrading packages. - set (INSTALLED_CONFIG_FILES "") + set(INSTALLED_CONFIG_FILES "") endif () 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_BINARY_DIR}/package_preinstall.sh @ONLY) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_preinstall.sh.in + ${CMAKE_CURRENT_BINARY_DIR}/preinst + @ONLY) set(CPACK_PREFLIGHT_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh) set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_BINARY_DIR}/package_preinstall.sh) + list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + ${CMAKE_CURRENT_BINARY_DIR}/preinst) endif () 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_BINARY_DIR}/package_postupgrade.sh @ONLY) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/package_postupgrade.sh.in + ${CMAKE_CURRENT_BINARY_DIR}/postinst + @ONLY) set(CPACK_POSTUPGRADE_SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh) set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_BINARY_DIR}/package_postupgrade.sh) + list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA + ${CMAKE_CURRENT_BINARY_DIR}/postinst) endif () endmacro(SetPackageInstallScripts) diff --git a/cmake/package_postupgrade.sh.in b/cmake/package_postupgrade.sh.in index 0ef78413c3..4e199d005c 100755 --- a/cmake/package_postupgrade.sh.in +++ b/cmake/package_postupgrade.sh.in @@ -48,21 +48,13 @@ if [ -n "${sampleFiles}" ]; then EOF fi -# make sure that world-writeable dirs have the sticky bit set -# so that unprivileged can't rename/remove files within - -if [ -d /var/opt/bro/spool ]; then - chmod +t /var/opt/bro/spool -fi - -if [ -d /var/opt/bro/spool/tmp ]; then - chmod +t /var/opt/bro/spool/tmp -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 +# Set up world writeable spool and logs directory for broctl, making sure +# 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 [ -n "@EMPTY_WORLD_DIRS@" ]; then + for dir in "@EMPTY_WORLD_DIRS@"; do + mkdir -p ${dir} + chmod 777 ${dir} + chmod +t ${dir} + done fi diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 00e0974919..e2c3f25f4e 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,42 +1 @@ -set(POLICY_SRC_DIR ${PROJECT_SOURCE_DIR}/policy) -set(DOC_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/out) -set(DOC_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source) -set(DOC_SOURCE_WORKDIR ${CMAKE_CURRENT_BINARY_DIR}/source) - -file(GLOB_RECURSE DOC_SOURCES FOLLOW_SYMLINKS "*") - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/conf.py.in - ${CMAKE_CURRENT_BINARY_DIR}/conf.py - @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/generate_reST_docs.py.in - ${CMAKE_CURRENT_BINARY_DIR}/generate_reST_docs.py - @ONLY) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/BroToReST.py.in - ${CMAKE_CURRENT_BINARY_DIR}/BroToReST.py - @ONLY) - -add_custom_target(doc - COMMAND "${CMAKE_COMMAND}" -E copy_directory - ${DOC_SOURCE_DIR} - ${DOC_SOURCE_WORKDIR} - COMMAND python generate_reST_docs.py - COMMAND sphinx-build - -b html - -c ${CMAKE_CURRENT_BINARY_DIR} - -d ${DOC_OUTPUT_DIR}/doctrees - ${DOC_SOURCE_WORKDIR} - ${DOC_OUTPUT_DIR}/html - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "[Sphinx] Generating Script Documentation" - VERBATIM - # SOURCES just adds stuff to IDE projects as a convienience - SOURCES ${DOC_SOURCES}) - -add_dependencies(doc bro doc-clean) - -add_custom_target(doc-clean - COMMAND "${CMAKE_COMMAND}" -E remove_directory - ${CMAKE_CURRENT_BINARY_DIR}/source - COMMAND "${CMAKE_COMMAND}" -E remove_directory - ${DOC_OUTPUT_DIR} - VERBATIM) +add_subdirectory(scripts) diff --git a/doc/README b/doc/README index 150260ed09..1333ed77b7 100644 --- a/doc/README +++ b/doc/README @@ -1,44 +1 @@ -This directory contains scripts and templates that can be used to automate -the generation of Bro script documentation. Two build targets are defined -by CMake: - -``make doc`` - - This target depends on a Python interpreter (>=2.5) and - `Sphinx `_ being installed. Sphinx can be - installed like:: - - > sudo easy_install sphinx - - This target will also first build the bro binary if it is not already - since the generation of reStructuredText (reST) documentation from - Bro scripts is integrated within the parsing process. - - After completion, HTML documentation can be located inside the CMake - ``build/`` directory as ``build/doc/out/html``. The generated reST - documentation will be located in ``build/doc/source/policy``. - -``make doc-clean`` - - This target removes Sphinx inputs and outputs from the CMake ``build/`` dir. - -To schedule a script to be documented, edit ``scripts/generate_reST_docs.py.in`` -and try adding the name of the script along with an optional script group to -the ``docs`` dictionary. That python script also shows other, more specialized -methods for generating documentation for some types of corner-cases. - -When adding a new logical grouping for generated scripts, create a new -reST document in ``source/policy/.rst`` and add some default -documentation. References to (and summaries of) documents associated with -the group get appended to this file during the ``make doc`` process. - -The Sphinx source tree template in ``source/`` can be modified to add more -common/general documentation, style sheets, JavaScript, etc. The Sphinx -config file is produced from ``conf.py.in``, so that can be edited to change -various Sphinx options, like setting the default HTML rendering theme. -There is also a custom Sphinx domain implemented in ``source/ext/bro.py`` -which adds some reST directives and roles that aid in generating useful -index entries and cross-references. - -See ``example.bro`` for an example of how to document a Bro script such that -``make doc`` will be able to produce reST/HTML documentation for it. +TODO diff --git a/doc/scripts/BroToReST.py.in b/doc/scripts/BroToReST.py.in deleted file mode 100755 index 89a8e1cc57..0000000000 --- a/doc/scripts/BroToReST.py.in +++ /dev/null @@ -1,152 +0,0 @@ -#! /usr/bin/env python - -import os -import subprocess -import shutil -import glob -import string -import sys - -BRO = "@CMAKE_BINARY_DIR@/src/bro" -BROPATHDEV = "`@CMAKE_BINARY_DIR@/bro-path-dev`" -BRO_ARGS = "--doc-scripts" -DOC_DST_DIR = "@DOC_SOURCE_WORKDIR@/policy" -BROPATH = subprocess.Popen("@CMAKE_BINARY_DIR@/bro-path-dev", shell=True, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.readline() - -class BroToReST: - """A class to encapsulate the the generation of reST documentation from - a given Bro script. - """ - - bro_src_file = None - doc_src_file = None - load_via_stdin = False - group = None - - def __init__(self, src_file, load_method=False, search_dir=None, group=None): - """ - :param src_file: the file name of a Bro script (not a path) - :param load_method: T if script must be loaded by Bro via a stdin - redirection of "@load