Merge pull request #29 from Tripwire/dev/q1-2018

Open Source Tripwire 2.4.3.7
This commit is contained in:
Brian Cox 2018-03-30 23:05:50 -07:00 committed by GitHub
commit 6e64a9e5b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
484 changed files with 28286 additions and 26307 deletions

115
.clang-format Normal file
View File

@ -0,0 +1,115 @@
---
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: Left
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: true
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterObjCDeclaration: true
AfterStruct: true
AfterUnion: true
AfterExternBlock: true
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 120
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: AfterHash
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 2
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Left
RawStringFormats:
- Delimiter: pb
Language: TextProto
BasedOnStyle: google
ReflowComments: false
SortIncludes: false
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 4
UseTab: Never
...

View File

@ -1,3 +1,16 @@
2018-03-24 Brian Cox <bcox@tripwire.com>
* Update version to 2.4.3.7
* Provide a useful README.md (Github issue #17).
* Document return codes in man pages (Github issue #28).
* Update install script after testing on additional platforms.
* Provide default policies for more operating systems, and update some existing policies
* Usability tweaks to twtest.
* Fix email reporting on Syllable
* Update copyright dates to 2018
* Clean up code style with clang-format, & add a custom style that approximates existing OST usage.
* Add -t / --output-level option to print-db mode, for consistency w/ print-report mode.
* Add object list support to print-report mode, for consistency w/ print-db mode.
2017-10-01 Brian Cox <bcox@tripwire.com>
* Update version to 2.4.3.6
* Fix & expand tests in Perl acceptance test framework

View File

@ -3,7 +3,7 @@ SUBDIRS = man src
EXTRA_DIST = COMMERCIAL MAINTAINERS TRADEMARK LICENSE Packaging ReadMe-2.4.3 README.md autogen.sh autogen.sh.README touchconfig.sh contrib policy installer
install-data-hook:
export INSTALL_STRIP_FLAG
INSTALL_STRIP_FLAG="$(INSTALL_STRIP_FLAG)" \
prefix="$(prefix)" sysconfdir="$(sysconfdir)" \
path_to_vi="$(path_to_vi)" path_to_sendmail="$(path_to_sendmail)" \
$(top_srcdir)/installer/install.sh

View File

@ -798,7 +798,7 @@ uninstall-am:
install-data-hook:
export INSTALL_STRIP_FLAG
INSTALL_STRIP_FLAG="$(INSTALL_STRIP_FLAG)" \
prefix="$(prefix)" sysconfdir="$(sysconfdir)" \
path_to_vi="$(path_to_vi)" path_to_sendmail="$(path_to_sendmail)" \
$(top_srcdir)/installer/install.sh

18
Packaging Executable file → Normal file
View File

@ -9,10 +9,6 @@ Packaging for Open Source Tripwire is maintained by various third parties:
* Debian: https://tracker.debian.org/pkg/tripwire
* Gentoo: https://packages.gentoo.org/packages/app-admin/tripwire
Gentoo also has an SELinux policy for OST:
https://packages.gentoo.org/packages/sec-policy/selinux-tripwire
* Chef cookbook: https://github.com/rackspace-cookbooks/rackspace_tripwire
* FreeBSD Ports: http://svnweb.freebsd.org/ports/head/security/tripwire/
@ -23,5 +19,19 @@ Packaging for Open Source Tripwire is maintained by various third parties:
* NetBSD pkgsrc: http://ftp.netbsd.org/pub/pkgsrc/current/pkgsrc/security/tripwire/README.html
NOTE: At present (April 2016) pkgsrc only provides the obsolete Tripwire 1.2, from the mid-1990s.
That version lacks contemporary hash algorithms, and you probably don't want to use it.
There's an unfinished pkgsrc port for OST 2.3+ here, if someone who understands pkgsrc
is looking for a fun(?) project: http://pkgsrc.se/wip/tripwire2
A few third party projects that might be useful with OST
* Chef cookbook: https://github.com/rackspace-cookbooks/rackspace_tripwire
* Puppet module: https://github.com/razorsedge/puppet-tripwire
* SELinux policies from Tresys: https://github.com/TresysTechnology/refpolicy-contrib/blob/master/tripwire.te
(and related .fc and .if files in the same repo)
* A Gentoo SELinux policy, different from the one above: https://packages.gentoo.org/packages/sec-policy/selinux-tripwire
* An experimental(?) Dockerfile for CentOS: https://hub.docker.com/r/prateeknischal/tripwire-play/

179
README.md
View File

@ -1,5 +1,180 @@
# Open Source Tripwire<sup>®</sup>
Open Source Tripwire<sup>®</sup> software is a security and data integrity tool useful for monitoring and alerting on specific file change(s) on a range of systems. The project is based on code originally contributed by [Tripwire, Inc.](http://www.tripwire.com) in 2000.
Open Source Tripwire<sup>®</sup> is a security and data integrity tool for monitoring and alerting on file & directory changes. This project is based on code originally contributed by [Tripwire, Inc.](http://www.tripwire.com) in 2000.
Open Source Tripwire is suitable for monitoring a small number of Linux servers, where centralized control and reporting is not needed and professional support or system automation is not a requirement.
## Overview
A Tripwire check compares the current filesystem state against a known baseline state, and alerts on any changes it detects. The baseline and check behavior are controlled by a policy file, which specifies which files or directories to monitor, and which attributes to monitor on them, such as hashes, file permissions, and ownership.
When an expected change occurs, such as upgrading a package, the baseline database can be updated to the new known-good state. The policy can also be updated, for example to reduce noise or cover a newly installed package.
## Getting Started
This section covers manual setup of Open Source Tripwire. If installing via an RPM or Debian package, or via **make install**, a setup script will walk the user through the initial setup steps (key generation thru policy creation) and these will not need to be done by hand.
### Generating Keys
The first step is to generate site and local key files. This is necessary because Tripwire policy, configuration, and database files are signed by default, and report files may also be signed. The site key is used to sign config and policy files, while databases and reports are signed with the local key. The idea here is that multiple machines can share a site key, but each will have its own local key. The policy and config files can then be created once and distributed across these machines.
A common practice is to include the hostname in the local key filename, as follows:
```
./twadmin --generate-keys -L /etc/tripwire/${HOSTNAME}-local.key
./twadmin --generate-keys -S /etc/tripwire/site.key
```
### Creating a configuration file
The next step is to create a Tripwire config file. The config file contains a variety of settings including the locations of Tripwire binaries and key files, email report settings, and parameters that control baseline/check behavior. These settings are explained in detail in the **twconfig(4)** manual page.
This command line reads and validates the config text in /path/to/twcfg.txt, writes the results to tw.cfg, and signs the resulting file with the provided site key:
```
./twadmin --create-cfgfile -S /path/to/site.key /path/to/twcfg.txt
```
### Generating a policy file
Now it's time to configure which files & directories OST will monitor. A few simple examples of policy rules:
```
/start/point -> $(IgnoreNone); # Get all attributes for this dir tree
/another/start -> +pinugS; # Get selected attributes for this dir tree
!/start/point/subdir/to/ignore; # Don't monitor this dir tree
```
The Tripwire policy language is documented in detail in the **twpolicy(4)** manual page, and default policies for most common operating systems are available in the OST project's policy subdirectory.
```
./twadmin --create-polfile -S /etc/tripwire/twpol.txt
```
### Creating a baseline
The next step is to baseline the system for the first time. This step is necessary even if the previous steps are handled by a setup/install script.
```
./tripwire --init
```
This creates a database file in the configured directory, typically a file with a .twd extension in /var/lib/tripwire. The optional **--verbose** argument to init mode lists files and directories as they're being scanned.
### Running a check
```
./tripwire --check
```
This runs a check, again with an optional **--verbose** option that displays what it's doing. Scan results are written to standard out, as well as a report file, which typically has a .twr extension and lives in /var/lib/tripwire/report. If email reporting is enabled, emails will be sent at the end of the check.
A common way to use OST is to set up a cron job to run checks periodically, emailing results to an administrative account. Note that the OST install script currently does not create any cron jobs, and this will need to be done by hand.
### Printing a report
```
./twprint -m r -t [0-4] -r /path/to/reportfile.twr
```
The -t argument specifies the level of report verbosity, where 0 is a single line summary of the report contents, and 4 displays all gathered attributes on all changed objects. The report level defaults to 3 if not specified on the command line or via the REPORTLEVEL config file option.
Databases can be also printed with:
```
./twprint -m d -d /path/to/database.twd
```
### Updating a database
The simplest form of update updates the database with all the changes in a report file:
```
./tripwire --update --accept-all
```
While a
```
./tripwire --update
```
brings up a text report in the user's preferred editor (as configured in the config file's EDITOR option), with a checkbox next to each detected change. After saving and exiting the editor, the database will only be updated for those objects that remain selected with an **[x]**.
### Updating a policy
Policy update mode modifies the current Tripwire policy without losing existing baselines.
```
./tripwire --update-policy updated-policy.txt
```
A check is run with the new policy as part of the update process. If this check detects changes, the default behavior is to display the changes and exit without updating the policy or database. To accept the changes and continue with the policy update, use the **-Z low** / **--secure-mode low** command line option.
### Testing the email configuration
To test email configuration:
```
./tripwire --test --email user@domain.tld
```
This sends a test email to the specified address, using the email settings specified in the config file.
## Building OST
### Prerequisites
A C++ compiler. It's known to build with gcc and clang; OST should work with gcc versions as old as 2.95.2, although gcc older than version 3.1 will need an external STLPort package.
A POSIX-like operating system, including Linux, macOS, various BSDs, Solaris, AIX, HP-UX, Minix, Haiku, GNU/Hurd, and others. Windows users can build OST under Cygwin, although this does not provide support for monitoring the Registry or any Windows-specific file attributes.
Perl 5+ is needed to run the project's test suite.
### Configuring & Building
OST uses a standard automake build, so the first configuration step will generally be:
```
./configure
```
Additional compiler arguments (such as Debian hardening options), non-default paths, and other options can be set up in this step. A ```./configure --help``` lists the available configuration options.
The ```--prefix=/some/path``` option controls where a subsequent ```make install``` will install to, and where Tripwire binaries will look for a configuration file.
The ```--enable-static``` option causes the build to create statically linked binaries. This is often used as a security enhancement, so that Tripwire will not rely on the shared libraries on the machine. This is not possible on all platforms, as some (like macOS and Solaris) don't provide the necessary static libraries to link against.
Note that Linux systems that use NSS for name lookups will still employ shared libraries behind the scenes even when the OST binaries are statically linked. There have been occasional reports of segfaults when trying to do a name lookup in these circumstances, particularly when the binary was built on a different machine or it's trying to do an LDAP or NIS name lookup. If this occurs, there are two ways to work around it: Either switch to dynamic binaries, or set the Tripwire config file option ```RESOLVE_IDS_TO_NAMES=false```, which tells OST to just watch numeric user & group IDs and not perform name lookups.
If the configure or make step fails with errors about the automake/autoconf version, it may be necessary to run the script
```
./touchconfig.sh```
before building the project. This script simply touches files in the correct order such that their last change times are not all identical, and that they're different in the right order.
Then just
```make```
to build the project.
## Running the test suites
the ```make check``` make target runs two things: The acceptance test suite in the src/test-harness directory, and unit tests by running twtest, which is built in the bin directory along with other Tripwire binaries. These tests can also be run separately:
```./twtest``` runs all unit tests, while ```./twtest list``` lists all available tests.
```./twtest Groupname``` runs all tests in a group, and
```./twtest Groupname/Testname``` just runs the specified test.
To run the acceptance tests manually, cd to the src/test-harness directory and run ```perl ./twtest.pl```.
## Deployment
The ```make install``` target installs OST to the configured location, and ```make install-strip``` installs and removes symbols from the Tripwire binaries. A ```make dist``` creates a gzipped source bundle.
## Authors
* [Tripwire, Inc.](http://www.tripwire.com)
## License
The developer of the original code and/or files is Tripwire, Inc.
Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc.
Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.
This program is free software. The contents of this file are subject to the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. You may redistribute it and/or modify it only in compliance with the GNU General Public License.
This program is distributed in the hope that it will be useful. However,
this program is distributed "AS-IS" WITHOUT ANY WARRANTY; INCLUDING THE
IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
Please see the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Nothing in the GNU General Public License or any other license to use the
code or files shall permit you to use Tripwire's trademarks, service marks, or other intellectual property without Tripwire's prior written consent.
If you have any questions, please contact Tripwire, Inc. at either
info@tripwire.org or www.tripwire.org.

View File

@ -2,7 +2,7 @@ TRIPWIRE COPYRIGHT & TRADEMARK NOTICE
COPYRIGHT
The developer of the original code and/or files is Tripwire, Inc. Portions
created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc.
created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc.
TRADEMARK
Tripwire is a registered trademark (the "Trademark") of Tripwire, Inc. All

26
configure vendored
View File

@ -1,7 +1,7 @@
#! /bin/sh
# From configure.ac Revision: 2.4.3.6 .
# From configure.ac Revision: 2.4.3.7 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.6.
# Generated by GNU Autoconf 2.69 for tripwire 2.4.3.7.
#
# Report bugs to <https://github.com/Tripwire/tripwire-open-source/issues>.
#
@ -12,7 +12,7 @@
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
#
# The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.
# The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.
## -------------------- ##
## M4sh Initialization. ##
## -------------------- ##
@ -584,8 +584,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='tripwire'
PACKAGE_TARNAME='tripwire'
PACKAGE_VERSION='2.4.3.6'
PACKAGE_STRING='tripwire 2.4.3.6'
PACKAGE_VERSION='2.4.3.7'
PACKAGE_STRING='tripwire 2.4.3.7'
PACKAGE_BUGREPORT='https://github.com/Tripwire/tripwire-open-source/issues'
PACKAGE_URL='https://github.com/Tripwire/tripwire-open-source'
@ -1314,7 +1314,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures tripwire 2.4.3.6 to adapt to many kinds of systems.
\`configure' configures tripwire 2.4.3.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@ -1385,7 +1385,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of tripwire 2.4.3.6:";;
short | recursive ) echo "Configuration of tripwire 2.4.3.7:";;
esac
cat <<\_ACEOF
@ -1500,14 +1500,14 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
tripwire configure 2.4.3.6
tripwire configure 2.4.3.7
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.
The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.
_ACEOF
exit
fi
@ -2444,7 +2444,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by tripwire $as_me 2.4.3.6, which was
It was created by tripwire $as_me 2.4.3.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@ -3418,7 +3418,7 @@ fi
# Define the identity of the package.
PACKAGE='tripwire'
VERSION='2.4.3.6'
VERSION='2.4.3.7'
cat >>confdefs.h <<_ACEOF
@ -7889,7 +7889,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by tripwire $as_me 2.4.3.6, which was
This file was extended by tripwire $as_me 2.4.3.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@ -7956,7 +7956,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
tripwire config.status 2.4.3.6
tripwire config.status 2.4.3.7
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"

View File

@ -2,14 +2,14 @@ dnl Process this file with autoconf to produce a configure script.
dnl
dnl
AC_INIT([tripwire], [2.4.3.6], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source])
AC_INIT([tripwire], [2.4.3.7], [https://github.com/Tripwire/tripwire-open-source/issues], [tripwire], [https://github.com/Tripwire/tripwire-open-source])
AC_CONFIG_SRCDIR([src/tw/tw.cpp])
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE
AM_CONFIG_HEADER(config.h)
AC_COPYRIGHT([The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.])
AC_REVISION([$Revision: 2.4.3.6 $])
AC_COPYRIGHT([The developer of the original code and/or files is Tripwire, Inc. Portions created by Tripwire, Inc. are copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights reserved.])
AC_REVISION([$Revision: 2.4.3.7 $])
dnl ###############
dnl Setup defaults

View File

@ -154,10 +154,16 @@ TAR_DIR=${TAR_DIR:-${START_DIR}}
OS=`uname -s`
POLICYSRC="twpol-${OS:=GENERIC}.txt"
if [ ! -r ${TAR_DIR}/policy/${POLICYSRC} ]
then POLICYSRC="twpol-GENERIC.txt"
if [ ! -r ${TAR_DIR}/policy/${POLICYSRC} ]; then
OS=`uname -o`
POLICYSRC="twpol-${OS:=GENERIC}.txt"
fi
if [ ! -r ${TAR_DIR}/policy/${POLICYSRC} ]; then
POLICYSRC="twpol-GENERIC.txt"
fi
##-------------------------------------------------------
## Parse the command line.
##-------------------------------------------------------
@ -386,9 +392,37 @@ else
## Verify that the specified editor program exists
##-------------------------------------------------------
DEFAULTEDITOR=${EDITOR:-/bin/vi}
TWEDITOR=${TWEDITOR:-$DEFAULTEDITOR}
# If user specified an editor in $path_to_vi or $TWEDITOR, try that first.
# $path_to_vi defaults to /usr/bin/vi, so we usually succeed here.
#
if [ -n ${TWEDITOR} ]; then
TWEDITOR_PATH=`command -v $TWEDITOR`
fi
# If user's environment includes $EDITOR, try that next
if [ -n ${EDITOR} ] && [ -z ${TWEDITOR_PATH} ]; then
TWEDITOR_PATH=`command -v $EDITOR`
fi
# Ok, now search path for vi
if [ -z ${TWEDITOR_PATH} ]; then
TWEDITOR_PATH=`command -v vi`
fi
# Try vim in case there isn't a link named vi
if [ -z ${TWEDITOR_PATH} ]; then
TWEDITOR_PATH=`command -v vim`
fi
# No vi/vim? See if nano is present
if [ -z ${TWEDITOR_PATH} ]; then
TWEDITOR_PATH=`command -v nano`
fi
# No vi or nano? See if emacs is available
if [ -z ${TWEDITOR_PATH} ]; then
TWEDITOR_PATH=`command -v emacs`
fi
if [ -n ${TWEDITOR_PATH} ]; then
TWEDITOR=$TWEDITOR_PATH

View File

@ -35,7 +35,7 @@
..
.nh
.ad l
.TH TWCONFIG 4 "1 July 2000"
.TH TWCONFIG 4 "04 Jan 2018" "Open Source Tripwire 2.4"
.SH NAME
twconfig \- \fITripwire\fP configuration file reference
.SH DESCRIPTION
@ -215,6 +215,15 @@ parameter; reports displayed by other modes and other commands
are not affected.
.br
Initial value: \fI3\fP
.IP \f(CWDBPRINTLEVEL\fP
Specifies the default level of report produced by the \fBtwprint
\(hy\(hyprint\(hydbfile\fP mode. Valid values for this option are 0 to
2. The output
level specified by this option can be overridden with the (\fB\(hyt\fP\ or\ \fB\(hy\(hyoutput\(hylevel\fP) option on the command line. If
this variable is not included in the configuration file, the default
output level is 2.
.br
Initial value: \fI2\fP
.IP \f(CWHASH_DIRECT_IO\fP
Use direct i/o when hashing files. (Linux-only as of OST 2.4.3.2)
.br
@ -302,7 +311,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR twintro (8),
.BR tripwire (8),

View File

@ -36,7 +36,7 @@
.\"
.nh
.ad l
.TH TWPOLICY 4 "1 July 2000"
.TH TWPOLICY 4 "04 Jan 2018" "Open Source Tripwire 2.4"
.SH NAME
twpolicy \- \fITripwire\fP policy file reference
.SH DESCRIPTION
@ -537,7 +537,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR twintro (8),
.BR tripwire (8),

View File

@ -25,7 +25,7 @@
.\"
.nh
.ad l
.TH TWFILES 5 "1 July 2000"
.TH TWFILES 5 "04 Jan 2018" "Open Source Tripwire 2.4"
.SH NAME
twfiles \- overview of files used by \fITripwire\fR and file backup process
.\"
@ -112,7 +112,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR twintro (8),
.BR tripwire (8),

View File

@ -2,9 +2,9 @@
.\" Do not move or remove previous line.
.\" Used by some man commands to know that tbl should be used.
.nh
.TH SIGGEN 8 "19 Feb 2004"
.TH SIGGEN 8 "04 Jan 2018" "Open Source Tripwire 2.4"
.SH NAME
siggen \- signature gathering routine for Tripwire
siggen \- signature gathering utility for Tripwire
.SH SYNOPSIS
.B siggen
[
@ -54,6 +54,8 @@ Display Haval value, a 128-bit hash code.
.TP
.IR file1 " [ " "file2... " ]
List of filesystem objects for which to display values.
.SH EXIT STATUS
\fBsiggen\fP exits 0 on success, 1 on error.
.SH VERSION INFORMATION
This man page describes
.B siggen
@ -67,7 +69,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR twintro (8),
.BR tripwire (8),

View File

@ -36,9 +36,9 @@
.\"
.nh
.ad l
.TH TRIPWIRE 8 "1 July 2000"
.TH TRIPWIRE 8 "04 Jan 2018" "Open Source Tripwire 2.4"
.SH NAME
tripwire \- a file integrity checker for \s-1UNIX\s0 systems
tripwire \- a file integrity checker for \s-1UNIX-like\s0 systems
.SH SYNOPSIS
.B tripwire
.RB "{ " "-m i" " | " "--init" " } "
@ -554,6 +554,19 @@ Mode selector.
Use the specified email address. This parameter must
be supplied when test mode is used. Only one address
may be specified.
.SH EXIT STATUS
.SS Integrity Checking Mode
\fBtripwire\fP exits 0 if no changes are detected. Otherwise the exit value is a bit mask:
.TP
\fB1\fP At least one file or directory has been added.
.TP
\fB2\fP At least one file or directory has been modified.
.TP
\fB4\fP At least one file or directory has been modified.
.TP
\fB8\fP Error(s) occurred during the check.
.SS All Other Modes
\fBtripwire\fP exits 0 on success, 8 on error.
.SH VERSION INFORMATION
This man page describes
.B tripwire
@ -567,7 +580,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR twintro (8),
.BR twadmin (8),

View File

@ -17,7 +17,7 @@
.in \\n(.iu
..
.ad l
.TH TWADMIN 8 "1 July 2000"
.TH TWADMIN 8 "04 Jan 2018" "Open Source Tripwire 2.4"
.SH NAME
twadmin \- Tripwire administrative and utility tool
.SH SYNOPSIS
@ -538,6 +538,8 @@ file.
Specify passphrase used to decrypt the private key in the specified sitekey
file.
.\" *****************************************
.SH EXIT STATUS
\fBtwadmin\fP exits 0 on success, 1 on error.
.SH VERSION INFORMATION
This man page describes
.B twadmin
@ -551,7 +553,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR twintro (8),
.BR tripwire (8),

View File

@ -16,12 +16,12 @@
.\"
.nh
.ad l
.TH TWINTRO 8 "1 July 2000"
.TH TWINTRO 8 "04 Jan 2018" "Open Source Tripwire 2.4"
.SH NAME
twintro \- introduction to \fITripwire\fP software
.SH DESCRIPTION
.PP
\fITripwire 2.4\fP is a file integrity assessment product for Linux networks. Rather than preventing an intruder or virus
\fITripwire 2.4\fP is a file integrity assessment tool for UNIX-like systems. Rather than preventing an intruder or virus
from attacking system files, \fITripwire\fP detects intrusions when
they do occur. By comparing system files and directories against a
previously stored "baseline" database, \fITripwire\fP finds any
@ -99,7 +99,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR tripwire (8),
.BR twadmin (8),

View File

@ -2,7 +2,7 @@
.\" Do not move or remove previous line.
.\" Used by some man commands to know that tbl should be used.
.ad l
.TH TWPRINT 8 "1 July 2000"
.TH TWPRINT 8 "04 Jan 2018" "Open Source Tripwire 2.4"
.nh
.SH NAME
twprint \- Tripwire database and report printer
@ -10,6 +10,9 @@ twprint \- Tripwire database and report printer
.B twprint
.RB "{ " "-m r" " | " "--print-report" " } "
.RI "[ " options... " ]"
.if n .br
.if n .ti +.5i
.RI " [ " "object1" " [ " "object2..." " ]]"
.br
.B twprint
.RB "{ " "-m d" " | " "--print-dbfile" " } "
@ -59,6 +62,7 @@ lbw(1.2i) lb.
-L \fIlocalkey\fP --local-keyfile \fIlocalkey\fP
-t \fR{ 0|1|2|3|4 }\fP --report-level \fR{ 0|1|2|3|4 }\fP
.TE
.RI "[ " "object1" " [ " "object2..." " ]]"
.RE
.TP
.BR "\(hym r" ", " --print-report
@ -83,10 +87,15 @@ Print the specified report file.
Use the specified local key file to perform verification
with reports which are signed.
.TP
.BI \(hyt " level\fR, " --report-level " level
.BI \(hyt " level\fR, " --report-level " level"
Specifies the detail level of the printed report, overriding the
\f(CWREPORTLEVEL\fP variable in the configuration
file. \fIlevel\fR must be a number from 0\ to\ 4.
.TP
.RI "[ " "object1" " [ " "object2..." " ]]"
List of filesystem objects in the report to print. If no
objects are specified, every object in the report will
be printed.
.\" *****************************************
.SS Database printing mode:
.RS 0.4i
@ -100,6 +109,7 @@ lbw(1.2i) lb.
-c \fIcfgfile\fP --cfgfile \fIcfgfile\fP
-d \fIdatabase\fP --dbfile \fIdatabase\fP
-L \fIlocalkey\fP --local-keyfile \fIlocalkey\fP
-t \fR{ 0|1|2 }\fP --output-level \fR{ 0|1|2 }\fP
.TE
.RI "[ " "object1" " [ " "object2..." " ]]"
.RE
@ -125,6 +135,11 @@ Print the specified database file.
.BI \(hyL " localkey\fR, " --local-keyfile " localkey"
Use the specified local key file to read the database.
.TP
.BI \(hyt " level\fR, " --output-level " level"
Specifies the detail level of the printed database, overriding the
\f(CWDBPRINTLEVEL\fP variable in the configuration
file. \fIlevel\fR must be a number from 0\ to\ 2.
.TP
.RI "[ " "object1" " [ " "object2..." " ]]"
List of filesystem objects in the database to print. If no
objects are specified, every object in the database will
@ -132,6 +147,8 @@ be printed. The format for a list of objects is:
.if n .I "section: objname objname... section: objname..."
.if t .br
.if t .I "section: objectname objectname... section: objectname..."
.SH EXIT STATUS
\fBtwprint\fP exits 0 on success, 1 on error.
.SH VERSION INFORMATION
This man page describes
.B twprint
@ -145,7 +162,7 @@ Permission is granted to copy and distribute modified versions of this man page
.PP
Permission is granted to copy and distribute translations of this man page into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by Tripwire, Inc.
.PP
Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire, Inc. in the United States and other countries. All rights reserved.
.SH SEE ALSO
.BR twintro (8),
.BR tripwire (8),

View File

@ -191,7 +191,7 @@ $(DIR1) -> $(param1); # It is also possible to do a
#=============================================================================
#
# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Inc. All rights reserved.
#
# Linux is a registered trademark of Linus Torvalds.

View File

@ -60,13 +60,14 @@ HOSTNAME=;
#
##############################################################################
Device = +pugsdr-intlbamcCMSH ;
Dynamic = +pinugtd-srlbamcCMSH ;
Growing = +pinugtdl-srbamcCMSH ;
IgnoreAll = -pinugtsdrlbamcCMSH ;
IgnoreNone = +pinugtsdrbamcCMSH-l ;
ReadOnly = +pinugtsdbmCM-rlacSH ;
Temporary = +pugt ;
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
@ -83,10 +84,10 @@ Temporary = +pugt ;
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(ReadOnly) ;
$(TWBIN)/tripwire -> $(ReadOnly) ;
$(TWBIN)/twadmin -> $(ReadOnly) ;
$(TWBIN)/twprint -> $(ReadOnly) ;
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
@ -103,14 +104,14 @@ Temporary = +pugt ;
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(Dynamic) -i ;
$(TWPOL)/tw.pol -> $(ReadOnly) -i ;
$(TWPOL)/tw.cfg -> $(ReadOnly) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ;
$(TWSKEY)/site.key -> $(ReadOnly) ;
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(Dynamic) (recurse=0) ;
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
################################################
@ -124,7 +125,7 @@ Temporary = +pugt ;
rulename = "OS Boot and Configuration Files",
)
{
/etc -> $(IgnoreNone) -SHa ;
/etc -> $(SEC_IGNORE_NONE) -SHa ;
}
###################################################
@ -138,9 +139,9 @@ Temporary = +pugt ;
rulename = "Mount Points",
)
{
/ -> $(ReadOnly) ;
/usr -> $(ReadOnly) ;
/var -> $(ReadOnly) ;
/ -> $(SEC_READONLY) ;
/usr -> $(SEC_READONLY) ;
/var -> $(SEC_READONLY) ;
}
###################################################
@ -154,10 +155,10 @@ Temporary = +pugt ;
rulename = "Misc Top-Level Directories",
)
{
/lost+found -> $(ReadOnly) ;
/hacmplocal -> $(ReadOnly) ;
/homelocal -> $(ReadOnly) ;
/opt -> $(ReadOnly) ;
/lost+found -> $(SEC_READONLY) ;
/hacmplocal -> $(SEC_READONLY) ;
/homelocal -> $(SEC_READONLY) ;
/opt -> $(SEC_READONLY) ;
!/var/adm/csd ;
}
@ -172,7 +173,7 @@ Temporary = +pugt ;
rulename = "System Devices",
)
{
/dev -> $(Device) ;
/dev -> $(SEC_DEVICE) ;
}
################################################
@ -186,10 +187,10 @@ Temporary = +pugt ;
rulename = "OS Binaries and Libraries",
)
{
/sbin -> $(ReadOnly) ;
/usr/bin -> $(ReadOnly) ;
/usr/lib -> $(ReadOnly) ;
/usr/sbin -> $(ReadOnly) ;
/sbin -> $(SEC_READONLY) ;
/usr/bin -> $(SEC_READONLY) ;
/usr/lib -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
}
################################################
@ -203,11 +204,11 @@ Temporary = +pugt ;
rulename = "Root Directory and Files",
)
{
#/.dtprofile -> $(Dynamic) ;
#/.dtprofile -> $(SEC_DYNAMIC) ;
! /.netscape/cache ;
/.netscape/history.dat -> $(Dynamic) ;
/.sh_history -> $(Dynamic) ;
#/.Xauthority -> $(ReadOnly) ;
/.netscape/history.dat -> $(SEC_DYNAMIC) ;
/.sh_history -> $(SEC_DYNAMIC) ;
#/.Xauthority -> $(SEC_READONLY) ;
}
################################################
@ -221,8 +222,8 @@ Temporary = +pugt ;
rulename = "Temporary Directories",
)
{
/tmp -> $(Temporary) ;
/var/tmp -> $(Temporary) ;
/tmp -> $(SEC_TEMPORARY) ;
/var/tmp -> $(SEC_TEMPORARY) ;
}
################################################
@ -251,31 +252,31 @@ Temporary = +pugt ;
rulename = "System and Boot Changes",
)
{
/etc/es/objrepos -> $(ReadOnly) -SHacm ;
/etc/es/objrepos/HACMPresource -> $(ReadOnly) -SHCMcm ;
/etc/lpp/diagnostics/data -> $(ReadOnly) -SHCMacm ;
/etc/ntp.drift -> $(ReadOnly) -SHiacm ;
/etc/es/objrepos -> $(SEC_READONLY) -SHacm ;
/etc/es/objrepos/HACMPresource -> $(SEC_READONLY) -SHCMcm ;
/etc/lpp/diagnostics/data -> $(SEC_READONLY) -SHCMacm ;
/etc/ntp.drift -> $(SEC_READONLY) -SHiacm ;
!/etc/objrepos ;
/etc/security -> $(ReadOnly) -SHacm ;
/usr/es/adm/cluster.log -> $(ReadOnly) -SHCMsbm ;
/usr/es/sbin/cluster/etc/objrepos/active -> $(ReadOnly) -SHim ;
/etc/security -> $(SEC_READONLY) -SHacm ;
/usr/es/adm/cluster.log -> $(SEC_READONLY) -SHCMsbm ;
/usr/es/sbin/cluster/etc/objrepos/active -> $(SEC_READONLY) -SHim ;
!/usr/etc/sbin/cluster/history ;
/usr/share/lib/objrepos -> $(ReadOnly) -m ;
/usr/lib/objrepos -> $(ReadOnly) -m ;
/usr/share/lib/objrepos -> $(SEC_READONLY) -m ;
/usr/lib/objrepos -> $(SEC_READONLY) -m ;
!/var/adm/SPlogs ;
/var/ha/log -> $(Growing) -i ;
/var/ha/log -> $(SEC_GROWING) -i ;
!/var/adm ;
!/var/ct ;
#/var/backups -> $(Dynamic) -i ;
#/var/db/host.random -> $(ReadOnly) -mCM ;
#/var/db/locate.database -> $(ReadOnly) -misCM ;
#/var/cron -> $(Growing) -i ;
#/var/log -> $(Growing) -i ;
#/var/run -> $(Dynamic) -i ;
#/var/mail -> $(Growing) ;
#/var/msgs/bounds -> $(ReadOnly) -smbCM ;
#/var/spool/clientmqueue -> $(Temporary) ;
#/var/spool/mqueue -> $(Temporary) ;
#/var/backups -> $(SEC_DYNAMIC) -i ;
#/var/db/host.random -> $(SEC_READONLY) -mCM ;
#/var/db/locate.database -> $(SEC_READONLY) -misCM ;
#/var/cron -> $(SEC_GROWING) -i ;
#/var/log -> $(SEC_GROWING) -i ;
#/var/run -> $(SEC_DYNAMIC) -i ;
#/var/mail -> $(SEC_GROWING) ;
#/var/msgs/bounds -> $(SEC_READONLY) -smbCM ;
#/var/spool/clientmqueue -> $(SEC_TEMPORARY) ;
#/var/spool/mqueue -> $(SEC_TEMPORARY) ;
#!/var/tmp/vi.recover ; # perl script periodically removes this
}

132
policy/twpol-AROS.txt Normal file
View File

@ -0,0 +1,132 @@
###############################################################################
# ##
# Default Tripwire 2.4 Policy file for AROS ##
# ##
###############################################################################
###############################################################################
# ##
# Global Variable Definitions ##
# ##
# These are defined at install time by the installation script. You may ##
# Manually edit these if you are using this file directly and not from the ##
# installation script itself. ##
# ##
###############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
#########################################
# ##
# Tripwire Binaries and Data Files ##
# ##
#########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
##############################################################################
(rulename="OS Files",)
{
AROS:System -> $(SEC_READONLY);
AROS:Devs -> $(SEC_READONLY);
AROS:Libs -> $(SEC_READONLY);
AROS:Tools-> $(SEC_READONLY);
AROS:Prefs -> $(SEC_READONLY);
AROS:Utilities -> $(SEC_READONLY);
AROS:WBStartup -> $(SEC_READONLY);
}
(rulename="Development Tools",)
{
Work:Development -> $(SEC_READONLY);
}
(rulename="Extras",)
{
Work:Extras -> $(SEC_READONLY);
}

View File

@ -2,8 +2,8 @@
# ##
############################################################################## #
# # #
# Policy file for Bitrig 1.x # #
# (adapted from OpenBSD policy) # #
# Tripwire 2.4 policy for Bitrig # #
# updated March 2018 # #
# ##
##############################################################################
@ -60,13 +60,13 @@ HOSTNAME=;
#
##############################################################################
Device = +pugsdr-intlbamcCMSH ;
Dynamic = +pinugtd-srlbamcCMSH ;
Growing = +pinugtdl-srbamcCMSH ;
IgnoreAll = -pinugtsdrlbamcCMSH ;
IgnoreNone = +pinugtsdrbamcCMSH-l ;
ReadOnly = +pinugtsdbmCM-rlacSH ;
Temporary = +pugt ;
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
@ -83,10 +83,10 @@ Temporary = +pugt ;
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(ReadOnly) ;
$(TWBIN)/tripwire -> $(ReadOnly) ;
$(TWBIN)/twadmin -> $(ReadOnly) ;
$(TWBIN)/twprint -> $(ReadOnly) ;
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
@ -103,14 +103,14 @@ Temporary = +pugt ;
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(Dynamic) -i ;
$(TWPOL)/tw.pol -> $(ReadOnly) -i ;
$(TWPOL)/tw.cfg -> $(ReadOnly) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ;
$(TWSKEY)/site.key -> $(ReadOnly) ;
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(Dynamic) (recurse=0) ;
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
# In this configuration /usr/local is a symbolic link to /home/local.
# We want to ignore the following directories since they are already
@ -131,9 +131,9 @@ Temporary = +pugt ;
rulename = "OS Boot and Configuration Files",
)
{
/boot -> $(ReadOnly) ;
/bsd -> $(ReadOnly) ;
/etc -> $(IgnoreNone) -SHa ;
/boot -> $(SEC_READONLY) ;
/bsd -> $(SEC_READONLY) ;
/etc -> $(SEC_IGNORE_NONE) -SHa ;
}
###################################################
@ -147,13 +147,13 @@ Temporary = +pugt ;
rulename = "Mount Points",
)
{
/ -> $(ReadOnly) ;
/cdrom -> $(Dynamic) ;
/floppy -> $(Dynamic) ;
/home -> $(ReadOnly) ; # Modify as needed
/mnt -> $(Dynamic) ;
/usr -> $(ReadOnly) ;
/var -> $(ReadOnly) ;
/ -> $(SEC_READONLY) ;
/cdrom -> $(SEC_DYNAMIC) ;
/floppy -> $(SEC_DYNAMIC) ;
/home -> $(SEC_READONLY) ; # Modify as needed
/mnt -> $(SEC_DYNAMIC) ;
/usr -> $(SEC_READONLY) ;
/var -> $(SEC_READONLY) ;
}
###################################################
@ -167,8 +167,8 @@ Temporary = +pugt ;
rulename = "Misc Top-Level Directories",
)
{
/altroot -> $(Dynamic) ;
/stand -> $(Dynamic) ;
/altroot -> $(SEC_DYNAMIC) ;
/stand -> $(SEC_DYNAMIC) ;
}
################################################
@ -182,10 +182,10 @@ Temporary = +pugt ;
rulename = "System Devices",
)
{
/dev -> $(Device) ;
/dev/fd -> $(Device) ;
/var/cron/tabs/.sock -> $(Device) ;
/var/empty/dev/log -> $(Device) ;
/dev -> $(SEC_DEVICE) ;
/dev/fd -> $(SEC_DEVICE) ;
/var/cron/tabs/.sock -> $(SEC_DEVICE) ;
/var/empty/dev/log -> $(SEC_DEVICE) ;
}
################################################
@ -199,14 +199,14 @@ Temporary = +pugt ;
rulename = "OS Binaries and Libraries",
)
{
/bin -> $(ReadOnly) ;
/sbin -> $(ReadOnly) ;
/usr/bin -> $(ReadOnly) ;
/usr/lib -> $(ReadOnly) ;
/usr/libexec -> $(ReadOnly) ;
/usr/sbin -> $(ReadOnly) ;
/usr/X11R6/bin -> $(ReadOnly) ;
/usr/X11R6/lib -> $(ReadOnly) ;
/bin -> $(SEC_READONLY) ;
/sbin -> $(SEC_READONLY) ;
/usr/bin -> $(SEC_READONLY) ;
/usr/lib -> $(SEC_READONLY) ;
/usr/libexec -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
/usr/X11R6/bin -> $(SEC_READONLY) ;
/usr/X11R6/lib -> $(SEC_READONLY) ;
}
################################################
# ##
@ -219,19 +219,19 @@ Temporary = +pugt ;
#OKrulename = "Usr Local Files",
#OK)
#OK{
#OK/usr/local -> $(ReadOnly) ;
#OK/usr/local/bin -> $(ReadOnly) ;
#OK/usr/local/doc -> $(ReadOnly) ;
#OK/usr/local/etc -> $(ReadOnly) ;
#OK/usr/local/include -> $(ReadOnly) ;
#OK/usr/local/info -> $(ReadOnly) ;
#OK/usr/local/lib -> $(ReadOnly) ;
#OK/usr/local/libdata -> $(ReadOnly) ;
#OK/usr/local/libexec -> $(ReadOnly) ;
#OK/usr/local/man -> $(ReadOnly) ;
#OK/usr/local/sbin -> $(ReadOnly) ;
#OK/usr/local/share -> $(ReadOnly) ;
#OK/usr/local/src -> $(ReadOnly) ;
#OK/usr/local -> $(SEC_READONLY) ;
#OK/usr/local/bin -> $(SEC_READONLY) ;
#OK/usr/local/doc -> $(SEC_READONLY) ;
#OK/usr/local/etc -> $(SEC_READONLY) ;
#OK/usr/local/include -> $(SEC_READONLY) ;
#OK/usr/local/info -> $(SEC_READONLY) ;
#OK/usr/local/lib -> $(SEC_READONLY) ;
#OK/usr/local/libdata -> $(SEC_READONLY) ;
#OK/usr/local/libexec -> $(SEC_READONLY) ;
#OK/usr/local/man -> $(SEC_READONLY) ;
#OK/usr/local/sbin -> $(SEC_READONLY) ;
#OK/usr/local/share -> $(SEC_READONLY) ;
#OK/usr/local/src -> $(SEC_READONLY) ;
#OK}
################################################
@ -245,9 +245,9 @@ Temporary = +pugt ;
rulename = "Root Directory and Files",
)
{
/root -> $(IgnoreNone) -SHa ;
/root/.cshrc -> $(Dynamic) ;
/root/.profile -> $(Dynamic) ;
/root -> $(SEC_IGNORE_NONE) -SHa ;
/root/.cshrc -> $(SEC_DYNAMIC) ;
/root/.profile -> $(SEC_DYNAMIC) ;
}
################################################
@ -261,8 +261,8 @@ Temporary = +pugt ;
rulename = "Temporary Directories",
)
{
/tmp -> $(Temporary) ;
/var/tmp -> $(Temporary) ;
/tmp -> $(SEC_TEMPORARY) ;
/var/tmp -> $(SEC_TEMPORARY) ;
}
################################################
@ -276,15 +276,15 @@ Temporary = +pugt ;
rulename = "System and Boot Changes",
)
{
/var/backups -> $(Dynamic) -i ;
/var/db/host.random -> $(ReadOnly) -mCM ;
/var/cron -> $(Growing) -i ;
/var/log -> $(Growing) -i ;
/var/run -> $(Dynamic) -i ;
/var/mail -> $(Growing) ;
/var/msgs/bounds -> $(ReadOnly) -smbCM ;
/var/spool/clientmqueue -> $(Temporary) ;
/var/spool/mqueue -> $(Temporary) ;
/var/backups -> $(SEC_DYNAMIC) -i ;
/var/db/host.random -> $(SEC_READONLY) -mCM ;
/var/cron -> $(SEC_GROWING) -i ;
/var/log -> $(SEC_GROWING) -i ;
/var/run -> $(SEC_DYNAMIC) -i ;
/var/mail -> $(SEC_GROWING) ;
/var/msgs/bounds -> $(SEC_READONLY) -smbCM ;
/var/spool/clientmqueue -> $(SEC_TEMPORARY) ;
/var/spool/mqueue -> $(SEC_TEMPORARY) ;
}
#

163
policy/twpol-Cygwin.txt Normal file
View File

@ -0,0 +1,163 @@
###############################################################################
# ##
# Default Tripwire 2.4 Policy file for Cygwin ##
# ##
###############################################################################
###############################################################################
# ##
# Global Variable Definitions ##
# ##
# These are defined at install time by the installation script. You may ##
# Manually edit these if you are using this file directly and not from the ##
# installation script itself. ##
# ##
###############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
#########################################
# ##
# Tripwire Binaries and Data Files ##
# ##
#########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
##############################################################################
(rulename="Binary files",)
{
/bin -> $(SEC_READONLY) -a;
/usr/bin -> $(SEC_READONLY) -a;
/usr/local/bin -> $(SEC_READONLY) -a;
}
(rulename="Development",)
{
/usr/x86_64-pc-cygwin -> $(SEC_READONLY) -a;
}
(rulename="Libexec",)
{
/usr/libexec -> $(SEC_READONLY) -a;
}
(rulename="Admin binaries",)
{
/sbin -> $(SEC_READONLY) -a;
/usr/sbin -> $(SEC_READONLY) -a;
}
(rulename="Libraries",)
{
/lib -> $(SEC_READONLY) -a;
/usr/lib -> $(SEC_READONLY) -a;
/usr/local/lib -> $(SEC_READONLY) -a;
}
(rulename="Etc",)
{
/etc -> $(SEC_READONLY) -a;
/usr/local/etc -> $(SEC_READONLY) -a;
}
(rulename="Dev",)
{
/dev -> $(SEC_DEVICE);
}
(rulename="Tmp",)
{
/tmp -> $(SEC_TEMPORARY);
/var/tmp -> $(SEC_TEMPORARY);
/usr/tmp -> $(SEC_TEMPORARY);
}
(rulename="Log",)
{
/var/log -> $(SEC_GROWING);
}

View File

@ -2,8 +2,8 @@
# ##
############################################################################## #
# # #
# Policy file for Mac OS X # #
# September 3, 2003 # #
# Tripwire 2.4 policy for Mac OS X # #
# updated March 2018 # #
# ##
##############################################################################
@ -28,7 +28,7 @@ TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
#USER1=frodo ;
HOSTNAME=;
##############################################################################
@ -67,9 +67,10 @@ SEC_DYNAMIC = +pinugt-dsrlbamcCMSH ;
SEC_READONLY = +pinugtsbmCM-drlacSH ;
SEC_GROWING = +pinugtl-dsrbamcCMSH ;
IgnoreAll = -pinugtsdrlbamcCMSH ;
IgnoreNone = +pinugtsdrbamcCMSH-l ;
Temporary = +pugt ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_TEMPORARY = +pugt ;
@@section FS
@ -109,7 +110,7 @@ Temporary = +pugt ;
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/local.key -> $(SEC_READONLY) ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
@ -129,14 +130,14 @@ Temporary = +pugt ;
rulename = "OS Boot and Configuration Files", severity=100
)
{
/mach.sym -> $(SEC_READONLY)-im ;
#/mach.sym -> $(SEC_READONLY)-im ;
/mach_kernel -> $(SEC_READONLY) ;
/private/etc -> $(SEC_READONLY)-m ;
#/private/etc/appletalk.cfg -> $(SEC_READONLY)-im ;
#/private/etc/appletalk.nvram.en0 -> $(SEC_DYNAMIC) ;
/private/etc/cups/certs -> $(SEC_DYNAMIC) -i(recurse=0) ;
/private/etc/smb.conf -> $(SEC_READONLY)-im ;
#/private/etc/smb.conf -> $(SEC_READONLY)-im ;
/Library -> $(SEC_READONLY) ;
/System -> $(SEC_READONLY) ;
@ -182,8 +183,6 @@ Temporary = +pugt ;
)
{
/dev -> $(SEC_DEVICE)(recurse=0) ;
#/private/var/cron/tabs/.sock -> $(SEC_DEVICE) ;
}
################################################
@ -203,8 +202,8 @@ Temporary = +pugt ;
/usr/lib -> $(SEC_READONLY) ;
/usr/libexec -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
#/usr/X11R6 -> $(SEC_READONLY)(recurse=2) ; # May not be present
#/usr/X11R6/man -> $(SEC_DYNAMIC)-i(recurse=1) ; # May not be present
/usr/X11 -> $(SEC_READONLY)(recurse=2) ; # May not be present
#/usr/X11/man -> $(SEC_DYNAMIC)-i(recurse=1) ; # May not be present
/usr/share -> $(SEC_READONLY) ;
/usr/share/man -> $(SEC_DYNAMIC)-i(recurse=1) ;
@ -223,12 +222,6 @@ Temporary = +pugt ;
)
{
/Applications -> $(SEC_READONLY)-im(recurse=2) ;
"/Applications (Mac OS 9)" -> $(SEC_READONLY) ;
!/Applications/Internet/P2P/Downloads ;
!/Applications/Games/"Warcraft III Folder"/Save ;
}
################################################
@ -243,10 +236,19 @@ Temporary = +pugt ;
)
{
/usr/local -> $(SEC_READONLY) ;
#/usr/local/bin -> $(SEC_READONLY) ;
/usr/local/sbin -> $(SEC_READONLY) ;
/usr/local/bin -> $(SEC_READONLY) ;
/usr/local/include -> $(SEC_READONLY) ;
/usr/local/opt -> $(SEC_READONLY) ;
/usr/local/libexec -> $(SEC_READONLY) ;
/usr/local/lib -> $(SEC_READONLY) ;
/usr/local/etc -> $(SEC_READONLY) ;
#/usr/local/sbin -> $(SEC_READONLY) ;
#/usr/local/share -> $(SEC_READONLY) ;
/usr/local/share -> $(SEC_READONLY) ;
/usr/local/man -> $(SEC_READONLY) ;
/usr/local/Frameworks -> $(SEC_READONLY) ;
# Homebrew
/usr/local/.git -> $(SEC_READONLY) ;
/usr/local/Cellar -> $(SEC_READONLY) ;
}
@ -263,24 +265,26 @@ Temporary = +pugt ;
{
/private/tmp -> $(SEC_DYNAMIC)-in(recurse=0) ;
/private/tftpboot -> $(SEC_READONLY)-i ;
/private/var -> $(SEC_READONLY)-i ;
/private/var/backups -> $(SEC_READONLY)-imc(severity=100) ;
#/private/var/backups/local.nidump -> $(SEC_DYNAMIC) -i(severity=100) ;
#/private/var/cron -> $(SEC_DYNAMIC) -i ;
/private/var/db -> $(SEC_READONLY)-im ;
/private/var/db/BootCache.playlist -> $(SEC_DYNAMIC) -i ;
/private/var/db/netinfo/local.nidb/Store.384 -> $(SEC_READONLY)-imc(severity=100) ;
#/private/var/db/netinfo/local.nidb/Store.384 -> $(SEC_READONLY)-imc(severity=100) ;
#/private/var/db/netinfo/local.nidb/Store.672 -> $(SEC_READONLY)-imc(severity=100) ;
/private/var/db/prebindOnDemandBadFiles -> $(SEC_DYNAMIC) -i ;
#/private/var/db/prebindOnDemandBadFiles -> $(SEC_DYNAMIC) -i ;
/private/var/log -> $(SEC_DYNAMIC) -i ;
#/private/var/mail -> $(SEC_DYNAMIC) ;
/private/var/msgs/bounds -> $(SEC_READONLY)-smbCM ;
/private/var/root/Library/Caches -> $(SEC_DYNAMIC) -i ;
/private/var/run -> $(SEC_DYNAMIC) -i(rulename="Running Services") ;
#/private/var/slp.regfile -> $(SEC_READONLY)-im ;
/private/var/spool/clientmqueue -> $(SEC_DYNAMIC)(recurse=0) ;
#/private/var/spool/clientmqueue -> $(SEC_DYNAMIC)(recurse=0) ;
/private/var/spool/mqueue -> $(SEC_DYNAMIC)(recurse=0) ;
/private/var/spool/lock -> $(SEC_DYNAMIC) -i(recurse=1) ;
#/private/var/spool/lock -> $(SEC_DYNAMIC) -i(recurse=1) ;
/private/var/spool/cups -> $(SEC_DYNAMIC) -i(recurse=0) ;
/private/var/tmp -> $(SEC_DYNAMIC) -i(recurse=0) ;
/private/var/vm -> $(SEC_DYNAMIC)(recurse=0) ;
@ -294,37 +298,19 @@ Temporary = +pugt ;
!/private/var/db/dhcpd_leases ;
!/private/var/db/locate.database ;
!/private/var/db/SystemEntropyCache ;
!/private/var/db/mds/messages/se_SecurityMessages ;
!/private/var/db/samba/secrets.tdb ;
!/private/var/db/ntp.drift ;
!/private/var/folders ;
!/private/var/vm/sleepimage ;
!/private/var/vm/swap0 ;
!/private/var/vm/swap[1-9][0-9]* ;
# Sophos
!/Library/Caches/com.sophos.sau ;
!/Library/Caches/com.sophos.sxld ;
}
################################################
# ##
################################################ #
# # #
# Classic Environment # #
# ##
################################################
(
rulename = "Classic Environment", severity=100
)
{
/"System Folder" -> $(SEC_READONLY) ;
/"System Folder"/Preferences -> $(SEC_DYNAMIC)-i(recurse=0) ;
/"System Folder"/Extensions -> $(SEC_READONLY)-im ;
/"System Folder/Apple Menu Items" -> $(SEC_READONLY)-im(recurse=0) ;
/"System Folder"/Clipboard -> $(SEC_DYNAMIC) ;
!/"System Folder"/VolumeNameIconPict ;
}
###################################################
# ##
################################################### #
@ -375,7 +361,3 @@ Temporary = +pugt ;
#!"/Users/$(USER1)/.lpoptions" ;
#!"/Users/$(USER1)/.Trash" ;
}
#
# JTI
#

View File

@ -54,13 +54,21 @@ TWREPORT=;
HOSTNAME=;
@@section FS
SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change
SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(ReadOnly) ; # Binaries that should not change
SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(Dynamic)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
SEC_CRIT = $(SEC_IGNORE_NONE)-SHa ; # Critical files that cannot change
SEC_SUID = $(SEC_IGNORE_NONE)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(SEC_READONLY) ; # Binaries that should not change
SEC_CONFIG = $(SEC_DYNAMIC) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(SEC_DYNAMIC)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(SEC_GROWING) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = $(SEC_TEMPORARY) ; # Directories that should never change permission or ownership
SIG_LOW = 33 ; # Non-critical files that are of minimal security impact
SIG_MED = 66 ; # Non-critical files that are of significant security impact
SIG_HI = 100 ; # Critical files that are significant points of vulnerability
@ -630,7 +638,7 @@ SIG_HI = 100 ; # Critical files that are significant point
#=============================================================================
#
# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Inc. in the United States and other countries. All rights reserved.
#
# FreeBSD is a registered trademark of the FreeBSD Project Inc.

View File

@ -53,13 +53,21 @@ TWREPORT=;
HOSTNAME=;
@@section FS
SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change
SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(ReadOnly) ; # Binaries that should not change
SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(Dynamic)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
SEC_CRIT = $(SEC_IGNORE_NONE)-SHa ; # Critical files that cannot change
SEC_SUID = $(SEC_IGNORE_NONE)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(SEC_READONLY) ; # Binaries that should not change
SEC_CONFIG = $(SEC_DYNAMIC) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(SEC_DYNAMIC)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(SEC_GROWING) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = $(SEC_TEMPORARY) ; # Directories that should never change permission or ownership
SIG_LOW = 33 ; # Non-critical files that are of minimal security impact
SIG_MED = 66 ; # Non-critical files that are of significant security impact
SIG_HI = 100 ; # Critical files that are significant points of vulnerability
@ -629,7 +637,7 @@ SIG_HI = 100 ; # Critical files that are significant point
#=============================================================================
#
# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Inc. in the United States and other countries. All rights reserved.
#
# FreeBSD is a registered trademark of the FreeBSD Project Inc.

View File

@ -65,12 +65,21 @@ TWREPORT=;
HOSTNAME=;
@@section FS
SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change
SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(ReadOnly) ; # Binaries that should not change
SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often
SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
SEC_CRIT = $(SEC_IGNORE_NONE)-SHa ; # Critical files that cannot change
SEC_SUID = $(SEC_IGNORE_NONE)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(SEC_READONLY) ; # Binaries that should not change
SEC_CONFIG = $(SEC_DYNAMIC) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(SEC_DYNAMIC)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(SEC_GROWING) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = $(SEC_TEMPORARY) ; # Directories that should never change permission or ownership
SIG_LOW = 33 ; # Non-critical files that are of minimal security impact
SIG_MED = 66 ; # Non-critical files that are of significant security impact
SIG_HI = 100 ; # Critical files that are significant points of vulnerability
@ -114,56 +123,6 @@ SIG_HI = 100 ; # Critical files that are significant point
}
# Tripwire HQ Connector Binaries
#(
# rulename = "Tripwire HQ Connector Binaries",
# severity = $(SIG_HI)
#)
#{
# $(TWBIN)/hqagent -> $(SEC_BIN) ;
#}
#
# Tripwire HQ Connector - Configuration Files, Keys, and Logs
##############################################################################
# ##
############################################################################## #
# # #
# Note: File locations here are different than in a stock HQ Connector # #
# installation. This is because Tripwire 2.3 uses a different path # #
# structure than Tripwire 2.2.1. # #
# # #
# You may need to update your HQ Agent configuation file (or this policy # #
# file) to correct the paths. We have attempted to support the FHS standard # #
# here by placing the HQ Agent files similarly to the way Tripwire 2.3 # #
# places them. # #
# ##
##############################################################################
#(
# rulename = "Tripwire HQ Connector Data Files",
# severity = $(SIG_HI)
#)
#{
# #############################################################################
# ##############################################################################
# # NOTE: Removing the inode attribute because when Tripwire creates a backup ##
# # it does so by renaming the old file and creating a new one (which will ##
# # have a new inode number). Leaving inode turned on for keys, which ##
# # shouldn't ever change. ##
# #############################################################################
#
# $(TWBIN)/agent.cfg -> $(SEC_BIN) -i ;
# $(TWLKEY)/authentication.key -> $(SEC_BIN) ;
# $(TWDB)/tasks.dat -> $(SEC_CONFIG) ;
# $(TWDB)/schedule.dat -> $(SEC_CONFIG) ;
#
# # Uncomment if you have agent logging enabled.
# #/var/log/tripwire/agent.log -> $(SEC_LOG) ;
#}
# Commonly accessed directories that should remain static with regards to owner and group
(
rulename = "Invariant Directories",
@ -1078,7 +1037,7 @@ SIG_HI = 100 ; # Critical files that are significant point
#=============================================================================
#
# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Inc. in the United States and other countries. All rights reserved.
#
# Linux is a registered trademark of Linus Torvalds.

159
policy/twpol-GNU.txt Normal file
View File

@ -0,0 +1,159 @@
###############################################################################
# ##
# Default Tripwire 2.4 Policy file for GNU/Hurd ##
# ##
###############################################################################
###############################################################################
# ##
# Global Variable Definitions ##
# ##
# These are defined at install time by the installation script. You may ##
# Manually edit these if you are using this file directly and not from the ##
# installation script itself. ##
# ##
###############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
#########################################
# ##
# Tripwire Binaries and Data Files ##
# ##
#########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
##############################################################################
(rulename="Boot files",)
{
/boot -> $(SEC_READONLY) -a;
}
(rulename="Binary files",)
{
/bin -> $(SEC_READONLY) -a;
/usr/bin -> $(SEC_READONLY) -a;
/usr/local/bin -> $(SEC_READONLY) -a;
}
(rulename="Admin binaries",)
{
/servers -> $(SEC_READONLY) -a;
/sbin -> $(SEC_READONLY) -a;
/usr/sbin -> $(SEC_READONLY) -a;
/hurd -> $(SEC_READONLY) -a;
}
(rulename="Libraries",)
{
/lib -> $(SEC_READONLY) -a;
/usr/lib -> $(SEC_READONLY) -a;
/usr/local/lib -> $(SEC_READONLY) -a;
}
(rulename="Etc",)
{
/etc -> $(SEC_READONLY) -a;
/usr/local/etc -> $(SEC_READONLY) -a;
}
(rulename="Dev",)
{
/dev -> $(SEC_DEVICE);
}
(rulename="Tmp",)
{
/tmp -> $(SEC_TEMPORARY);
/var/tmp -> $(SEC_TEMPORARY);
}
(rulename="Log",)
{
/var/log -> $(SEC_GROWING);
}

View File

@ -1077,7 +1077,7 @@ SIG_HI = 100 ; # Critical files that are significant point
#=============================================================================
#
# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Inc. in the United States and other countries. All rights reserved.
#
# Linux is a registered trademark of Linus Torvalds.

178
policy/twpol-Haiku.txt Normal file
View File

@ -0,0 +1,178 @@
###############################################################################
# ##
# Default Tripwire 2.4 Policy file for Haiku ##
# ##
###############################################################################
###############################################################################
# ##
# Global Variable Definitions ##
# ##
# These are defined at install time by the installation script. You may ##
# Manually edit these if you are using this file directly and not from the ##
# installation script itself. ##
# ##
###############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
#########################################
# ##
# Tripwire Binaries and Data Files ##
# ##
#########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
##############################################################################
### System dir ###############################################################
#
(rulename = "System Directory",)
{
/boot/system -> $(SEC_READONLY) -a;
}
### Other bin dirs ############################################################
#
(rulename = "Binary Directories",)
{
/boot/home/config/bin -> $(SEC_READONLY) -a;
/boot/common/bin -> $(SEC_READONLY) -a;
/boot/apps -> $(SEC_READONLY) -a;
# /boot/develop/tools/gnupro/bin -> $(SEC_READONLY) -a; #uncomment to monitor dev tools if present
}
### Other lib dirs ############################################################
#
(rulename = "Library Directories",)
{
/boot/common/lib -> $(SEC_READONLY) -a;
/boot/home/config/lib -> $(SEC_READONLY) -a;
}
### Other boot dirs ###########################################################
#
(rulename = "Boot Directories",)
{
/boot/common/boot -> $(SEC_READONLY) -a;
/boot/home/config/boot -> $(SEC_READONLY) -a;
}
### Settings ##################################################################
#
(rulename = "Settings",)
{
/boot/common/settings -> $(SEC_READONLY) -a;
/boot/common/data -> $(SEC_READONLY) -a;
/boot/common/etc -> $(SEC_READONLY) -a;
/boot/home/config/settings -> $(SEC_READONLY) -a;
}
# Logs ########################################################################
#
(rulename = "Logs",)
{
/boot/common/var/log -> $(SEC_GROWING) -a;
}
# Dev #########################################################################
#
(rulename = "Devices",)
{
/dev -> $(SEC_DEVICE) -a;
}
# Temp dirs #########################
#
(rulename = "Temp Directories",)
{
/boot/common/cache/tmp -> $(SEC_TEMPORARY) -a;
}

292
policy/twpol-LibertyBSD.txt Normal file
View File

@ -0,0 +1,292 @@
##############################################################################
# ##
############################################################################## #
# # #
# Tripwire 2.4 policy for LibertyBSD # #
# updated March 2018 # #
# ##
##############################################################################
##############################################################################
# ##
############################################################################## #
# # #
# Global Variable Definitions # #
# # #
# These are defined at install time by the installation script. You may # #
# manually edit these if you are using this file directly and not from the # #
# installation script itself. # #
# ##
##############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
########################################
# ##
######################################## #
# # #
# Tripwire Binaries and Data Files # #
# ##
########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
# In this configuration /usr/local is a symbolic link to /home/local.
# We want to ignore the following directories since they are already
# scanned using the real directory or mount point. Otherwise we see
# duplicates in the reports.
!/home/local ;
}
################################################
# ##
################################################ #
# # #
# OS Boot and Configuration Files # #
# ##
################################################
(
rulename = "OS Boot and Configuration Files",
)
{
/boot -> $(SEC_READONLY) ;
/bsd -> $(SEC_READONLY) ;
/etc -> $(SEC_IGNORE_NONE) -SHa ;
}
###################################################
# ##
################################################### #
# # #
# Mount Points # #
# ##
###################################################
(
rulename = "Mount Points",
)
{
/ -> $(SEC_READONLY) ;
/cdrom -> $(SEC_DYNAMIC) ;
/floppy -> $(SEC_DYNAMIC) ;
/home -> $(SEC_READONLY) ; # Modify as needed
/mnt -> $(SEC_DYNAMIC) ;
/usr -> $(SEC_READONLY) ;
/var -> $(SEC_READONLY) ;
}
###################################################
# ##
################################################### #
# # #
# Misc Top-Level Directories # #
# ##
###################################################
(
rulename = "Misc Top-Level Directories",
)
{
/altroot -> $(SEC_DYNAMIC) ;
/stand -> $(SEC_DYNAMIC) ;
}
################################################
# ##
################################################ #
# # #
# System Devices # #
# ##
################################################
(
rulename = "System Devices",
)
{
/dev -> $(SEC_DEVICE) ;
/dev/fd -> $(SEC_DEVICE) ;
/var/cron/tabs/.sock -> $(SEC_DEVICE) ;
/var/empty/dev/log -> $(SEC_DEVICE) ;
}
################################################
# ##
################################################ #
# # #
# OS Binaries and Libraries # #
# ##
################################################
(
rulename = "OS Binaries and Libraries",
)
{
/bin -> $(SEC_READONLY) ;
/sbin -> $(SEC_READONLY) ;
/usr/bin -> $(SEC_READONLY) ;
/usr/lib -> $(SEC_READONLY) ;
/usr/libexec -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
/usr/X11R6/bin -> $(SEC_READONLY) ;
/usr/X11R6/lib -> $(SEC_READONLY) ;
}
################################################
# ##
################################################ #
# # #
# Usr Local Files # #
# ##
################################################
#OK(
#OKrulename = "Usr Local Files",
#OK)
#OK{
#OK/usr/local -> $(SEC_READONLY) ;
#OK/usr/local/bin -> $(SEC_READONLY) ;
#OK/usr/local/doc -> $(SEC_READONLY) ;
#OK/usr/local/etc -> $(SEC_READONLY) ;
#OK/usr/local/include -> $(SEC_READONLY) ;
#OK/usr/local/info -> $(SEC_READONLY) ;
#OK/usr/local/lib -> $(SEC_READONLY) ;
#OK/usr/local/libdata -> $(SEC_READONLY) ;
#OK/usr/local/libexec -> $(SEC_READONLY) ;
#OK/usr/local/man -> $(SEC_READONLY) ;
#OK/usr/local/sbin -> $(SEC_READONLY) ;
#OK/usr/local/share -> $(SEC_READONLY) ;
#OK/usr/local/src -> $(SEC_READONLY) ;
#OK}
################################################
# ##
################################################ #
# # #
# Root Directory and Files # #
# ##
################################################
(
rulename = "Root Directory and Files",
)
{
/root -> $(SEC_IGNORE_NONE) -SHa ;
/root/.cshrc -> $(SEC_DYNAMIC) ;
/root/.profile -> $(SEC_DYNAMIC) ;
}
################################################
# ##
################################################ #
# # #
# Temporary Directories # #
# ##
################################################
(
rulename = "Temporary Directories",
)
{
/tmp -> $(SEC_TEMPORARY) ;
/var/tmp -> $(SEC_TEMPORARY) ;
}
################################################
# ##
################################################ #
# # #
# System and Boot Changes # #
# ##
################################################
(
rulename = "System and Boot Changes",
)
{
/var/backups -> $(SEC_DYNAMIC) -i ;
/var/db/host.random -> $(SEC_READONLY) -mCM ;
/var/cron -> $(SEC_GROWING) -i ;
/var/log -> $(SEC_GROWING) -i ;
/var/run -> $(SEC_DYNAMIC) -i ;
/var/mail -> $(SEC_GROWING) ;
/var/msgs/bounds -> $(SEC_READONLY) -smbCM ;
/var/spool/clientmqueue -> $(SEC_TEMPORARY) ;
/var/spool/mqueue -> $(SEC_TEMPORARY) ;
}
#
# $Id: twpol-OpenBSD.txt,v 1.2 2004/05/14 21:56:21 pherman Exp $
#

View File

@ -2,7 +2,8 @@
# ##
############################################################################## #
# # #
# Policy file for Red Hat Linux # #
# Tripwire 2.4 policy for Linux (RPM) # #
# updated March 2018 # #
# ##
##############################################################################
@ -59,13 +60,13 @@ HOSTNAME=;
#
##############################################################################
Device = +pugsdr-intlbamcCMSH ;
Dynamic = +pinugtd-srlbamcCMSH ;
Growing = +pinugtdl-srbamcCMSH ;
IgnoreAll = -pinugtsdrlbamcCMSH ;
IgnoreNone = +pinugtsdrbamcCMSH-l ;
ReadOnly = +pinugtsdbmCM-rlacSH ;
Temporary = +pugt ;
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
@ -82,10 +83,10 @@ Temporary = +pugt ;
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(ReadOnly) ;
$(TWBIN)/tripwire -> $(ReadOnly) ;
$(TWBIN)/twadmin -> $(ReadOnly) ;
$(TWBIN)/twprint -> $(ReadOnly) ;
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
@ -102,14 +103,14 @@ Temporary = +pugt ;
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(Dynamic) -i ;
$(TWPOL)/tw.pol -> $(ReadOnly) -i ;
$(TWPOL)/tw.cfg -> $(ReadOnly) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ;
$(TWSKEY)/site.key -> $(ReadOnly) ;
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(Dynamic) (recurse=0) ;
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
################################################
@ -123,10 +124,10 @@ Temporary = +pugt ;
rulename = "RPM Checksum Files",
)
{
/var/lib/rpm -> $(ReadOnly);
/var/lib/rpm/__db.001 -> $(Dynamic) ;
/var/lib/rpm/__db.002 -> $(Dynamic) ;
/var/lib/rpm/__db.003 -> $(Dynamic) ;
/var/lib/rpm -> $(SEC_READONLY);
/var/lib/rpm/__db.001 -> $(SEC_DYNAMIC) ;
/var/lib/rpm/__db.002 -> $(SEC_DYNAMIC) ;
/var/lib/rpm/__db.003 -> $(SEC_DYNAMIC) ;
}
################################################
@ -140,18 +141,18 @@ Temporary = +pugt ;
rulename = "Global Configuration Files",
)
{
/etc -> $(IgnoreNone) -SHa ;
/etc/adjtime -> $(Dynamic) ;
/etc/aliases.db -> $(Dynamic) ;
/etc/bashrc -> $(Dynamic) ;
/etc/csh.cshrc -> $(Dynamic) ;
/etc/csh.login -> $(Dynamic) ;
/etc/mail/statistics -> $(Growing) ;
/etc/profile -> $(Dynamic) -i ;
/etc/mtab -> $(Dynamic) -i ;
/etc/rc.d -> $(IgnoreNone) -SHa ;
/etc/sysconfig -> $(IgnoreNone) -SHa ;
/etc/sysconfig/hwconf -> $(Dynamic) -m ;
/etc -> $(SEC_IGNORE_NONE) -SHa ;
/etc/adjtime -> $(SEC_DYNAMIC) ;
/etc/aliases.db -> $(SEC_DYNAMIC) ;
/etc/bashrc -> $(SEC_DYNAMIC) ;
/etc/csh.cshrc -> $(SEC_DYNAMIC) ;
/etc/csh.login -> $(SEC_DYNAMIC) ;
/etc/mail/statistics -> $(SEC_GROWING) ;
/etc/profile -> $(SEC_DYNAMIC) -i ;
/etc/mtab -> $(SEC_DYNAMIC) -i ;
/etc/rc.d -> $(SEC_IGNORE_NONE) -SHa ;
/etc/sysconfig -> $(SEC_IGNORE_NONE) -SHa ;
/etc/sysconfig/hwconf -> $(SEC_DYNAMIC) -m ;
}
################################################
@ -165,10 +166,10 @@ Temporary = +pugt ;
rulename = "OS Boot Files and Mount Points",
)
{
/boot -> $(ReadOnly) ;
/cdrom -> $(Dynamic) ;
/floppy -> $(Dynamic) ;
/mnt -> $(Dynamic) ;
/boot -> $(SEC_READONLY) ;
/cdrom -> $(SEC_DYNAMIC) ;
/floppy -> $(SEC_DYNAMIC) ;
/mnt -> $(SEC_DYNAMIC) ;
}
################################################
@ -182,12 +183,12 @@ Temporary = +pugt ;
rulename = "OS Devices and Misc Directories",
)
{
/dev -> $(Device) ;
/initrd -> $(Dynamic) ;
/opt -> $(Dynamic) ;
/lost+found -> $(Dynamic) ;
/var/lost+found -> $(Dynamic) ;
/home/lost+found -> $(Dynamic) ;
/dev -> $(SEC_DEVICE) ;
/initrd -> $(SEC_DYNAMIC) ;
/opt -> $(SEC_DYNAMIC) ;
/lost+found -> $(SEC_DYNAMIC) ;
/var/lost+found -> $(SEC_DYNAMIC) ;
/home/lost+found -> $(SEC_DYNAMIC) ;
!/dev/pts ; # Ignore this file
!/dev/shm ; # Ignore this file
}
@ -203,14 +204,14 @@ Temporary = +pugt ;
rulename = "OS Binaries and Libraries",
)
{
/bin -> $(ReadOnly) ;
/lib -> $(ReadOnly) ;
/sbin -> $(ReadOnly) ;
/usr/bin -> $(ReadOnly) ;
/usr/lib -> $(ReadOnly) ;
/usr/libexec -> $(ReadOnly) ;
/usr/sbin -> $(ReadOnly) ;
/usr/X11R6/lib -> $(ReadOnly) ;
/bin -> $(SEC_READONLY) ;
/lib -> $(SEC_READONLY) ;
/sbin -> $(SEC_READONLY) ;
/usr/bin -> $(SEC_READONLY) ;
/usr/lib -> $(SEC_READONLY) ;
/usr/libexec -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
/usr/X11R6/lib -> $(SEC_READONLY) ;
}
################################################
# ##
@ -224,19 +225,19 @@ Temporary = +pugt ;
)
{
!/home/local;
/usr/local -> $(ReadOnly) ;
/usr/local/bin -> $(ReadOnly) ;
/usr/local/doc -> $(ReadOnly) ;
/usr/local/etc -> $(ReadOnly) ;
/usr/local/games -> $(ReadOnly) ;
/usr/local/include -> $(ReadOnly) ;
/usr/local/lib -> $(ReadOnly) ;
/usr/local/libexec -> $(ReadOnly) ;
/usr/local/man -> $(ReadOnly) ;
/usr/local/sbin -> $(ReadOnly) ;
/usr/local/share -> $(ReadOnly) ;
/usr/local/src -> $(ReadOnly) ;
/usr/local/sysinfo -> $(ReadOnly) ;
/usr/local -> $(SEC_READONLY) ;
/usr/local/bin -> $(SEC_READONLY) ;
/usr/local/doc -> $(SEC_READONLY) ;
/usr/local/etc -> $(SEC_READONLY) ;
/usr/local/games -> $(SEC_READONLY) ;
/usr/local/include -> $(SEC_READONLY) ;
/usr/local/lib -> $(SEC_READONLY) ;
/usr/local/libexec -> $(SEC_READONLY) ;
/usr/local/man -> $(SEC_READONLY) ;
/usr/local/sbin -> $(SEC_READONLY) ;
/usr/local/share -> $(SEC_READONLY) ;
/usr/local/src -> $(SEC_READONLY) ;
/usr/local/sysinfo -> $(SEC_READONLY) ;
}
################################################
@ -250,29 +251,29 @@ Temporary = +pugt ;
rulename = "Root Directory and Files",
)
{
/root -> $(IgnoreNone) -SHa ;
/root/.bashrc -> $(Dynamic) ;
/root/.bash_history -> $(Dynamic) ;
#/root/.bash_logout -> $(Dynamic) ;
/root/.bash_profile -> $(Dynamic) ;
/root/.cshrc -> $(Dynamic) ;
#/root/.enlightenment -> $(Dynamic) ;
#/root/.esd-auth -> $(Dynamic) ;
/root -> $(SEC_IGNORE_NONE) -SHa ;
/root/.bashrc -> $(SEC_DYNAMIC) ;
/root/.bash_history -> $(SEC_DYNAMIC) ;
#/root/.bash_logout -> $(SEC_DYNAMIC) ;
/root/.bash_profile -> $(SEC_DYNAMIC) ;
/root/.cshrc -> $(SEC_DYNAMIC) ;
#/root/.enlightenment -> $(SEC_DYNAMIC) ;
#/root/.esd-auth -> $(SEC_DYNAMIC) ;
!/root/.gconf ;
!/root/.gconfd ;
#/root/.gnome -> $(Dynamic) ;
#/root/.gnome-desktop -> $(Dynamic) ;
#/root/.gnome2 -> $(Dynamic) ;
#/root/.gtkrc -> $(Dynamic) ;
#/root/.gtkrc-1.2-gnome2 -> $(Dynamic) ;
#/root/.metacity -> $(Dynamic) ;
#/root/.nautilus -> $(Dynamic) ;
#/root/.rhn-applet.conf -> $(Dynamic) ;
#/root/.tcshrc -> $(Dynamic) ;
#/root/.xauth -> $(Dynamic) ;
#/root/.ICEauthority -> $(Dynamic) ;
#/root/.Xauthority -> $(Dynamic) -i ;
#/root/.Xresources -> $(Dynamic) ;
#/root/.gnome -> $(SEC_DYNAMIC) ;
#/root/.gnome-desktop -> $(SEC_DYNAMIC) ;
#/root/.gnome2 -> $(SEC_DYNAMIC) ;
#/root/.gtkrc -> $(SEC_DYNAMIC) ;
#/root/.gtkrc-1.2-gnome2 -> $(SEC_DYNAMIC) ;
#/root/.metacity -> $(SEC_DYNAMIC) ;
#/root/.nautilus -> $(SEC_DYNAMIC) ;
#/root/.rhn-applet.conf -> $(SEC_DYNAMIC) ;
#/root/.tcshrc -> $(SEC_DYNAMIC) ;
#/root/.xauth -> $(SEC_DYNAMIC) ;
#/root/.ICEauthority -> $(SEC_DYNAMIC) ;
#/root/.Xauthority -> $(SEC_DYNAMIC) -i ;
#/root/.Xresources -> $(SEC_DYNAMIC) ;
}
################################################
@ -286,12 +287,12 @@ Temporary = +pugt ;
rulename = "Temporary Directories",
)
{
/usr/tmp -> $(Temporary) ;
/var/tmp -> $(Temporary) ;
/tmp -> $(Temporary) ;
#/tmp/.fam-socket -> $(Temporary) ;
#/tmp/.ICE-unix -> $(Temporary) ;
#/tmp/.X11-unix -> $(Temporary) ;
/usr/tmp -> $(SEC_TEMPORARY) ;
/var/tmp -> $(SEC_TEMPORARY) ;
/tmp -> $(SEC_TEMPORARY) ;
#/tmp/.fam-socket -> $(SEC_TEMPORARY) ;
#/tmp/.ICE-unix -> $(SEC_TEMPORARY) ;
#/tmp/.X11-unix -> $(SEC_TEMPORARY) ;
!/tmp/orbit-root ;
}
@ -306,21 +307,21 @@ Temporary = +pugt ;
rulename = "System Boot Changes",
)
{
/.autofsck -> $(Dynamic) -m ;
/var/cache/man/whatis -> $(Growing) ;
/var/lib/logrotate.status -> $(Growing) ;
#/var/lib/nfs/statd -> $(Growing) ;
/.autofsck -> $(SEC_DYNAMIC) -m ;
/var/cache/man/whatis -> $(SEC_GROWING) ;
/var/lib/logrotate.status -> $(SEC_GROWING) ;
#/var/lib/nfs/statd -> $(SEC_GROWING) ;
!/var/lib/random-seed ;
#/var/lib/slocate/slocate.db -> $(Growing) -is ;
/var/lock/subsys -> $(Dynamic) -i ;
/var/log -> $(Growing) -i ;
#/var/lib/slocate/slocate.db -> $(SEC_GROWING) -is ;
/var/lock/subsys -> $(SEC_DYNAMIC) -i ;
/var/log -> $(SEC_GROWING) -i ;
!/var/log/sa;
!/var/log/cisco;
/var/run -> $(Dynamic) -i ;
/etc/cron.daily -> $(Growing);
/etc/cron.weekly -> $(Growing);
/etc/cron.monthly -> $(Growing);
/var/spool/mail -> $(Growing);
/var/run -> $(SEC_DYNAMIC) -i ;
/etc/cron.daily -> $(SEC_GROWING);
/etc/cron.weekly -> $(SEC_GROWING);
/etc/cron.monthly -> $(SEC_GROWING);
/var/spool/mail -> $(SEC_GROWING);
}
################################################
@ -334,10 +335,10 @@ Temporary = +pugt ;
rulename = "Monitor Filesystems",
)
{
/ -> $(ReadOnly) ;
/home -> $(ReadOnly) ; # Modify as needed
/usr -> $(ReadOnly) ;
/var -> $(ReadOnly) ;
/ -> $(SEC_READONLY) ;
/home -> $(SEC_READONLY) ; # Modify as needed
/usr -> $(SEC_READONLY) ;
/var -> $(SEC_READONLY) ;
}
################################################

View File

@ -54,13 +54,21 @@ TWREPORT=;
HOSTNAME=;
@@section FS
SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change
SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(ReadOnly) ; # Binaries that should not change
SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(Dynamic)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
SEC_CRIT = $(SEC_IGNORE_NONE)-SHa ; # Critical files that cannot change
SEC_SUID = $(SEC_IGNORE_NONE)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(SEC_READONLY) ; # Binaries that should not change
SEC_CONFIG = $(SEC_DYNAMIC) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(SEC_DYNAMIC)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(SEC_GROWING) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = $(SEC_TEMPORARY) ; # Directories that should never change permission or ownership
SIG_LOW = 33 ; # Non-critical files that are of minimal security impact
SIG_MED = 66 ; # Non-critical files that are of significant security impact
SIG_HI = 100 ; # Critical files that are significant points of vulnerability
@ -630,7 +638,7 @@ SIG_HI = 100 ; # Critical files that are significant point
#=============================================================================
#
# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Inc. in the United States and other countries. All rights reserved.
#
# FreeBSD is a registered trademark of the FreeBSD Project Inc.

176
policy/twpol-Minix.txt Normal file
View File

@ -0,0 +1,176 @@
###############################################################################
# ##
# Default Tripwire 2.4 Policy file for Minix ##
# ##
###############################################################################
###############################################################################
# ##
# Global Variable Definitions ##
# ##
# These are defined at install time by the installation script. You may ##
# Manually edit these if you are using this file directly and not from the ##
# installation script itself. ##
# ##
###############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
#########################################
# ##
# Tripwire Binaries and Data Files ##
# ##
#########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
##############################################################################
(rulename="Boot files",)
{
/boot -> $(SEC_READONLY) -a;
/boot_monitor -> $(SEC_READONLY) -a;
/boot.cfg -> $(SEC_READONLY) -a;
}
(rulename="Binary files",)
{
/bin -> $(SEC_READONLY) -a;
/usr/bin -> $(SEC_READONLY) -a;
/usr/local/bin -> $(SEC_READONLY) -a;
/usr/pkg/bin -> $(SEC_READONLY) -a;
}
(rulename="Development",)
{
/usr/pkg/gnu/bin -> $(SEC_READONLY) -a;
/usr/pkg/i386-elf32-minix/bin -> $(SEC_READONLY) -a;
}
(rulename="Libexec",)
{
/usr/libexec -> $(SEC_READONLY) -a;
/usr/pkg/libexec -> $(SEC_READONLY) -a;
}
(rulename="Admin binaries",)
{
/service -> $(SEC_READONLY) -a;
/sbin -> $(SEC_READONLY) -a;
/usr/sbin -> $(SEC_READONLY) -a;
/usr/pkg/sbin -> $(SEC_READONLY) -a;
}
(rulename="Libraries",)
{
/lib -> $(SEC_READONLY) -a;
/usr/lib -> $(SEC_READONLY) -a;
/usr/pkg/lib -> $(SEC_READONLY) -a;
}
(rulename="Etc",)
{
/etc -> $(SEC_READONLY) -a;
/usr/etc -> $(SEC_READONLY) -a;
/usr/pkg/etc -> $(SEC_READONLY) -a;
}
(rulename="Dev",)
{
/dev -> $(SEC_DEVICE);
}
(rulename="Tmp",)
{
/tmp -> $(SEC_TEMPORARY);
/var/tmp -> $(SEC_TEMPORARY);
/usr/tmp -> $(SEC_TEMPORARY);
}
(rulename="Log",)
{
/var/log -> $(SEC_GROWING);
}

View File

@ -2,8 +2,8 @@
# ##
############################################################################## #
# # #
# Policy file for MirOS BSD # #
# (adapted from OpenBSD policy) # #
# Tripwire 2.4 policy for MirOS BSD # #
# updated March 2018 # #
# ##
##############################################################################
@ -60,13 +60,13 @@ HOSTNAME=;
#
##############################################################################
Device = +pugsdr-intlbamcCMSH ;
Dynamic = +pinugtd-srlbamcCMSH ;
Growing = +pinugtdl-srbamcCMSH ;
IgnoreAll = -pinugtsdrlbamcCMSH ;
IgnoreNone = +pinugtsdrbamcCMSH-l ;
ReadOnly = +pinugtsdbmCM-rlacSH ;
Temporary = +pugt ;
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
@ -83,10 +83,10 @@ Temporary = +pugt ;
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(ReadOnly) ;
$(TWBIN)/tripwire -> $(ReadOnly) ;
$(TWBIN)/twadmin -> $(ReadOnly) ;
$(TWBIN)/twprint -> $(ReadOnly) ;
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
@ -103,14 +103,14 @@ Temporary = +pugt ;
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(Dynamic) -i ;
$(TWPOL)/tw.pol -> $(ReadOnly) -i ;
$(TWPOL)/tw.cfg -> $(ReadOnly) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ;
$(TWSKEY)/site.key -> $(ReadOnly) ;
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(Dynamic) (recurse=0) ;
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
# In this configuration /usr/local is a symbolic link to /home/local.
# We want to ignore the following directories since they are already
@ -131,9 +131,9 @@ Temporary = +pugt ;
rulename = "OS Boot and Configuration Files",
)
{
/boot -> $(ReadOnly) ;
/bsd -> $(ReadOnly) ;
/etc -> $(IgnoreNone) -SHa ;
/boot -> $(SEC_READONLY) ;
/bsd -> $(SEC_READONLY) ;
/etc -> $(SEC_IGNORE_NONE) -SHa ;
}
###################################################
@ -147,13 +147,13 @@ Temporary = +pugt ;
rulename = "Mount Points",
)
{
/ -> $(ReadOnly) ;
/cdrom -> $(Dynamic) ;
/floppy -> $(Dynamic) ;
/home -> $(ReadOnly) ; # Modify as needed
/mnt -> $(Dynamic) ;
/usr -> $(ReadOnly) ;
/var -> $(ReadOnly) ;
/ -> $(SEC_READONLY) ;
/cdrom -> $(SEC_DYNAMIC) ;
/floppy -> $(SEC_DYNAMIC) ;
/home -> $(SEC_READONLY) ; # Modify as needed
/mnt -> $(SEC_DYNAMIC) ;
/usr -> $(SEC_READONLY) ;
/var -> $(SEC_READONLY) ;
}
###################################################
@ -167,8 +167,8 @@ Temporary = +pugt ;
rulename = "Misc Top-Level Directories",
)
{
/altroot -> $(Dynamic) ;
/stand -> $(Dynamic) ;
/altroot -> $(SEC_DYNAMIC) ;
/stand -> $(SEC_DYNAMIC) ;
}
################################################
@ -182,10 +182,10 @@ Temporary = +pugt ;
rulename = "System Devices",
)
{
/dev -> $(Device) ;
/dev/fd -> $(Device) ;
/var/cron/tabs/.sock -> $(Device) ;
/var/empty/dev/log -> $(Device) ;
/dev -> $(SEC_DEVICE) ;
/dev/fd -> $(SEC_DEVICE) ;
/var/cron/tabs/.sock -> $(SEC_DEVICE) ;
/var/empty/dev/log -> $(SEC_DEVICE) ;
}
################################################
@ -199,14 +199,14 @@ Temporary = +pugt ;
rulename = "OS Binaries and Libraries",
)
{
/bin -> $(ReadOnly) ;
/sbin -> $(ReadOnly) ;
/usr/bin -> $(ReadOnly) ;
/usr/lib -> $(ReadOnly) ;
/usr/libexec -> $(ReadOnly) ;
/usr/sbin -> $(ReadOnly) ;
/usr/X11R6/bin -> $(ReadOnly) ;
/usr/X11R6/lib -> $(ReadOnly) ;
/bin -> $(SEC_READONLY) ;
/sbin -> $(SEC_READONLY) ;
/usr/bin -> $(SEC_READONLY) ;
/usr/lib -> $(SEC_READONLY) ;
/usr/libexec -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
/usr/X11R6/bin -> $(SEC_READONLY) ;
/usr/X11R6/lib -> $(SEC_READONLY) ;
}
################################################
# ##
@ -219,19 +219,19 @@ Temporary = +pugt ;
#OKrulename = "Usr Local Files",
#OK)
#OK{
#OK/usr/local -> $(ReadOnly) ;
#OK/usr/local/bin -> $(ReadOnly) ;
#OK/usr/local/doc -> $(ReadOnly) ;
#OK/usr/local/etc -> $(ReadOnly) ;
#OK/usr/local/include -> $(ReadOnly) ;
#OK/usr/local/info -> $(ReadOnly) ;
#OK/usr/local/lib -> $(ReadOnly) ;
#OK/usr/local/libdata -> $(ReadOnly) ;
#OK/usr/local/libexec -> $(ReadOnly) ;
#OK/usr/local/man -> $(ReadOnly) ;
#OK/usr/local/sbin -> $(ReadOnly) ;
#OK/usr/local/share -> $(ReadOnly) ;
#OK/usr/local/src -> $(ReadOnly) ;
#OK/usr/local -> $(SEC_READONLY) ;
#OK/usr/local/bin -> $(SEC_READONLY) ;
#OK/usr/local/doc -> $(SEC_READONLY) ;
#OK/usr/local/etc -> $(SEC_READONLY) ;
#OK/usr/local/include -> $(SEC_READONLY) ;
#OK/usr/local/info -> $(SEC_READONLY) ;
#OK/usr/local/lib -> $(SEC_READONLY) ;
#OK/usr/local/libdata -> $(SEC_READONLY) ;
#OK/usr/local/libexec -> $(SEC_READONLY) ;
#OK/usr/local/man -> $(SEC_READONLY) ;
#OK/usr/local/sbin -> $(SEC_READONLY) ;
#OK/usr/local/share -> $(SEC_READONLY) ;
#OK/usr/local/src -> $(SEC_READONLY) ;
#OK}
################################################
@ -245,9 +245,9 @@ Temporary = +pugt ;
rulename = "Root Directory and Files",
)
{
/root -> $(IgnoreNone) -SHa ;
/root/.cshrc -> $(Dynamic) ;
/root/.profile -> $(Dynamic) ;
/root -> $(SEC_IGNORE_NONE) -SHa ;
/root/.cshrc -> $(SEC_DYNAMIC) ;
/root/.profile -> $(SEC_DYNAMIC) ;
}
################################################
@ -261,8 +261,8 @@ Temporary = +pugt ;
rulename = "Temporary Directories",
)
{
/tmp -> $(Temporary) ;
/var/tmp -> $(Temporary) ;
/tmp -> $(SEC_TEMPORARY) ;
/var/tmp -> $(SEC_TEMPORARY) ;
}
################################################
@ -276,15 +276,15 @@ Temporary = +pugt ;
rulename = "System and Boot Changes",
)
{
/var/backups -> $(Dynamic) -i ;
/var/db/host.random -> $(ReadOnly) -mCM ;
/var/cron -> $(Growing) -i ;
/var/log -> $(Growing) -i ;
/var/run -> $(Dynamic) -i ;
/var/mail -> $(Growing) ;
/var/msgs/bounds -> $(ReadOnly) -smbCM ;
/var/spool/clientmqueue -> $(Temporary) ;
/var/spool/mqueue -> $(Temporary) ;
/var/backups -> $(SEC_DYNAMIC) -i ;
/var/db/host.random -> $(SEC_READONLY) -mCM ;
/var/cron -> $(SEC_GROWING) -i ;
/var/log -> $(SEC_GROWING) -i ;
/var/run -> $(SEC_DYNAMIC) -i ;
/var/mail -> $(SEC_GROWING) ;
/var/msgs/bounds -> $(SEC_READONLY) -smbCM ;
/var/spool/clientmqueue -> $(SEC_TEMPORARY) ;
/var/spool/mqueue -> $(SEC_TEMPORARY) ;
}
#

View File

@ -54,13 +54,21 @@ TWREPORT=;
HOSTNAME=;
@@section FS
SEC_CRIT = $(IgnoreNone)-SHa ; # Critical files that cannot change
SEC_SUID = $(IgnoreNone)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(ReadOnly) ; # Binaries that should not change
SEC_CONFIG = $(Dynamic) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(Dynamic)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(Growing) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = +tpug ; # Directories that should never change permission or ownership
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
SEC_CRIT = $(SEC_IGNORE_NONE)-SHa ; # Critical files that cannot change
SEC_SUID = $(SEC_IGNORE_NONE)-SHa ; # Binaries with the SUID or SGID flags set
SEC_BIN = $(SEC_READONLY) ; # Binaries that should not change
SEC_CONFIG = $(SEC_DYNAMIC) ; # Config files that are changed infrequently but accessed often
SEC_TTY = $(SEC_DYNAMIC)-ugp ; # Tty files that change ownership at login
SEC_LOG = $(SEC_GROWING) ; # Files that grow, but that should never change ownership
SEC_INVARIANT = $(SEC_TEMPORARY) ; # Directories that should never change permission or ownership
SIG_LOW = 33 ; # Non-critical files that are of minimal security impact
SIG_MED = 66 ; # Non-critical files that are of significant security impact
SIG_HI = 100 ; # Critical files that are significant points of vulnerability
@ -630,7 +638,7 @@ SIG_HI = 100 ; # Critical files that are significant point
#=============================================================================
#
# Copyright 2000-2017 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Copyright 2000-2018 Tripwire, Inc. Tripwire is a registered trademark of Tripwire,
# Inc. in the United States and other countries. All rights reserved.
#
# FreeBSD is a registered trademark of the FreeBSD Project Inc.

View File

@ -2,8 +2,8 @@
# ##
############################################################################## #
# # #
# Policy file for OpenBSD 3.5 # #
# May 20, 2003 # #
# Tripwire 2.4 policy for OpenBSD # #
# updated March 2018 # #
# ##
##############################################################################
@ -60,13 +60,13 @@ HOSTNAME=;
#
##############################################################################
Device = +pugsdr-intlbamcCMSH ;
Dynamic = +pinugtd-srlbamcCMSH ;
Growing = +pinugtdl-srbamcCMSH ;
IgnoreAll = -pinugtsdrlbamcCMSH ;
IgnoreNone = +pinugtsdrbamcCMSH-l ;
ReadOnly = +pinugtsdbmCM-rlacSH ;
Temporary = +pugt ;
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
@ -83,10 +83,10 @@ Temporary = +pugt ;
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(ReadOnly) ;
$(TWBIN)/tripwire -> $(ReadOnly) ;
$(TWBIN)/twadmin -> $(ReadOnly) ;
$(TWBIN)/twprint -> $(ReadOnly) ;
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
@ -103,14 +103,14 @@ Temporary = +pugt ;
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(Dynamic) -i ;
$(TWPOL)/tw.pol -> $(ReadOnly) -i ;
$(TWPOL)/tw.cfg -> $(ReadOnly) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ;
$(TWSKEY)/site.key -> $(ReadOnly) ;
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(Dynamic) (recurse=0) ;
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
# In this configuration /usr/local is a symbolic link to /home/local.
# We want to ignore the following directories since they are already
@ -131,9 +131,9 @@ Temporary = +pugt ;
rulename = "OS Boot and Configuration Files",
)
{
/boot -> $(ReadOnly) ;
/bsd -> $(ReadOnly) ;
/etc -> $(IgnoreNone) -SHa ;
/boot -> $(SEC_READONLY) ;
/bsd -> $(SEC_READONLY) ;
/etc -> $(SEC_IGNORE_NONE) -SHa ;
}
###################################################
@ -147,13 +147,13 @@ Temporary = +pugt ;
rulename = "Mount Points",
)
{
/ -> $(ReadOnly) ;
/cdrom -> $(Dynamic) ;
/floppy -> $(Dynamic) ;
/home -> $(ReadOnly) ; # Modify as needed
/mnt -> $(Dynamic) ;
/usr -> $(ReadOnly) ;
/var -> $(ReadOnly) ;
/ -> $(SEC_READONLY) ;
/cdrom -> $(SEC_DYNAMIC) ;
/floppy -> $(SEC_DYNAMIC) ;
/home -> $(SEC_READONLY) ; # Modify as needed
/mnt -> $(SEC_DYNAMIC) ;
/usr -> $(SEC_READONLY) ;
/var -> $(SEC_READONLY) ;
}
###################################################
@ -167,8 +167,8 @@ Temporary = +pugt ;
rulename = "Misc Top-Level Directories",
)
{
/altroot -> $(Dynamic) ;
/stand -> $(Dynamic) ;
/altroot -> $(SEC_DYNAMIC) ;
/stand -> $(SEC_DYNAMIC) ;
}
################################################
@ -182,10 +182,10 @@ Temporary = +pugt ;
rulename = "System Devices",
)
{
/dev -> $(Device) ;
/dev/fd -> $(Device) ;
/var/cron/tabs/.sock -> $(Device) ;
/var/empty/dev/log -> $(Device) ;
/dev -> $(SEC_DEVICE) ;
/dev/fd -> $(SEC_DEVICE) ;
/var/cron/tabs/.sock -> $(SEC_DEVICE) ;
/var/empty/dev/log -> $(SEC_DEVICE) ;
}
################################################
@ -199,14 +199,14 @@ Temporary = +pugt ;
rulename = "OS Binaries and Libraries",
)
{
/bin -> $(ReadOnly) ;
/sbin -> $(ReadOnly) ;
/usr/bin -> $(ReadOnly) ;
/usr/lib -> $(ReadOnly) ;
/usr/libexec -> $(ReadOnly) ;
/usr/sbin -> $(ReadOnly) ;
/usr/X11R6/bin -> $(ReadOnly) ;
/usr/X11R6/lib -> $(ReadOnly) ;
/bin -> $(SEC_READONLY) ;
/sbin -> $(SEC_READONLY) ;
/usr/bin -> $(SEC_READONLY) ;
/usr/lib -> $(SEC_READONLY) ;
/usr/libexec -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
/usr/X11R6/bin -> $(SEC_READONLY) ;
/usr/X11R6/lib -> $(SEC_READONLY) ;
}
################################################
# ##
@ -219,19 +219,19 @@ Temporary = +pugt ;
#OKrulename = "Usr Local Files",
#OK)
#OK{
#OK/usr/local -> $(ReadOnly) ;
#OK/usr/local/bin -> $(ReadOnly) ;
#OK/usr/local/doc -> $(ReadOnly) ;
#OK/usr/local/etc -> $(ReadOnly) ;
#OK/usr/local/include -> $(ReadOnly) ;
#OK/usr/local/info -> $(ReadOnly) ;
#OK/usr/local/lib -> $(ReadOnly) ;
#OK/usr/local/libdata -> $(ReadOnly) ;
#OK/usr/local/libexec -> $(ReadOnly) ;
#OK/usr/local/man -> $(ReadOnly) ;
#OK/usr/local/sbin -> $(ReadOnly) ;
#OK/usr/local/share -> $(ReadOnly) ;
#OK/usr/local/src -> $(ReadOnly) ;
#OK/usr/local -> $(SEC_READONLY) ;
#OK/usr/local/bin -> $(SEC_READONLY) ;
#OK/usr/local/doc -> $(SEC_READONLY) ;
#OK/usr/local/etc -> $(SEC_READONLY) ;
#OK/usr/local/include -> $(SEC_READONLY) ;
#OK/usr/local/info -> $(SEC_READONLY) ;
#OK/usr/local/lib -> $(SEC_READONLY) ;
#OK/usr/local/libdata -> $(SEC_READONLY) ;
#OK/usr/local/libexec -> $(SEC_READONLY) ;
#OK/usr/local/man -> $(SEC_READONLY) ;
#OK/usr/local/sbin -> $(SEC_READONLY) ;
#OK/usr/local/share -> $(SEC_READONLY) ;
#OK/usr/local/src -> $(SEC_READONLY) ;
#OK}
################################################
@ -245,9 +245,9 @@ Temporary = +pugt ;
rulename = "Root Directory and Files",
)
{
/root -> $(IgnoreNone) -SHa ;
/root/.cshrc -> $(Dynamic) ;
/root/.profile -> $(Dynamic) ;
/root -> $(SEC_IGNORE_NONE) -SHa ;
/root/.cshrc -> $(SEC_DYNAMIC) ;
/root/.profile -> $(SEC_DYNAMIC) ;
}
################################################
@ -261,8 +261,8 @@ Temporary = +pugt ;
rulename = "Temporary Directories",
)
{
/tmp -> $(Temporary) ;
/var/tmp -> $(Temporary) ;
/tmp -> $(SEC_TEMPORARY) ;
/var/tmp -> $(SEC_TEMPORARY) ;
}
################################################
@ -276,15 +276,15 @@ Temporary = +pugt ;
rulename = "System and Boot Changes",
)
{
/var/backups -> $(Dynamic) -i ;
/var/db/host.random -> $(ReadOnly) -mCM ;
/var/cron -> $(Growing) -i ;
/var/log -> $(Growing) -i ;
/var/run -> $(Dynamic) -i ;
/var/mail -> $(Growing) ;
/var/msgs/bounds -> $(ReadOnly) -smbCM ;
/var/spool/clientmqueue -> $(Temporary) ;
/var/spool/mqueue -> $(Temporary) ;
/var/backups -> $(SEC_DYNAMIC) -i ;
/var/db/host.random -> $(SEC_READONLY) -mCM ;
/var/cron -> $(SEC_GROWING) -i ;
/var/log -> $(SEC_GROWING) -i ;
/var/run -> $(SEC_DYNAMIC) -i ;
/var/mail -> $(SEC_GROWING) ;
/var/msgs/bounds -> $(SEC_READONLY) -smbCM ;
/var/spool/clientmqueue -> $(SEC_TEMPORARY) ;
/var/spool/mqueue -> $(SEC_TEMPORARY) ;
}
#

View File

@ -2,7 +2,8 @@
# ##
############################################################################## #
# # #
# Policy file for Solaris 8 # #
# Tripwire 2.4 policy for Solaris # #
# updated March 2018 # #
# ##
##############################################################################
@ -61,13 +62,13 @@ HOSTNAME=;
#
##############################################################################
Device = +pugsdr-intlbamcCMSH ;
Dynamic = +pinugtd-srlbamcCMSH ;
Growing = +pinugtdl-srbamcCMSH ;
IgnoreAll = -pinugtsdrlbamcCMSH ;
IgnoreNone = +pinugtsdrbamcCMSH-l ;
ReadOnly = +pinugtsdbmCM-rlacSH ;
Temporary = +pugt ;
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
@ -84,10 +85,10 @@ Temporary = +pugt ;
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(ReadOnly) ;
$(TWBIN)/tripwire -> $(ReadOnly) ;
$(TWBIN)/twadmin -> $(ReadOnly) ;
$(TWBIN)/twprint -> $(ReadOnly) ;
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
@ -104,14 +105,14 @@ Temporary = +pugt ;
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(Dynamic) -i ;
$(TWPOL)/tw.pol -> $(ReadOnly) -i ;
$(TWPOL)/tw.cfg -> $(ReadOnly) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(ReadOnly) ;
$(TWSKEY)/site.key -> $(ReadOnly) ;
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(Dynamic) (recurse=0) ;
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
# In this configuration /usr/local is a symbolic link to /home/local.
# We want to ignore the following directories since they are already
@ -132,8 +133,8 @@ Temporary = +pugt ;
rulename = "OS Boot and Configuration Files",
)
{
/etc -> $(IgnoreNone) -SHa ;
/kernel -> $(ReadOnly) ;
/etc -> $(SEC_IGNORE_NONE) -SHa ;
/kernel -> $(SEC_READONLY) ;
}
###################################################
@ -147,13 +148,13 @@ Temporary = +pugt ;
rulename = "Mount Points",
)
{
/ -> $(ReadOnly) ;
/cdrom -> $(Dynamic) ;
/home -> $(ReadOnly) ;
/mnt -> $(Dynamic) ;
/usr -> $(ReadOnly) ;
/var -> $(ReadOnly) ;
/opt -> $(ReadOnly) ;
/ -> $(SEC_READONLY) ;
/cdrom -> $(SEC_DYNAMIC) ;
/home -> $(SEC_READONLY) ;
/mnt -> $(SEC_DYNAMIC) ;
/usr -> $(SEC_READONLY) ;
/var -> $(SEC_READONLY) ;
/opt -> $(SEC_READONLY) ;
}
###################################################
@ -167,7 +168,7 @@ Temporary = +pugt ;
rulename = "Misc Top-Level Directories",
)
{
/lost+found -> $(ReadOnly) ;
/lost+found -> $(SEC_READONLY) ;
}
################################################
@ -181,8 +182,8 @@ Temporary = +pugt ;
rulename = "System Devices",
)
{
/dev -> $(Device) ;
/devices -> $(Device) ;
/dev -> $(SEC_DEVICE) ;
/devices -> $(SEC_DEVICE) ;
}
################################################
@ -196,12 +197,12 @@ Temporary = +pugt ;
rulename = "OS Binaries and Libraries",
)
{
/sbin -> $(ReadOnly) ;
/usr/bin -> $(ReadOnly) ;
/usr/lib -> $(ReadOnly) ;
/usr/sbin -> $(ReadOnly) ;
/usr/openwin/bin -> $(ReadOnly) ;
/usr/openwin/lib -> $(ReadOnly) ;
/sbin -> $(SEC_READONLY) ;
/usr/bin -> $(SEC_READONLY) ;
/usr/lib -> $(SEC_READONLY) ;
/usr/sbin -> $(SEC_READONLY) ;
/usr/openwin/bin -> $(SEC_READONLY) ;
/usr/openwin/lib -> $(SEC_READONLY) ;
}
################################################
@ -216,9 +217,9 @@ Temporary = +pugt ;
)
{
! /.netscape/cache ;
/.bash_history -> $(ReadOnly) -smbCM;
/.sh_history -> $(Dynamic) ;
/.Xauthority -> $(ReadOnly) ;
/.bash_history -> $(SEC_READONLY) -smbCM;
/.sh_history -> $(SEC_DYNAMIC) ;
/.Xauthority -> $(SEC_READONLY) ;
}
################################################
@ -232,8 +233,8 @@ Temporary = +pugt ;
rulename = "Temporary Directories",
)
{
/tmp -> $(Temporary) ;
/var/tmp -> $(Temporary) ;
/tmp -> $(SEC_TEMPORARY) ;
/var/tmp -> $(SEC_TEMPORARY) ;
}
################################################
@ -295,17 +296,17 @@ Temporary = +pugt ;
rulename = "System and Boot Changes",
)
{
/etc/.pwd.lock -> $(ReadOnly) -cm;
/etc/coreadm.conf -> $(ReadOnly) -cm;
/var/adm -> $(Growing) -i;
#/var/backups -> $(Dynamic) -i ;
/var/cron/log -> $(Growing) -i ;
#/var/db/host.random -> $(ReadOnly) -mCM ;
#/var/db/locate.database -> $(ReadOnly) -misCM ;
/var/log -> $(Growing) -i ;
#/var/run -> $(Dynamic) -i ;
#/var/mail -> $(Growing) ;
#/var/msgs/bounds -> $(ReadOnly) -smbCM ;
/etc/.pwd.lock -> $(SEC_READONLY) -cm;
/etc/coreadm.conf -> $(SEC_READONLY) -cm;
/var/adm -> $(SEC_GROWING) -i;
#/var/backups -> $(SEC_DYNAMIC) -i ;
/var/cron/log -> $(SEC_GROWING) -i ;
#/var/db/host.random -> $(SEC_READONLY) -mCM ;
#/var/db/locate.database -> $(SEC_READONLY) -misCM ;
/var/log -> $(SEC_GROWING) -i ;
#/var/run -> $(SEC_DYNAMIC) -i ;
#/var/mail -> $(SEC_GROWING) ;
#/var/msgs/bounds -> $(SEC_READONLY) -smbCM ;
!/var/sendmail ;
!/var/spool/clientmqueue ;
!/var/spool/mqueue ;

184
policy/twpol-Syllable.txt Normal file
View File

@ -0,0 +1,184 @@
###############################################################################
# ##
# Default Tripwire 2.4 Policy file for Syllable ##
# ##
###############################################################################
###############################################################################
# ##
# Global Variable Definitions ##
# ##
# These are defined at install time by the installation script. You may ##
# Manually edit these if you are using this file directly and not from the ##
# installation script itself. ##
# ##
###############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
#########################################
# ##
# Tripwire Binaries and Data Files ##
# ##
#########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
##############################################################################
### System dir ###############################################################
#
(rulename = "System Directory",)
{
/boot/system -> $(SEC_READONLY) -a;
}
### Other bin dirs ############################################################
#
(rulename = "Binary Directories",)
{
/boot/bin -> $(SEC_READONLY) -a;
/usr/bin -> $(SEC_READONLY) -a;
/usr/local/bin -> $(SEC_READONLY) -a;
/boot/Applications -> $(SEC_READONLY) -a;
/resources/index/bin -> $(SEC_READONLY) -a;
}
(rulename = "Admin Binary Directories",)
{
/usr/local/sbin -> $(SEC_READONLY) -a;
/resources/index/sbin -> $(SEC_READONLY) -a;
/usr/local/libexec -> $(SEC_READONLY) -a;
/resources/index/libexec -> $(SEC_READONLY) -a;
}
### Other lib dirs ############################################################
#
(rulename = "Library Directories",)
{
/usr/local/lib -> $(SEC_READONLY) -a;
/resources/index/lib -> $(SEC_READONLY) -a;
}
### Other boot dirs ###########################################################
#
(rulename = "Boot Directories",)
{
/boot/boot/grub -> $(SEC_READONLY) -a;
}
### Settings ##################################################################
#
(rulename = "Settings",)
{
/boot/etc -> $(SEC_READONLY) -a;
/usr/local/etc -> $(SEC_READONLY) -a;
}
# Logs ########################################################################
#
(rulename = "Logs",)
{
/var/log -> $(SEC_GROWING) -a;
}
# Dev #########################################################################
#
(rulename = "Devices",)
{
/dev -> $(SEC_DEVICE) -a;
}
# Temp dirs #########################
#
(rulename = "Temp Directories",)
{
/boot/tmp -> $(SEC_TEMPORARY) -a;
}

183
policy/twpol-skyos.txt Normal file
View File

@ -0,0 +1,183 @@
###############################################################################
# ##
# Default Tripwire 2.4 Policy file for SkyOS ##
# ##
###############################################################################
###############################################################################
# ##
# Global Variable Definitions ##
# ##
# These are defined at install time by the installation script. You may ##
# Manually edit these if you are using this file directly and not from the ##
# installation script itself. ##
# ##
###############################################################################
@@section GLOBAL
TWROOT=;
TWBIN=;
TWPOL=;
TWDB=;
TWSKEY=;
TWLKEY=;
TWREPORT=;
HOSTNAME=;
##############################################################################
# Predefined Variables #
##############################################################################
#
# Property Masks
#
# - ignore the following properties
# + check the following properties
#
# a access timestamp (mutually exclusive with +CMSH)
# b number of blocks allocated
# c inode creation/modification timestamp
# d ID of device on which inode resides
# g group id of owner
# i inode number
# l growing files (logfiles for example)
# m modification timestamp
# n number of links
# p permission and file mode bits
# r ID of device pointed to by inode (valid only for device objects)
# s file size
# t file type
# u user id of owner
#
# C CRC-32 hash
# H HAVAL hash
# M MD5 hash
# S SHA hash
#
##############################################################################
SEC_DEVICE = +pugsdr-intlbamcCMSH ;
SEC_DYNAMIC = +pinugtd-srlbamcCMSH ;
SEC_GROWING = +pinugtdl-srbamcCMSH ;
SEC_IGNORE_ALL = -pinugtsdrlbamcCMSH ;
SEC_IGNORE_NONE = +pinugtsdrbamcCMSH-l ;
SEC_READONLY = +pinugtsdbmCM-rlacSH ;
SEC_TEMPORARY = +pugt ;
@@section FS
#########################################
# ##
# Tripwire Binaries and Data Files ##
# ##
#########################################
# Tripwire Binaries
(
rulename = "Tripwire Binaries",
)
{
$(TWBIN)/siggen -> $(SEC_READONLY) ;
$(TWBIN)/tripwire -> $(SEC_READONLY) ;
$(TWBIN)/twadmin -> $(SEC_READONLY) ;
$(TWBIN)/twprint -> $(SEC_READONLY) ;
}
# Tripwire Data Files - Configuration Files, Policy Files, Keys, Reports, Databases
(
rulename = "Tripwire Data Files",
)
{
# NOTE: We remove the inode attribute because when Tripwire creates a backup,
# it does so by renaming the old file and creating a new one (which will
# have a new inode number). Inode is left turned on for keys, which shouldn't
# ever change.
# NOTE: The first integrity check triggers this rule and each integrity check
# afterward triggers this rule until a database update is run, since the
# database file does not exist before that point.
$(TWDB) -> $(SEC_DYNAMIC) -i ;
$(TWPOL)/tw.pol -> $(SEC_READONLY) -i ;
$(TWPOL)/tw.cfg -> $(SEC_READONLY) -i ;
$(TWLKEY)/$(HOSTNAME)-local.key -> $(SEC_READONLY) ;
$(TWSKEY)/site.key -> $(SEC_READONLY) ;
# don't scan the individual reports
$(TWREPORT) -> $(SEC_DYNAMIC) (recurse=0) ;
}
##############################################################################
### System dir ###############################################################
#
(rulename = "System Directory",)
{
/boot/system -> $(SEC_READONLY) -a;
/boot/system/registry.rsm -> $(SEC_READONLY) -am;
}
(rulename = "System Files",)
{
/boot/kernel.sys -> $(SEC_READONLY) -a;
/boot/kernel.dbg -> $(SEC_READONLY) -a;
/boot/init.scr -> $(SEC_READONLY) -a;
/boot/install.sif -> $(SEC_READONLY) -a;
}
### Other bin dirs ############################################################
#
(rulename = "Binary Directories",)
{
/boot/programs -> $(SEC_READONLY) -a;
}
### Other lib dirs ############################################################
#
(rulename = "Library Directories",)
{
/usr/lib -> $(SEC_READONLY) -a;
/usr/local/lib -> $(SEC_READONLY) -a;
}
### Other boot dirs ###########################################################
#
(rulename = "Boot Directories",)
{
/boot/boot/grub -> $(SEC_READONLY) -a;
}
### Settings ##################################################################
#
(rulename = "Settings",)
{
/boot/programs/unix/etc -> $(SEC_READONLY) -a;
/usr/local/etc -> $(SEC_READONLY) -a;
}
# Logs ########################################################################
#
(rulename = "Logs",)
{
/var/log -> $(SEC_GROWING) -a;
}
# Dev #########################################################################
#
(rulename = "Devices",)
{
/dev -> $(SEC_DEVICE) -a;
/fifo -> $(SEC_DEVICE) -a;
/pty -> $(SEC_DEVICE) -as;
/systeminterface -> $(SEC_DEVICE) -a;
/umfs -> $(SEC_DEVICE) -a;
}
# Temp dirs #########################
#
(rulename = "Temp Directories",)
{
/boot/temp -> $(SEC_TEMPORARY) -a;
}

View File

@ -1,2 +1 @@
#define BUILD_NUM _T("0")

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -200,7 +200,10 @@ int32 cArchive::GetStorageSize(const TSTRING& str)
int64 cArchive::Copy(cArchive* pFrom, int64 amt)
{
enum { BUF_SIZE = 2048 };
enum
{
BUF_SIZE = 2048
};
int8 buf[BUF_SIZE];
int64 amtLeft = amt;
@ -288,8 +291,7 @@ void cMemMappedArchive::SetNewMap(void* pMap, int64 offset, int64 length) const
// mapped.
///////////////////////////////////////////////////////////////////////////////
cMemoryArchive::cMemoryArchive(int maxSize)
: mMaxAllocatedLen(maxSize)
cMemoryArchive::cMemoryArchive(int maxSize) : mMaxAllocatedLen(maxSize)
{
ASSERT(maxSize > 0);
mpMemory = 0;
@ -321,11 +323,13 @@ void cMemoryArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive)
offset = mLogicalSize + (int)offset;
break;
default:
ThrowAndAssert(eArchiveSeek(TSS_GetString( cCore, core::STR_MEMARCHIVE_FILENAME), TSS_GetString( cCore, core::STR_MEMARCHIVE_ERRSTR)));
ThrowAndAssert(eArchiveSeek(TSS_GetString(cCore, core::STR_MEMARCHIVE_FILENAME),
TSS_GetString(cCore, core::STR_MEMARCHIVE_ERRSTR)));
}
if (offset > mLogicalSize)
ThrowAndAssert(eArchiveSeek(TSS_GetString( cCore, core::STR_MEMARCHIVE_FILENAME), TSS_GetString( cCore, core::STR_MEMARCHIVE_ERRSTR)));
ThrowAndAssert(eArchiveSeek(TSS_GetString(cCore, core::STR_MEMARCHIVE_FILENAME),
TSS_GetString(cCore, core::STR_MEMARCHIVE_ERRSTR)));
mReadHead = static_cast<int>(offset);
}
@ -464,17 +468,11 @@ public:
//-----------------------------------------------------------------------------
// cFixedMemArchive
//-----------------------------------------------------------------------------
cFixedMemArchive::cFixedMemArchive()
: mpMemory (0),
mSize (0),
mReadHead (0)
cFixedMemArchive::cFixedMemArchive() : mpMemory(0), mSize(0), mReadHead(0)
{
}
cFixedMemArchive::cFixedMemArchive( int8* pMem, int32 size )
: mpMemory (0),
mSize (0),
mReadHead (0)
cFixedMemArchive::cFixedMemArchive(int8* pMem, int32 size) : mpMemory(0), mSize(0), mReadHead(0)
{
Attach(pMem, size);
}
@ -503,11 +501,13 @@ void cFixedMemArchive::Seek(int64 offset, SeekFrom from) // throw(eArchive)
offset = mSize + (int)offset;
break;
default:
ThrowAndAssert(eArchiveSeek(TSS_GetString( cCore, core::STR_MEMARCHIVE_FILENAME), TSS_GetString( cCore, core::STR_MEMARCHIVE_ERRSTR)));
ThrowAndAssert(eArchiveSeek(TSS_GetString(cCore, core::STR_MEMARCHIVE_FILENAME),
TSS_GetString(cCore, core::STR_MEMARCHIVE_ERRSTR)));
}
if (offset > mSize)
ThrowAndAssert(eArchiveSeek(TSS_GetString( cCore, core::STR_MEMARCHIVE_FILENAME), TSS_GetString( cCore, core::STR_MEMARCHIVE_ERRSTR)));
ThrowAndAssert(eArchiveSeek(TSS_GetString(cCore, core::STR_MEMARCHIVE_FILENAME),
TSS_GetString(cCore, core::STR_MEMARCHIVE_ERRSTR)));
mReadHead = static_cast<int32>(offset);
}
@ -566,11 +566,9 @@ int cFixedMemArchive::Write(const void* pDest, int count) // throw(eArchive)
///////////////////////////////////////////////////////////////////////////////
//Ctor -- Initialize member variables to 0 or NULL equivalents.
cFileArchive::cFileArchive() :
mFileSize(0),
mReadHead(0),
isWritable(false)
{}
cFileArchive::cFileArchive() : mFileSize(0), mReadHead(0), isWritable(false)
{
}
cFileArchive::~cFileArchive()
{
@ -734,13 +732,13 @@ int cFileArchive::Read(void* pDest, int count)
if (pDest != NULL)
{
int nbRead =
static_cast<int>( mCurrentFile.Read( pDest, count ) );
int nbRead = static_cast<int>(mCurrentFile.Read(pDest, count));
// 'count' may not be equal to 'nbRead' if the file is open in
// text mode.
count = nbRead;
if(count < 0) count = 0;
if (count < 0)
count = 0;
}
else
{
@ -765,7 +763,6 @@ int cFileArchive::Read(void* pDest, int count)
{
throw(eArchiveRead(mCurrentFilename, fileError.GetDescription()));
}
}
/////////////////////////////////////////////////////////////////////////
@ -793,7 +790,7 @@ int cFileArchive::Write(const void* pDest, int count) // throw(eArchive)
// increase the size, if needed
if (mReadHead > mFileSize)
{
#if 0 // IS_SUNPRO
#if 0 // IS_SUNPRO \
// These two lines seem to be all there is between code that crashes and code that works for sunpro
cDebug d("cFileArchive::Write()");
d.TraceDebug(_T("file(%s) adjusted mFileSize = %d mReadHead = %d\n"), mCurrentFilename.c_str(), (int)mFileSize, (int)mReadHead);
@ -832,7 +829,6 @@ void cFileArchive::Truncate() // throw(eArchive)
}
/////////////////////////////////////////////////////////////////////////
// OpenReadWrite -- Opens the file to be read or written to
//
@ -842,7 +838,8 @@ void cLockedTemporaryFileArchive::OpenReadWrite( const TCHAR* filename, uint32 o
{
TSTRING strTempFile;
try {
try
{
ASSERT(!mCurrentFile.IsOpen()); // shouldn't be able to create a new file when we're already open
if (mCurrentFile.IsOpen())
@ -891,7 +888,8 @@ void cLockedTemporaryFileArchive::OpenReadWrite( const TCHAR* filename, uint32 o
#endif
} //try
catch (eFile& fileError) {
catch (eFile& fileError)
{
TSTRING errStr = TSS_GetString(cCore, core::STR_BAD_TEMPDIRECTORY);
eArchiveOpen e(strTempFile, errStr);
throw e;
@ -907,4 +905,3 @@ void cLockedTemporaryFileArchive::Close()
// Note: this deletes the file as well
cFileArchive::Close();
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -85,7 +85,9 @@ TSS_EXCEPTION( eArchiveStringTooLong, eArchive );
class cArchive
{
public:
virtual ~cArchive() {}
virtual ~cArchive()
{
}
// convenience methods
//
@ -137,7 +139,8 @@ protected:
class cBidirArchive : public cArchive
{
public:
enum SeekFrom {
enum SeekFrom
{
BEGINNING = 0,
CURRENT = 1,
END = -1
@ -155,7 +158,8 @@ public:
class cMemMappedArchive : public cBidirArchive
{
public:
enum {
enum
{
MAP_TO_EOF = -1
};
@ -202,7 +206,10 @@ public:
void Truncate(); // set the length to the current pos
int8* GetMemory() const { return mpMemory; }
int8* GetMemory() const
{
return mpMemory;
}
protected:
int8* mpMemory;
@ -238,6 +245,7 @@ public:
virtual int64 CurrentPos() const;
virtual int64 Length() const;
virtual bool EndOfFile();
protected:
//-----------------------------------
// cArchive interface
@ -320,9 +328,12 @@ public:
private:
// open for read only makes no sense if we're always creating the file,
// so disallow read only file opens
virtual void OpenRead( const TCHAR*, uint32 openFlags = 0 ) { ASSERT( false ); THROW_INTERNAL("archive.h"); }
virtual void OpenRead(const TCHAR*, uint32 openFlags = 0)
{
ASSERT(false);
THROW_INTERNAL("archive.h");
}
};
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -149,5 +149,3 @@ bool cCharUtil::PopNextChar( TSTRING::const_iterator& cur,
return f;
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -44,8 +44,6 @@
class cCharUtil
{
public:
// finds the next whole character in string identified by ['cur'-'end')
// identifies beginning of char in 'first', then end of character in 'last'
// returns 'are there more characters in string?'
@ -63,4 +61,3 @@ public:
};
#endif //__CHARUTIL_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -38,9 +38,7 @@
///////////////////////////////////////////////////////////////////////////////
// ctor, dotr
///////////////////////////////////////////////////////////////////////////////
cCmdLineParser::cCmdLineParser() :
mArgTable(HASH_VERY_SMALL),
mLastArgInfo(-1, PARAM_NONE)
cCmdLineParser::cCmdLineParser() : mArgTable(HASH_VERY_SMALL), mLastArgInfo(-1, PARAM_NONE)
{
}
@ -51,7 +49,8 @@ cCmdLineParser::~cCmdLineParser()
///////////////////////////////////////////////////////////////////////////////
// AddArg
///////////////////////////////////////////////////////////////////////////////
void cCmdLineParser::AddArg(int argId, const TSTRING& arg, const TSTRING& alias, ParamCount numParams, bool multipleAllowed)
void cCmdLineParser::AddArg(
int argId, const TSTRING& arg, const TSTRING& alias, ParamCount numParams, bool multipleAllowed)
{
if (arg.empty() && alias.empty())
{
@ -110,9 +109,7 @@ void cCmdLineParser::Parse(int argc, const TCHAR *const * argv)
if (!mArgTable.Lookup(TSTRING(&argv[i][1]), argInfo))
{
// unknown switch!
throw eCmdLineInvalidArg(
TSS_GetString( cCore, core::STR_ERR2_BAD_ARG_PARAMS )
+ pCurArg );
throw eCmdLineInvalidArg(TSS_GetString(cCore, core::STR_ERR2_BAD_ARG_PARAMS) + pCurArg);
}
//
// make sure this hasn't been specified yet...
@ -124,9 +121,7 @@ void cCmdLineParser::Parse(int argc, const TCHAR *const * argv)
if (it == mMultipleAllowed.end())
{
// It wasn't in our list of allowed params, so error.
throw eCmdLineMultiArg(
TSS_GetString( cCore, core::STR_ERR2_BAD_ARG_PARAMS )
+ argv[i] );
throw eCmdLineMultiArg(TSS_GetString(cCore, core::STR_ERR2_BAD_ARG_PARAMS) + argv[i]);
}
}
//
@ -149,9 +144,7 @@ void cCmdLineParser::Parse(int argc, const TCHAR *const * argv)
if (argv[j][0] == _T('-'))
{
// >0 parameter passed !
throw eCmdLineBadParam(
TSS_GetString( cCore, core::STR_ERR2_BAD_ARG_PARAMS )
+ pCurArg );
throw eCmdLineBadParam(TSS_GetString(cCore, core::STR_ERR2_BAD_ARG_PARAMS) + pCurArg);
}
}
}
@ -163,9 +156,7 @@ void cCmdLineParser::Parse(int argc, const TCHAR *const * argv)
if ((i >= argc) || (argv[i][0] == _T('-')))
{
// zero parameters passed to something that needed one param
throw eCmdLineBadParam(
TSS_GetString( cCore, core::STR_ERR2_BAD_ARG_PARAMS )
+ pCurArg );
throw eCmdLineBadParam(TSS_GetString(cCore, core::STR_ERR2_BAD_ARG_PARAMS) + pCurArg);
}
curArg.mParams.push_back(TSTRING(argv[i]));
@ -207,7 +198,6 @@ void cCmdLineParser::Parse(int argc, const TCHAR *const * argv)
break;
default:
ASSERT(false);
}
if (!bResult)
{
@ -224,16 +214,12 @@ void cCmdLineParser::Parse(int argc, const TCHAR *const * argv)
{
if (!pCurArg)
{
throw eCmdLineBadSwitchPos(
TSS_GetString( cCore, core::STR_ERR2_BAD_ARG_PARAMS )
+ argv[i] );
throw eCmdLineBadSwitchPos(TSS_GetString(cCore, core::STR_ERR2_BAD_ARG_PARAMS) + argv[i]);
}
else
{
// there was an extra parameter passed somewhere!
throw eCmdLineBadArgParam(
TSS_GetString( cCore, core::STR_ERR2_BAD_ARG_PARAMS )
+ pCurArg );
throw eCmdLineBadArgParam(TSS_GetString(cCore, core::STR_ERR2_BAD_ARG_PARAMS) + pCurArg);
}
}
@ -241,10 +227,7 @@ void cCmdLineParser::Parse(int argc, const TCHAR *const * argv)
curArg.mParams.push_back(TSTRING(argv[i]));
i++;
}
}
}
// it is possible not to process the final command line parameters in the "else" case above
@ -283,14 +266,10 @@ void cCmdLineParser::TestMutEx()
if (!iter2.Done())
{
// we have a mutual exclusion violation!
throw eCmdLineMutEx(
iter1.ActualParam()
+ _T(", ")
+ iter2.ActualParam() );
throw eCmdLineMutEx(iter1.ActualParam() + _T(", ") + iter2.ActualParam());
}
}
}
}
///////////////////////////////////////////////////////////////////////////////
@ -467,6 +446,4 @@ bool cCmdLineIter::SeekToArg(int argId) const
}
return false;
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -52,7 +52,8 @@
TSS_EXCEPTION(eCmdLine, eError)
TSS_EXCEPTION(eCmdLineInvalidArg, eCmdLine) // an arg on the command line is not recognized
TSS_EXCEPTION(eCmdLineBadArgParam, eCmdLine) // wrong number of parameters to an argument
TSS_EXCEPTION( eCmdLineBadParam, eCmdLine ) // wrong number of paramters to the executable (not associated with any arguments)
TSS_EXCEPTION(eCmdLineBadParam,
eCmdLine) // wrong number of paramters to the executable (not associated with any arguments)
TSS_EXCEPTION(eCmdLineBadSwitchPos, eCmdLine) // a '-' arg appeared after the final parameter list
TSS_EXCEPTION(eCmdLineMutEx, eCmdLine) // a mutual exclusion error has occured
TSS_EXCEPTION(eCmdLineDependency, eCmdLine) // a dependency error has occurred.
@ -102,7 +103,8 @@ public:
PARAM_INVALID // top of enum
};
void AddArg(int argId, const TSTRING& arg, const TSTRING& alias, ParamCount numParams, bool multipleAllowed = false);
void
AddArg(int argId, const TSTRING& arg, const TSTRING& alias, ParamCount numParams, bool multipleAllowed = false);
// this method should be called for each argument that can appear on the
// command line.
// argId -- a number that uniquely identifies the argument; no two arguments
@ -158,7 +160,9 @@ private:
int mId;
ParamCount mNumParams;
cArgInfo(int i = -1, ParamCount p = PARAM_INVALID) : mId(i), mNumParams(p) {}
cArgInfo(int i = -1, ParamCount p = PARAM_INVALID) : mId(i), mNumParams(p)
{
}
};
// for storing parsed argv information
struct cArgData
@ -167,11 +171,14 @@ private:
std::vector<TSTRING> mParams;
TSTRING mActualParam; // a string representation of what was actually on the command line
cArgData(int id = -1, const TSTRING& actualParam = TSTRING(_T(""))) : mId(id), mActualParam(actualParam) {}
cArgData(int id = -1, const TSTRING& actualParam = TSTRING(_T(""))) : mId(id), mActualParam(actualParam)
{
}
};
cHashTable<TSTRING, cArgInfo> mArgTable;
cArgInfo mLastArgInfo; // info on the argument that comes at the end of the command line (with no associated '-x' or '--x')
cArgInfo
mLastArgInfo; // info on the argument that comes at the end of the command line (with no associated '-x' or '--x')
std::list<cArgData> mArgData;
std::list<std::pair<int, int> > mMutExList; // all of the mutual exclusions
std::list<std::pair<std::pair<int, int>, bool> > mDependencyList; // all of the dependencies
@ -218,8 +225,7 @@ private:
//#############################################################################
// inline implementation
//#############################################################################
inline cCmdLineIter::cCmdLineIter(const cCmdLineParser& parser) :
mList(parser.mArgData)
inline cCmdLineIter::cCmdLineIter(const cCmdLineParser& parser) : mList(parser.mArgData)
{
SeekBegin();
}
@ -264,4 +270,3 @@ inline const TSTRING& cCmdLineIter::ParamAt(int index) const
#endif

View File

@ -1,6 +1,6 @@
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -205,7 +205,8 @@ namespace /*Unique*/
d.TraceDebug("ENOMEM: Insufficient storage space is available.\n");
break;
case EINVAL:
d.TraceDebug( "EINVAL: The conversion specified by fromcode and tocode is not supported by the implementation.\n" );
d.TraceDebug("EINVAL: The conversion specified by fromcode and tocode is not supported by the "
"implementation.\n");
break;
default:
d.TraceDebug("UNKNOWN: Unknown error.\n");
@ -221,48 +222,34 @@ namespace /*Unique*/
// [EINVAL] Input conversion stopped due to an incomplete character
// [EBADF] The cd argument is not a valid open conversion descriptor.
// errno
d.TraceDebug(
_T( "iconv failed with: %s\n" ),
iFSServices::GetInstance()->GetErrString().c_str() );
d.TraceDebug(_T( "iconv failed with: %s\n" ), iFSServices::GetInstance()->GetErrString().c_str());
/// RAD: Always throw on error (Let user Catch if they want to go on)
switch (errno)
{
case EILSEQ:
case EINVAL:
throw
eConverterFatal (
TSS_GetString( cCore, core::STR_ERR_BADCHAR ) );
throw eConverterFatal(TSS_GetString(cCore, core::STR_ERR_BADCHAR));
break;
case E2BIG:
throw
eConverterFatal(
TSS_GetString(cCore, core::STR_ERR_OVERFLOW ) );
throw eConverterFatal(TSS_GetString(cCore, core::STR_ERR_OVERFLOW));
break;
case EBADF:
throw
eConverterUnknownCodepage(
TSS_GetString( cCore, core::STR_UNKNOWN ) );
throw eConverterUnknownCodepage(TSS_GetString(cCore, core::STR_UNKNOWN));
break;
default:
throw
eConverterFatal(
TSS_GetString( cCore, core::STR_UNKNOWN ) );
throw eConverterFatal(TSS_GetString(cCore, core::STR_UNKNOWN));
}
return -1;
}
template< class BufferT, class SourceT >
class ByteConvert
template<class BufferT, class SourceT> class ByteConvert
{
public:
bool
Convert( BufferT** ppBuf, size_t* pnBufferLeft,
const SourceT** ppSrc, size_t* pnSourceLeft )
bool Convert(BufferT** ppBuf, size_t* pnBufferLeft, const SourceT** ppSrc, size_t* pnSourceLeft)
{
cDebug d("ByteConvert::Convert< BufferT, SourceT >()");
@ -285,21 +272,21 @@ namespace /*Unique*/
class UTF8_Util
{
public:
enum { INVALID_VALUE = 0xFF };
enum
{
INVALID_VALUE = 0xFF
};
};
// convert to INVALID_VALUE and remember the byte value
template< class BufferT, class SourceT >
class ToUTF8Convert
template<class BufferT, class SourceT> class ToUTF8Convert
{
public:
ToUTF8Convert(std::list<byte>& lb) : m_lb(lb)
{
}
ToUTF8Convert( std::list<byte>& lb )
: m_lb( lb ) {}
bool
Convert( mbchar_t** ppBuf, size_t* pnBufferLeft,
const dbchar_t** ppSrc, size_t* pnSourceLeft )
bool Convert(mbchar_t** ppBuf, size_t* pnBufferLeft, const dbchar_t** ppSrc, size_t* pnSourceLeft)
{
cDebug d("ToUTF8Convert::Convert< mbchar_t, dbchar_t >()");
@ -320,9 +307,7 @@ namespace /*Unique*/
return true;
}
bool
Convert( mbchar_t** ppBuf, size_t* pnBufferLeft,
const mbchar_t** ppSrc, size_t* pnSourceLeft )
bool Convert(mbchar_t** ppBuf, size_t* pnBufferLeft, const mbchar_t** ppSrc, size_t* pnSourceLeft)
{
cDebug d("ToUTF8Convert::Convert< char, char >()");
@ -344,23 +329,19 @@ namespace /*Unique*/
}
private:
// TODO:Get rid of this guy and just use a vector<BufferT*,BufferT> and
// insert them when finished with second step
std::list<byte>& m_lb;
};
template< class BufferT, class SourceT >
class FromUTF8Convert
template<class BufferT, class SourceT> class FromUTF8Convert
{
public:
FromUTF8Convert(std::list<byte>& lb) : m_lb(lb)
{
}
FromUTF8Convert( std::list<byte>& lb )
: m_lb( lb ) {}
bool
Convert( dbchar_t** ppBuf, size_t* pnBufferLeft,
const mbchar_t** ppSrc, size_t* pnSourceLeft )
bool Convert(dbchar_t** ppBuf, size_t* pnBufferLeft, const mbchar_t** ppSrc, size_t* pnSourceLeft)
{
cDebug d("FromUTF8Convert::Convert< dbchar_t, mbchar_t >()");
@ -395,9 +376,7 @@ namespace /*Unique*/
// Converts a UTF-8 value to corresponding UCS2 char (in the private
// use range) whose value is 0xE000 < x < 0xE0FF in UCS2.
// Must be of the form 11101110 100000xx 10xxxxxx
bool
Convert( mbchar_t** ppBuf, size_t* pnBufferLeft,
const mbchar_t** ppSrc, size_t* pnSourceLeft )
bool Convert(mbchar_t** ppBuf, size_t* pnBufferLeft, const mbchar_t** ppSrc, size_t* pnSourceLeft)
{
cDebug d("FromUTF8Convert::Convert< mbchar_t, mbchar_t >()");
/*
@ -486,16 +465,12 @@ namespace /*Unique*/
}
private:
// TODO:Get rid of this guy and just use a vector<BufferT*,BufferT> and
// insert them when finished with second step
std::list<byte>& m_lb;
};
bool
tss_ReverseConvert( iconv_t revConv,
const char* pConvertedFrom, size_t nFrom,
char* pConvertedTo, size_t nTo )
bool tss_ReverseConvert(iconv_t revConv, const char* pConvertedFrom, size_t nFrom, char* pConvertedTo, size_t nTo)
{
cDebug d("tss_ReverseConvert< B, S, C >()");
d.TraceDebug("Converted from: %s\n", util_output_bytes((void*)pConvertedFrom, nFrom).c_str());
@ -538,26 +513,27 @@ namespace /*Unique*/
return true;
}
template< class CharT >
bool tss_IsFlaggedCharacter( CharT ch )
template<class CharT> bool tss_IsFlaggedCharacter(CharT ch)
{
return false;
}
template<>
bool tss_IsFlaggedCharacter< dbchar_t >( dbchar_t wch )
template<> bool tss_IsFlaggedCharacter<dbchar_t>(dbchar_t wch)
{
return cConvertUtil::ValueInReservedRange(wch);
}
template<class BufferT, class SourceT>
int
tss_ConvertOneCharacter( iconv_t convForward,
int tss_ConvertOneCharacter(iconv_t convForward,
iconv_t convReverse,
const char** ppSource, size_t* pnSourceLeft,
char** ppBuffer, size_t* pnBufferLeft
const char** ppSource,
size_t* pnSourceLeft,
char** ppBuffer,
size_t* pnBufferLeft
# if (!SUPPORTS_EXPLICIT_TEMPLATE_FUNC_INST)
, BufferT /*dummy*/, SourceT /*dummy*/
,
BufferT /*dummy*/,
SourceT /*dummy*/
# endif
)
{
@ -576,9 +552,7 @@ namespace /*Unique*/
//-- Try to find the number of items needed to get a complete character
size_t nSrcTry;
for( nSrcTry = sizeof( SourceT );
nSrcTry <= *pnBufferLeft && nSrcTry <= MB_LEN_MAX;
nSrcTry += sizeof( SourceT ) )
for (nSrcTry = sizeof(SourceT); nSrcTry <= *pnBufferLeft && nSrcTry <= MB_LEN_MAX; nSrcTry += sizeof(SourceT))
{
size_t nSrcLeft = nSrcTry;
size_t nBufLeft = *pnBufferLeft; // Try to find a character in 'n' items
@ -608,12 +582,7 @@ namespace /*Unique*/
}
else
{
if( tss_ReverseConvert(
convReverse,
*ppSource,
pSrc - *ppSource,
*ppBuffer,
pBuf - *ppBuffer ) )
if (tss_ReverseConvert(convReverse, *ppSource, pSrc - *ppSource, *ppBuffer, pBuf - *ppBuffer))
{
// Modify source items to return
@ -648,11 +617,12 @@ namespace /*Unique*/
// NOTE: pBuffer should really have (nBufferItems+1) buffer items, because some
// platforms use the last character to NULL terminate.
template<class BufferT, class SourceT, class ConvT>
int
tss_Converter( iconv_t convForward,
int tss_Converter(iconv_t convForward,
iconv_t convReverse,
BufferT* pBuffer, size_t nBufferItems,
const SourceT* pSource, size_t nSourceItems,
BufferT* pBuffer,
size_t nBufferItems,
const SourceT* pSource,
size_t nSourceItems,
ConvT& ConvertByte)
{
cDebug d("tss_Converter< BufferT, SourceT >()");
@ -685,7 +655,8 @@ namespace /*Unique*/
size_t nbIconvSrc = (size_t)nSourceLeft;
size_t nbIconvDest = (size_t)nBufferLeft;
size_t nConv = iconv( convForward, (ICONV_SOURCE_TYPE**)&pIconvSrc, &nbIconvSrc, (char**)&pIconvDest, &nbIconvDest );
size_t nConv =
iconv(convForward, (ICONV_SOURCE_TYPE**)&pIconvSrc, &nbIconvSrc, (char**)&pIconvDest, &nbIconvDest);
if (nConv == -1)
{
@ -704,7 +675,9 @@ namespace /*Unique*/
(char**)&pBuf,
&nBufferLeft
# if (!SUPPORTS_EXPLICIT_TEMPLATE_FUNC_INST)
, BufferT(), SourceT()
,
BufferT(),
SourceT()
# endif
);
}
@ -738,11 +711,12 @@ namespace /*Unique*/
}
}
d.TraceDebug( "buffer out: %s\n", util_output_bytes( (void*)pBuffer, nBufferItems * sizeof(BufferT) - nBufferLeft ).c_str() );
d.TraceDebug("buffer out: %s\n",
util_output_bytes((void*)pBuffer, nBufferItems * sizeof(BufferT) - nBufferLeft).c_str());
return nBufferItems - (nBufferLeft / sizeof(BufferT));
}
}//Unique
} // namespace
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// cIconvConverter
@ -795,10 +769,7 @@ void cIconvConverter::Init()
icFromDb = cIconvUtil::OpenHandle(cIconvUtil::GetCodePageID(), cIconvUtil::GetIconvDbIdentifier());
}
int
cIconvConverter::Convert(
ntmbs_t pbz, size_t nBytes,
const_ntdbs_t pwz, size_t nChars )
int cIconvConverter::Convert(ntmbs_t pbz, size_t nBytes, const_ntdbs_t pwz, size_t nChars)
{
cDebug d("cIconvConverter::Convert( ntdbs_t -> ntmbs_t )");
@ -823,10 +794,7 @@ cIconvConverter::Convert(
return nConverted;
}
int
cIconvConverter::Convert(
ntdbs_t pwz, size_t nch,
const_ntmbs_t pbz, size_t nBytes )
int cIconvConverter::Convert(ntdbs_t pwz, size_t nch, const_ntmbs_t pbz, size_t nBytes)
{
cDebug d("cIconvConverter::Convert( ntmbs to ntdbs )");
@ -851,13 +819,6 @@ cIconvConverter::Convert(
}
/*
@ -996,10 +957,7 @@ void cDoubleIconvConverter::Init()
icUTF8ToMb = cIconvUtil::OpenHandle(cIconvUtil::GetCodePageID(), cIconvUtil::GetMiddleIdentifier());
}
int
cDoubleIconvConverter::Convert(
ntmbs_t pbz, size_t nBytes,
const_ntdbs_t pwz, size_t nChars )
int cDoubleIconvConverter::Convert(ntmbs_t pbz, size_t nBytes, const_ntdbs_t pwz, size_t nChars)
{
cDebug d("cDoubleIconvConverter::Convert( ntdbs_t -> ntmbs_t )");
@ -1057,10 +1015,7 @@ cDoubleIconvConverter::Convert(
return nConverted;
}
int
cDoubleIconvConverter::Convert(
ntdbs_t pwz, size_t nch,
const_ntmbs_t pbz, size_t nBytes )
int cDoubleIconvConverter::Convert(ntdbs_t pwz, size_t nch, const_ntmbs_t pbz, size_t nBytes)
{
cDebug d("cDoubleIconvConverter::Convert( ntmbs to ntdbs )");
@ -1172,9 +1127,7 @@ void cIconvUtil::ResetConverter( iconv_t ic )
char* p = 0;
size_t s = 0;
size_t i = iconv( ic,
(ICONV_SOURCE_TYPE**) &p,
&s, &p, &s );
size_t i = iconv(ic, (ICONV_SOURCE_TYPE**)&p, &s, &p, &s);
if (i == (size_t)-1)
{
ASSERT(false);
@ -1215,7 +1168,6 @@ bool cIconvUtil::TestConverter( const char* pTo, const char* pFrom )
#endif //TSS_USE_ICONV_CCONV16
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// cWcharIs32BitUcs2Converterer
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1224,8 +1176,7 @@ namespace /*Unique*/
{
//-- Ensures 1-to-1 mb to wide character mapping by doing a reverse conversion
// and comparing the results
int
tss_mbtowc( wchar_t* pwch, const mbchar_t* pch, size_t nBytes )
int tss_mbtowc(wchar_t* pwch, const mbchar_t* pch, size_t nBytes)
{
// convert forward
int nNarrow = ::mbtowc(pwch, pch, nBytes);
@ -1239,8 +1190,7 @@ namespace /*Unique*/
return -1;
// compare...
if( ( nNarrow > (int)nBytes ) ||
( 0 != memcmp( ach, pch, nNarrow ) ) )
if ((nNarrow > (int)nBytes) || (0 != memcmp(ach, pch, nNarrow)))
return -1;
// success!
@ -1249,8 +1199,7 @@ namespace /*Unique*/
//-- Ensures 1-to-1 mb to wide character mapping by doing a reverse conversion
// and comparing the results
int
tss_wctomb( mbchar_t* pch, wchar_t wch )
int tss_wctomb(mbchar_t* pch, wchar_t wch)
{
// convert forward
int nWide = ::wctomb(pch, wch);
@ -1271,8 +1220,7 @@ namespace /*Unique*/
return nWide;
}
int
tss_wcstombs( ntmbs_t pbz, const_ntwcs_t pwz, size_t nCount )
int tss_wcstombs(ntmbs_t pbz, const_ntwcs_t pwz, size_t nCount)
{
cDebug d("tss_wcstombs");
@ -1292,8 +1240,7 @@ namespace /*Unique*/
}
int
tss_mbstowcs( ntwcs_t pwz, const_ntmbs_t pbz, size_t nBytes )
int tss_mbstowcs(ntwcs_t pwz, const_ntmbs_t pbz, size_t nBytes)
{
cDebug d("tss_mbstowcs");
@ -1305,9 +1252,7 @@ namespace /*Unique*/
N = tss_mbtowc(pwz, pbz, end - pbz);
if (N == (size_t)-1)
{
d.TraceDebug(
"manually converting %X...\n",
cConvertUtil::ConvertNonChar( *pbz ) );
d.TraceDebug("manually converting %X...\n", cConvertUtil::ConvertNonChar(*pbz));
*pwz = (wchar_t)cConvertUtil::ConvertNonChar(*pbz);
N = 1;
@ -1316,14 +1261,11 @@ namespace /*Unique*/
return (int)nConv;
}
}//Unique
} // namespace
#if WCHAR_IS_32_BITS
int
cWcharIs32BitUcs2Converterer::Convert(
ntmbs_t pbz, size_t nBytes,
const_ntdbs_t pwz, size_t nCount )
int cWcharIs32BitUcs2Converterer::Convert(ntmbs_t pbz, size_t nBytes, const_ntdbs_t pwz, size_t nCount)
{
if (pbz == 0 || (pwz == 0 && nCount))
throw eConverterFatal(TSS_GetString(cCore, core::STR_ERR_ISNULL));
@ -1354,10 +1296,7 @@ cWcharIs32BitUcs2Converterer::Convert(
return nConv;
}
int
cWcharIs32BitUcs2Converterer::Convert(
ntdbs_t pwz, size_t nCount,
const_ntmbs_t pbz, size_t nBytes )
int cWcharIs32BitUcs2Converterer::Convert(ntdbs_t pwz, size_t nCount, const_ntmbs_t pbz, size_t nBytes)
{
cDebug d("cWcharIs32BitUcs2Converterer::Convert( ntmbs to ntdbs )");
@ -1402,10 +1341,7 @@ cWcharIs32BitUcs2Converterer::Convert(
#if WCHAR_IS_16_BITS
int
cWcharIs16BitUcs2Converterer::Convert(
ntmbs_t pbz, size_t nbMB,
const_ntdbs_t pwz, size_t nch )
int cWcharIs16BitUcs2Converterer::Convert(ntmbs_t pbz, size_t nbMB, const_ntdbs_t pwz, size_t nch)
{
// Validate Input
if (pbz == 0 || (pwz == 0 && nch))
@ -1427,10 +1363,7 @@ cWcharIs16BitUcs2Converterer::Convert(
return nConverted;
}
int
cWcharIs16BitUcs2Converterer::Convert(
ntdbs_t pwz, size_t nch,
const_ntmbs_t pbz, size_t nBytes )
int cWcharIs16BitUcs2Converterer::Convert(ntdbs_t pwz, size_t nch, const_ntmbs_t pbz, size_t nBytes)
{
// Validate Input
if (pbz == 0 || (pwz == 0 && nch))
@ -1450,11 +1383,7 @@ cWcharIs16BitUcs2Converterer::Convert(
#endif // WCHAR_IS_16_BITS
int
cGoodEnoughConverterer::Convert(
ntmbs_t pbz, size_t nBytes,
const_ntdbs_t pwz, size_t nCount )
int cGoodEnoughConverterer::Convert(ntmbs_t pbz, size_t nBytes, const_ntdbs_t pwz, size_t nCount)
{
if (pbz == 0 || (pwz == 0 && nCount))
throw eConverterFatal(TSS_GetString(cCore, core::STR_ERR_ISNULL));
@ -1485,10 +1414,7 @@ cGoodEnoughConverterer::Convert(
return ((size_t)at - (size_t)pbz);
}
int
cGoodEnoughConverterer::Convert(
ntdbs_t pwz, size_t nCount,
const_ntmbs_t pbz, size_t nBytes )
int cGoodEnoughConverterer::Convert(ntdbs_t pwz, size_t nCount, const_ntmbs_t pbz, size_t nBytes)
{
// Validate Input
if (pwz == 0 || (pbz == 0 && nBytes))
@ -1531,9 +1457,7 @@ dbchar_t cConvertUtil::ConvertNonChar( mbchar_t ch )
dbchar_t wch = (dbchar_t)(tss::util::char_to_size(ch) + TSS_UCS2_RESERVED_START);
d.TraceDebug( "Converted 0x%08X to 0x%08X\n",
tss::util::char_to_size( ch ),
tss::util::char_to_size( wch ) );
d.TraceDebug("Converted 0x%08X to 0x%08X\n", tss::util::char_to_size(ch), tss::util::char_to_size(wch));
return (wch);
}
@ -1550,9 +1474,7 @@ mbchar_t cConvertUtil::ConvertNonChar( dbchar_t wch )
mbchar_t ch = (mbchar_t)(wch - TSS_UCS2_RESERVED_START);
d.TraceDebug( "Converted 0x%08X to 0x%08X\n",
tss::util::char_to_size( wch ),
tss::util::char_to_size( ch ) );
d.TraceDebug("Converted 0x%08X to 0x%08X\n", tss::util::char_to_size(wch), tss::util::char_to_size(ch));
return (ch);
}
@ -1560,13 +1482,11 @@ mbchar_t cConvertUtil::ConvertNonChar( dbchar_t wch )
bool cConvertUtil::ValueInReservedRange(dbchar_t wch)
{
size_t s = tss::util::char_to_size(wch);
return( ( s >= TSS_UCS2_RESERVED_START ) &&
( s <= TSS_UCS2_RESERVED_END ) );
return ((s >= TSS_UCS2_RESERVED_START) && (s <= TSS_UCS2_RESERVED_END));
}
bool cConvertUtil::ValueInReservedRange(mbchar_t ch)
{
size_t s = tss::util::char_to_size(ch);
return( ( s >= TSS_HIGH_ASCII_START ) &&
( s <= TSS_HIGH_ASCII_END ) );
return ((s >= TSS_HIGH_ASCII_START) && (s <= TSS_HIGH_ASCII_END));
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -91,44 +91,37 @@ TSS_EXCEPTION( eConverterUnknownCodepage, eConverter );
class iCodeConverter
{
public:
static iCodeConverter* GetInstance(); // Singleton
static void Finit();
/// Subclass Responsibilities
virtual
int
Convert(
ntmbs_t, // NTMBS buffer
virtual int Convert(ntmbs_t, // NTMBS buffer
size_t, // Capacity in mbchar_t's (bytes)
const_ntdbs_t, // null terminated two-byte wide character (UCS2 rep)
size_t nCount) = 0; // Amount to convert in dbchar_t's
// returns number of buffer items converted, -1 on error
virtual
int
Convert(
ntdbs_t, // NTDBS (Null-terminated two byte sequence) buf
virtual int Convert(ntdbs_t, // NTDBS (Null-terminated two byte sequence) buf
size_t, // Capacity in dbchar_t's
const_ntmbs_t, // Null-terminated multi-byte sequence
size_t) = 0; // Capacity in mbchar_t's (bytes)
// returns number of buffer items converted, -1 on error
protected:
iCodeConverter() {}
virtual ~iCodeConverter() {}
iCodeConverter()
{
}
virtual ~iCodeConverter()
{
}
private:
static iCodeConverter* CreateConverter();
static iCodeConverter* CreateGoodEnoughConverter();
static iCodeConverter* m_pInst;
};
@ -149,7 +142,6 @@ class iCodeConverter
class cIconvUtil
{
public:
static const char* GetCodePageID(); // gets code page id for current locale, throws if error
static bool GetCodePageID(const char** ppCP);
static const char* GetIconvDbIdentifier();
@ -164,7 +156,6 @@ class cIconvUtil
class cIconvConverter : public iCodeConverter
{
public:
static bool Test(); // is there a conversion for the current codepage?
virtual int Convert(ntmbs_t, size_t, const_ntdbs_t, size_t);
@ -183,7 +174,6 @@ class cIconvConverter : public iCodeConverter
class cDoubleIconvConverter : public iCodeConverter
{
public:
static bool Test(); // is there a conversion for the current codepage?
virtual int Convert(ntmbs_t, size_t, const_ntdbs_t, size_t);
@ -193,7 +183,6 @@ class cDoubleIconvConverter : public iCodeConverter
virtual ~cDoubleIconvConverter();
private:
void Init();
iconv_t icMbToUTF8;
@ -223,7 +212,9 @@ public:
virtual int Convert(ntmbs_t, size_t, const_ntdbs_t, size_t);
virtual int Convert(ntdbs_t, size_t, const_ntmbs_t, size_t);
virtual ~cWcharIs32BitUcs2Converterer() {}
virtual ~cWcharIs32BitUcs2Converterer()
{
}
};
#endif // WCHAR_IS_32_BITS
@ -243,7 +234,9 @@ public:
virtual int Convert(ntmbs_t, size_t, const_ntdbs_t, size_t);
virtual int Convert(ntdbs_t, size_t, const_ntmbs_t, size_t);
virtual ~cWcharIs16BitUcs2Converterer() {}
virtual ~cWcharIs16BitUcs2Converterer()
{
}
};
#endif // WCHAR_IS_16_BITS
@ -256,7 +249,9 @@ public:
virtual int Convert(ntmbs_t, size_t, const_ntdbs_t, size_t);
virtual int Convert(ntdbs_t, size_t, const_ntmbs_t, size_t);
virtual ~cGoodEnoughConverterer() {}
virtual ~cGoodEnoughConverterer()
{
}
};
@ -269,6 +264,7 @@ class cConvertUtil
TSS_HIGH_ASCII_START = 0x0080u,
TSS_HIGH_ASCII_END = 0x00FFu
};
public:
static dbchar_t ConvertNonChar(mbchar_t ch);
static mbchar_t ConvertNonChar(dbchar_t ch);
@ -279,4 +275,3 @@ public:
#endif //__CODECONVERT_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -64,4 +64,3 @@ cCore::~cCore()
{
iCodeConverter::Finit();
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -52,11 +52,9 @@ TSS_BeginPackage( cCore )
TSS_DECLARE_STRINGTABLE;
public:
cCore();
~cCore();
TSS_EndPackage(cCore)
#endif //__CORE_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -110,7 +110,8 @@ TSS_REGISTER_ERROR( eFSServicesGeneric(),_T("File system error.") )
/// Serializer
TSS_REGISTER_ERROR( eSerializerUnknownType(), _T("Unknown type encountered in file.\nFile format may not be valid for this platform.") )
TSS_REGISTER_ERROR(eSerializerUnknownType(),
_T("Unknown type encountered in file.\nFile format may not be valid for this platform."))
TSS_REGISTER_ERROR(eSerializerInputStreamFmt(), _T("Invalid input stream format."))
TSS_REGISTER_ERROR(eSerializerOutputStreamFmt(), _T("Invalid output stream format."))
TSS_REGISTER_ERROR(eSerializerInputStremTypeArray(), _T("A bad index was encountered in file."))
@ -163,4 +164,3 @@ TSS_REGISTER_ERROR( eUnknownEscapeEncoding(), _T("Unknown encoding in display
TSS_END_ERROR_REGISTRATION()

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -45,4 +45,3 @@ TSS_DECLARE_ERROR_REGISTRATION( core )
#endif //__COREERRORS_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -44,14 +44,11 @@ TSS_BeginStringtable( cCore )
TSS_StringEntry(core::STR_ERR2_ARCH_CRYPTO_ERR, _T("File could not be decrypted.")),
TSS_StringEntry(core::STR_ERR2_BAD_ARG_PARAMS, _T("Argument: ")),
TSS_StringEntry(core::STR_ERROR_ERROR, _T("### Error")),
TSS_StringEntry( core::STR_ERROR_WARNING, _T("### Warning") ),
TSS_StringEntry( core::STR_ERROR_COLON, _T(":") ),
TSS_StringEntry( core::STR_ERROR_HEADER, _T("### ") ),
TSS_StringEntry( core::STR_ERROR_EXITING, _T("Exiting...") ),
TSS_StringEntry(core::STR_ERROR_WARNING, _T("### Warning")), TSS_StringEntry(core::STR_ERROR_COLON, _T(":")),
TSS_StringEntry(core::STR_ERROR_HEADER, _T("### ")), TSS_StringEntry(core::STR_ERROR_EXITING, _T("Exiting...")),
TSS_StringEntry(core::STR_ERROR_CONTINUING, _T("Continuing...")),
TSS_StringEntry(core::STR_ERR2_FILENAME, _T("Filename: ")),
TSS_StringEntry( core::STR_ERROR_FILENAME, _T("Filename: ") ),
TSS_StringEntry( core::STR_UNKNOWN, _T("Unknown") ),
TSS_StringEntry(core::STR_ERROR_FILENAME, _T("Filename: ")), TSS_StringEntry(core::STR_UNKNOWN, _T("Unknown")),
TSS_StringEntry(core::STR_NUMBER_TOO_BIG, _T("Number too big")),
TSS_StringEntry(core::STR_SIGNAL, _T("Software interrupt forced exit:")),
TSS_StringEntry(core::STR_NEWLINE, _T("\n")),
@ -59,7 +56,9 @@ TSS_BeginStringtable( cCore )
TSS_StringEntry(core::STR_MEMARCHIVE_ERRSTR, _T("")),
TSS_StringEntry(core::STR_ENDOFTIME, _T("Tripwire is not designed to run past the year 2038.\nNow exiting...")),
TSS_StringEntry(core::STR_UNKNOWN_TIME, _T("Unknown time")),
TSS_StringEntry( core::STR_BAD_TEMPDIRECTORY, _T("Solution: Check existence/permissions for directory specified by TEMPDIRECTORY in config file") ),
TSS_StringEntry(
core::STR_BAD_TEMPDIRECTORY,
_T("Solution: Check existence/permissions for directory specified by TEMPDIRECTORY in config file")),
/// Particularly useful for eCharacter and eCharacterEncoding
TSS_StringEntry(core::STR_ERR_ISNULL, _T("Argument cannot be null.")),
@ -68,6 +67,3 @@ TSS_BeginStringtable( cCore )
TSS_StringEntry(core::STR_ERR_BADCHAR, _T("Input contained an invalid character."))
TSS_EndStringtable(cCore)

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -48,34 +48,16 @@
TSS_BeginStringIds(core)
STR_ERR2_ARCH_CRYPTO_ERR,
STR_ERR2_BAD_ARG_PARAMS,
STR_ERROR_ERROR,
STR_ERROR_WARNING,
STR_ERROR_COLON,
STR_ERROR_HEADER,
STR_ERROR_EXITING,
STR_ERROR_CONTINUING,
STR_ERR2_FILENAME,
STR_ERROR_FILENAME,
STR_NUMBER_TOO_BIG,
STR_UNKNOWN,
STR_SIGNAL,
STR_NEWLINE,
STR_MEMARCHIVE_FILENAME,
STR_MEMARCHIVE_ERRSTR,
STR_ENDOFTIME,
STR_UNKNOWN_TIME,
STR_BAD_TEMPDIRECTORY,
STR_ERR2_BAD_ARG_PARAMS, STR_ERROR_ERROR, STR_ERROR_WARNING, STR_ERROR_COLON, STR_ERROR_HEADER, STR_ERROR_EXITING,
STR_ERROR_CONTINUING, STR_ERR2_FILENAME, STR_ERROR_FILENAME, STR_NUMBER_TOO_BIG, STR_UNKNOWN, STR_SIGNAL,
STR_NEWLINE, STR_MEMARCHIVE_FILENAME, STR_MEMARCHIVE_ERRSTR, STR_ENDOFTIME, STR_UNKNOWN_TIME, STR_BAD_TEMPDIRECTORY,
/// Particularly useful for eCharacterSet and eCharacterEncoding
STR_ERR_ISNULL,
STR_ERR_OVERFLOW,
STR_ERR_UNDERFLOW,
STR_ERR_ISNULL, STR_ERR_OVERFLOW, STR_ERR_UNDERFLOW,
STR_ERR_BADCHAR
TSS_EndStringIds(core)
#endif //__CORESTRINGS_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -86,7 +86,6 @@ void cDebug::Trace(int levelNum, const char* format, ...)
va_start(args, format);
DoTrace(format, args);
va_end(args);
}
@ -231,7 +230,8 @@ bool cDebug::AddOutTarget(OutTarget target)
mOutMask |= OUT_STDOUT;
if (target == OUT_TRACE)
mOutMask |= OUT_TRACE;
if (target == OUT_FILE) {
if (target == OUT_FILE)
{
mOutMask |= OUT_FILE;
return false;
}
@ -286,10 +286,12 @@ bool cDebug::SetOutputFile(const char* filename)
//make sure info. will not be clobbered.
//Should be open now- if not, abort.
if (!logfile) {
if (!logfile)
{
mOutMask ^= OUT_FILE;
return false;
} else
}
else
mOutMask |= OUT_FILE;
return true;
}
@ -318,4 +320,3 @@ void cDebug::DebugOut( const char* lpOutputString, ... )
//////////////////////////////////////////////////////////////////////////////////
// ASSERT macro support function
//////////////////////////////////////////////////////////////////////////////////

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -40,8 +40,6 @@
#include <assert.h>
#include <iostream>
/* Do it in this order, because autoconf checks for <stdarg.h>
* first i.e. if HAVE_VARARGS_H is defined, it is only because
@ -125,7 +123,6 @@ public:
// Outputs based on levelnum. If levelnum <= global debug, print.
public:
static bool AddOutTarget(OutTarget target);
static bool RemoveOutTarget(OutTarget target);
// used to specify the out target....
@ -144,7 +141,10 @@ public:
// than that will have unpredictable and probably bad results
private:
#ifdef DEBUG
enum { MAX_LABEL = 128 };
enum
{
MAX_LABEL = 128
};
static int mDebugLevel;
static uint32 mOutMask;
@ -181,29 +181,69 @@ inline int cDebug::GetDebugLevel()
# else // DEBUG
inline cDebug::cDebug (const char *) {}
inline cDebug::~cDebug () {}
inline cDebug::cDebug (const cDebug&) {}
inline void cDebug::TraceAlways (const char *, ...) {}
inline void cDebug::TraceError (const char *, ...) {}
inline void cDebug::TraceWarning (const char *, ...) {}
inline void cDebug::TraceDebug (const char *, ...) {}
inline void cDebug::TraceDetail (const char *, ...) {}
inline void cDebug::TraceNever (const char *, ...) {}
inline void cDebug::TraceVaArgs (int, const char *, va_list &) {}
inline void cDebug::Trace (int, const char*, ...) {}
inline bool cDebug::AddOutTarget (OutTarget) { return false; }
inline bool cDebug::RemoveOutTarget (OutTarget) { return false; }
inline bool cDebug::HasOutTarget (OutTarget) { return false; }
inline bool cDebug::SetOutputFile (const char*) { return false; }
inline void cDebug::SetDebugLevel (int) {}
inline int cDebug::GetDebugLevel (void) { return 0; }
inline void cDebug::DebugOut ( const char*, ... ) {}
inline cDebug::cDebug(const char*)
{
}
inline cDebug::~cDebug()
{
}
inline cDebug::cDebug(const cDebug&)
{
}
inline void cDebug::TraceAlways(const char*, ...)
{
}
inline void cDebug::TraceError(const char*, ...)
{
}
inline void cDebug::TraceWarning(const char*, ...)
{
}
inline void cDebug::TraceDebug(const char*, ...)
{
}
inline void cDebug::TraceDetail(const char*, ...)
{
}
inline void cDebug::TraceNever(const char*, ...)
{
}
inline void cDebug::TraceVaArgs(int, const char*, va_list&)
{
}
inline void cDebug::Trace(int, const char*, ...)
{
}
inline bool cDebug::AddOutTarget(OutTarget)
{
return false;
}
inline bool cDebug::RemoveOutTarget(OutTarget)
{
return false;
}
inline bool cDebug::HasOutTarget(OutTarget)
{
return false;
}
inline bool cDebug::SetOutputFile(const char*)
{
return false;
}
inline void cDebug::SetDebugLevel(int)
{
}
inline int cDebug::GetDebugLevel(void)
{
return 0;
}
inline void cDebug::DebugOut(const char*, ...)
{
}
# endif // DEBUG
//////////////////////////////////////////////////////////////////////////////////
// ASSERT macro
//////////////////////////////////////////////////////////////////////////////////
@ -226,4 +266,3 @@ inline void cDebug::DebugOut ( const char*, ... ) {}
# endif
#endif //__DEBUG_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -66,8 +66,7 @@
//////////////////////////////////////////////////////////////////////////////
inline bool IsSingleTCHAR( TSTRING::const_iterator first,
TSTRING::const_iterator last )
inline bool IsSingleTCHAR(TSTRING::const_iterator first, TSTRING::const_iterator last)
{
return (first + 1 == last);
}
@ -83,23 +82,19 @@ class iCharEncoder
public:
virtual ~iCharEncoder(){};
virtual bool NeedsEncoding( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const = 0;
virtual bool NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const = 0;
// Determines if character identified by [first,last) needs encoding.
// Returns true if it does.
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first,
TSTRING::const_iterator last ) const = 0;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const = 0;
// Encodes character identified by [first,last) in such a way that it
// can be decoded by Decode(). Returns encoded character sequence.
virtual TSTRING EncodePretty( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const = 0;
virtual TSTRING EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const = 0;
// Encodes character identified by [first,last) in a manner that is not roundtrip,
// but looks good. Returns encoded character sequence.
virtual TSTRING Decode( TSTRING::const_iterator* pcur,
const TSTRING::const_iterator end ) const = 0;
virtual TSTRING Decode(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end) const = 0;
// Decodes character sequence beginning with '*pcur' and ending before 'end'.
// Returns decoded character or sequence of characters. Advances *pcur beyond
// the last character decoded.
@ -107,10 +102,12 @@ class iCharEncoder
virtual TCHAR Identifier() const = 0;
static TCHAR EscapeChar() { return char_escape; }
static TCHAR EscapeChar()
{
return char_escape;
}
protected:
static TCHAR char_escape;
};
@ -118,21 +115,20 @@ class iCharEncoder
class cNonNarrowableCharEncoder : public iCharEncoder
{
public:
virtual ~cNonNarrowableCharEncoder() {}
virtual ~cNonNarrowableCharEncoder()
{
}
virtual bool NeedsEncoding( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual bool NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodePretty( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING Decode( TSTRING::const_iterator* cur,
const TSTRING::const_iterator end ) const;
virtual TSTRING Decode(TSTRING::const_iterator* cur, const TSTRING::const_iterator end) const;
virtual TCHAR Identifier() const;
private:
static TCHAR char_identifier;
static TCHAR char_replace;
@ -142,24 +138,22 @@ class cNonNarrowableCharEncoder : public iCharEncoder
class cNonPrintableCharEncoder : public iCharEncoder
{
public:
cNonPrintableCharEncoder( bool f_allowWS )
: m_allowWS( f_allowWS ) {};
cNonPrintableCharEncoder(bool f_allowWS) : m_allowWS(f_allowWS){};
virtual ~cNonPrintableCharEncoder() {}
virtual ~cNonPrintableCharEncoder()
{
}
virtual bool NeedsEncoding( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual bool NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodePretty( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING Decode( TSTRING::const_iterator* cur,
const TSTRING::const_iterator end ) const;
virtual TSTRING Decode(TSTRING::const_iterator* cur, const TSTRING::const_iterator end) const;
virtual TCHAR Identifier() const;
private:
static TCHAR char_identifier;
static TCHAR char_replace;
@ -170,21 +164,20 @@ class cNonPrintableCharEncoder : public iCharEncoder
class cQuoteCharEncoder : public iCharEncoder
{
public:
virtual ~cQuoteCharEncoder() {}
virtual ~cQuoteCharEncoder()
{
}
virtual bool NeedsEncoding( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual bool NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodePretty( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING Decode( TSTRING::const_iterator* cur,
const TSTRING::const_iterator end ) const;
virtual TSTRING Decode(TSTRING::const_iterator* cur, const TSTRING::const_iterator end) const;
virtual TCHAR Identifier() const;
private:
static TCHAR char_test;
static TCHAR char_identifier;
@ -195,21 +188,20 @@ class cQuoteCharEncoder : public iCharEncoder
class cBackslashCharEncoder : public iCharEncoder
{
public:
virtual ~cBackslashCharEncoder() {}
virtual ~cBackslashCharEncoder()
{
}
virtual bool NeedsEncoding( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual bool NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING EncodePretty( TSTRING::const_iterator first,
TSTRING::const_iterator last ) const;
virtual TSTRING EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const;
virtual TSTRING Decode( TSTRING::const_iterator* cur,
const TSTRING::const_iterator end ) const;
virtual TSTRING Decode(TSTRING::const_iterator* cur, const TSTRING::const_iterator end) const;
virtual TCHAR Identifier() const;
private:
static TCHAR char_test;
static TCHAR char_identifier;
@ -241,18 +233,13 @@ TCHAR cNonPrintableCharEncoder::char_replace = _T('?');
// TESTS
//////////////////////////////////////////////////////////////////////////////
bool cNonNarrowableCharEncoder::NeedsEncoding(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
bool cNonNarrowableCharEncoder::NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
return false; // all chars are narrow
}
bool cNonPrintableCharEncoder::NeedsEncoding(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
bool cNonPrintableCharEncoder::NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
// TODO:BAM -- handle this with mb chars
// std::isprint<wchar_t> does a wctob() on the wchar!!?!?!
@ -284,26 +271,14 @@ bool cNonPrintableCharEncoder::NeedsEncoding(
return cCharEncoderUtil::IsPrintable(*first);
}
bool cQuoteCharEncoder::NeedsEncoding(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
bool cQuoteCharEncoder::NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
return(
IsSingleTCHAR( first, last )
&&
( *first == char_test )
);
return (IsSingleTCHAR(first, last) && (*first == char_test));
}
bool cBackslashCharEncoder::NeedsEncoding(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
bool cBackslashCharEncoder::NeedsEncoding(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
return(
IsSingleTCHAR( first, last )
&&
( *first == char_test )
);
return (IsSingleTCHAR(first, last) && (*first == char_test));
}
//////////////////////////////////////////////////////////////////////////////
@ -311,9 +286,7 @@ bool cBackslashCharEncoder::NeedsEncoding(
//////////////////////////////////////////////////////////////////////////////
TSTRING cNonNarrowableCharEncoder::EncodeRoundtrip(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cNonNarrowableCharEncoder::EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
TSTRING str;
@ -325,9 +298,7 @@ TSTRING cNonNarrowableCharEncoder::EncodeRoundtrip(
}
TSTRING cNonPrintableCharEncoder::EncodeRoundtrip(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cNonPrintableCharEncoder::EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
ASSERT(IsSingleTCHAR(first, last)); // non-prints are single char (see NOTE above)
@ -341,9 +312,7 @@ TSTRING cNonPrintableCharEncoder::EncodeRoundtrip(
}
TSTRING cQuoteCharEncoder::EncodeRoundtrip(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cQuoteCharEncoder::EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
// should just be a quote
ASSERT(IsSingleTCHAR(first, last));
@ -358,10 +327,7 @@ TSTRING cQuoteCharEncoder::EncodeRoundtrip(
}
TSTRING cBackslashCharEncoder::EncodeRoundtrip(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cBackslashCharEncoder::EncodeRoundtrip(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
// should just be a backslash
ASSERT(IsSingleTCHAR(first, last));
@ -380,25 +346,19 @@ TSTRING cBackslashCharEncoder::EncodeRoundtrip(
//////////////////////////////////////////////////////////////////////////////
TSTRING cNonNarrowableCharEncoder::EncodePretty(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cNonNarrowableCharEncoder::EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
return EncodeRoundtrip(first, last);
}
TSTRING cNonPrintableCharEncoder::EncodePretty(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cNonPrintableCharEncoder::EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
return EncodeRoundtrip(first, last);
}
TSTRING cQuoteCharEncoder::EncodePretty(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cQuoteCharEncoder::EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
// should just be a quote
ASSERT(IsSingleTCHAR(first, last));
@ -408,9 +368,7 @@ TSTRING cQuoteCharEncoder::EncodePretty(
}
TSTRING cBackslashCharEncoder::EncodePretty(
TSTRING::const_iterator first,
TSTRING::const_iterator last ) const
TSTRING cBackslashCharEncoder::EncodePretty(TSTRING::const_iterator first, TSTRING::const_iterator last) const
{
// should just be a backslash
ASSERT(IsSingleTCHAR(first, last));
@ -424,8 +382,7 @@ TSTRING cBackslashCharEncoder::EncodePretty(
//////////////////////////////////////////////////////////////////////////////
TSTRING cNonNarrowableCharEncoder::Decode( TSTRING::const_iterator* pcur,
const TSTRING::const_iterator end ) const
TSTRING cNonNarrowableCharEncoder::Decode(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end) const
{
// check preconditions
if ((*pcur) >= end || *(*pcur) != Identifier())
@ -435,8 +392,7 @@ TSTRING cNonNarrowableCharEncoder::Decode( TSTRING::const_iterator* pcur,
}
TSTRING cNonPrintableCharEncoder::Decode( TSTRING::const_iterator* pcur,
const TSTRING::const_iterator end ) const
TSTRING cNonPrintableCharEncoder::Decode(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end) const
{
// check preconditions
if ((*pcur) >= end || *(*pcur) != Identifier())
@ -446,8 +402,7 @@ TSTRING cNonPrintableCharEncoder::Decode( TSTRING::const_iterator* pcur,
}
TSTRING cQuoteCharEncoder::Decode( TSTRING::const_iterator* pcur,
const TSTRING::const_iterator end ) const
TSTRING cQuoteCharEncoder::Decode(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end) const
{
if ((*pcur) >= end || *(*pcur) != Identifier())
ThrowAndAssert(eBadDecoderInput());
@ -458,8 +413,7 @@ TSTRING cQuoteCharEncoder::Decode( TSTRING::const_iterator* pcur,
}
TSTRING cBackslashCharEncoder::Decode( TSTRING::const_iterator* pcur,
const TSTRING::const_iterator end ) const
TSTRING cBackslashCharEncoder::Decode(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end) const
{
if ((*pcur) >= end || *(*pcur) != Identifier())
ThrowAndAssert(eBadDecoderInput());
@ -502,11 +456,7 @@ TCHAR cBackslashCharEncoder::Identifier() const
bool cCharEncoderUtil::IsWhiteSpace(TCHAR ch)
{
return ( ch == '\r' ||
ch == '\n' ||
ch == '\t' ||
ch == '\v' ||
ch == ' ' );
return (ch == '\r' || ch == '\n' || ch == '\t' || ch == '\v' || ch == ' ');
}
bool cCharEncoderUtil::IsPrintable(TCHAR ch)
@ -549,8 +499,7 @@ TSTRING cCharEncoderUtil::HexValueToCharString( const TSTRING& str )
return strOut;
}
TCHAR cCharEncoderUtil::hex_to_char( TSTRING::const_iterator first,
TSTRING::const_iterator last )
TCHAR cCharEncoderUtil::hex_to_char(TSTRING::const_iterator first, TSTRING::const_iterator last)
{
static const TCHAR max_char = std::numeric_limits<TCHAR>::max();
static const TCHAR min_char = std::numeric_limits<TCHAR>::min();
@ -586,22 +535,17 @@ TSTRING cCharEncoderUtil::char_to_hex( TCHAR ch )
ss << tss::util::char_to_size(ch);
if( ss.bad() || ss.fail() ||
ss.str().length() != TCHAR_AS_HEX__IN_TCHARS )
if (ss.bad() || ss.fail() || ss.str().length() != TCHAR_AS_HEX__IN_TCHARS)
ThrowAndAssert(eBadHexConversion(TSTRING(1, ch)));
return ss.str();
}
TSTRING cCharEncoderUtil::DecodeHexToChar( TSTRING::const_iterator* pcur,
const TSTRING::const_iterator end )
TSTRING cCharEncoderUtil::DecodeHexToChar(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end)
{
// get hex numbers -- 2 chars
TSTRING str;
size_t n = 0;
for( (*pcur)++;
n < TCHAR_AS_HEX__IN_TCHARS &&
(*pcur) != end;
n++, (*pcur)++ )
for ((*pcur)++; n < TCHAR_AS_HEX__IN_TCHARS && (*pcur) != end; n++, (*pcur)++)
{
str += *(*pcur);
}
@ -618,8 +562,7 @@ TSTRING cCharEncoderUtil::DecodeHexToChar( TSTRING::const_iterator* pcur,
//////////////////////////////////////////////////////////////////////////////
cEncoder::cEncoder( int e, int f )
: m_fFlags( f )
cEncoder::cEncoder(int e, int f) : m_fFlags(f)
{
// add encodings
if (e & NON_NARROWABLE)
@ -632,14 +575,10 @@ cEncoder::cEncoder( int e, int f )
m_encodings.push_back(new cQuoteCharEncoder);
// assert that we weren't passed anything freaky
ASSERT( 0 == ( e & ~( NON_NARROWABLE |
NON_PRINTABLE |
BACKSLASH |
DBL_QUOTE ) ) );
ASSERT(0 == (e & ~(NON_NARROWABLE | NON_PRINTABLE | BACKSLASH | DBL_QUOTE)));
// add flags
ASSERT( ! ( ( m_fFlags & ROUNDTRIP ) &&
( m_fFlags & NON_ROUNDTRIP ) ) );
ASSERT(!((m_fFlags & ROUNDTRIP) && (m_fFlags & NON_ROUNDTRIP)));
#ifdef TSS_DO_SCHEMA_VALIDATION
@ -647,7 +586,6 @@ cEncoder::cEncoder( int e, int f )
ValidateSchema();
#endif
}
@ -689,9 +627,7 @@ void cEncoder::Encode( TSTRING& strIn ) const
sack_type::const_iterator atE;
// for all encoders
for( atE = m_encodings.begin();
atE != m_encodings.end();
atE++ )
for (atE = m_encodings.begin(); atE != m_encodings.end(); atE++)
{
// does char need encoding?
if ((*atE)->NeedsEncoding(first, last))
@ -713,9 +649,8 @@ void cEncoder::Encode( TSTRING& strIn ) const
strIn = strOut;
}
TSTRING cEncoder::Encode( TSTRING::const_iterator first,
TSTRING::const_iterator last,
sack_type::const_iterator encoding ) const
TSTRING
cEncoder::Encode(TSTRING::const_iterator first, TSTRING::const_iterator last, sack_type::const_iterator encoding) const
{
// encode it
if (RoundTrip())
@ -739,8 +674,7 @@ void cEncoder::Decode( TSTRING& strIn ) const
while (cCharUtil::PopNextChar(cur, end, first, last))
{
// is this char the escape character?
if( IsSingleTCHAR( first, last ) &&
*first == iCharEncoder::EscapeChar() )
if (IsSingleTCHAR(first, last) && *first == iCharEncoder::EscapeChar())
{
// get to identifier
if (!cCharUtil::PopNextChar(cur, end, first, last))
@ -755,9 +689,7 @@ void cEncoder::Decode( TSTRING& strIn ) const
// determine to which encoding the identifier belongs
bool fFoundEncoding = false;
sack_type::const_iterator atE;
for( atE = m_encodings.begin();
atE != m_encodings.end();
atE++ )
for (atE = m_encodings.begin(); atE != m_encodings.end(); atE++)
{
// is this the right encoding?
if (*first == (*atE)->Identifier())
@ -823,8 +755,7 @@ bool cEncoder::OnlyOneCatagoryPerChar() const
}
}
ch++;
}
while( ch != std::numeric_limits<TCHAR>::max() );
} while (ch != std::numeric_limits<TCHAR>::max());
}
return true;
}
@ -857,9 +788,7 @@ bool cEncoder::AllTestsRunOnEncodedString( const TSTRING& s ) const
while (cCharUtil::PopNextChar(cur, end, first, last))
{
sack_type::const_iterator atE;
for( atE = m_encodings.begin();
atE != m_encodings.end();
atE++ )
for (atE = m_encodings.begin(); atE != m_encodings.end(); atE++)
{
if ((*atE)->NeedsEncoding(first, last))
{
@ -877,14 +806,7 @@ bool cEncoder::AllTestsRunOnEncodedString( const TSTRING& s ) const
//////////////////////////////////////////////////////////////////////////////
cDisplayEncoder::cDisplayEncoder( Flags f )
: cEncoder(
NON_NARROWABLE |
NON_PRINTABLE |
BACKSLASH |
DBL_QUOTE,
f
)
cDisplayEncoder::cDisplayEncoder(Flags f) : cEncoder(NON_NARROWABLE | NON_PRINTABLE | BACKSLASH | DBL_QUOTE, f)
{
}
@ -898,4 +820,3 @@ bool cDisplayEncoder::Decode( TSTRING& str ) const
cEncoder::Decode(str);
return true; // TODO:BAM -- throw error!
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -89,9 +89,8 @@ class cEncoder
private:
typedef std::vector<iCharEncoder*> sack_type;
TSTRING Encode( TSTRING::const_iterator first,
TSTRING::const_iterator last,
sack_type::const_iterator encoding ) const;
TSTRING
Encode(TSTRING::const_iterator first, TSTRING::const_iterator last, sack_type::const_iterator encoding) const;
bool RoundTrip() const;
bool AllowWhiteSpace() const;
@ -128,11 +127,9 @@ class cDisplayEncoder : public cEncoder
};
class cCharEncoderUtil
{
public:
static bool IsPrintable(TCHAR ch);
static bool IsWhiteSpace(TCHAR ch);
@ -140,13 +137,11 @@ class cCharEncoderUtil
static TSTRING HexValueToCharString(const TSTRING& str);
static TCHAR hex_to_char( TSTRING::const_iterator first,
TSTRING::const_iterator last );
static TCHAR hex_to_char(TSTRING::const_iterator first, TSTRING::const_iterator last);
static TSTRING char_to_hex(TCHAR ch);
static TSTRING DecodeHexToChar( TSTRING::const_iterator* pcur,
const TSTRING::const_iterator end );
static TSTRING DecodeHexToChar(TSTRING::const_iterator* pcur, const TSTRING::const_iterator end);
enum
@ -241,4 +236,3 @@ typedef cDisplayEncoder_<TCHAR> cDisplayEncoder;
#endif //__DISPLAYENCODER_H
*/

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -96,5 +96,3 @@ TSTRING cDisplayUtil::FormatMultiLineString( const TSTRING& str, int nOffset, in
return (sstr.str());
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -98,4 +98,3 @@ public:
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#endif // #ifndef __DISPLAYUTIL_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -64,4 +64,3 @@ bool CheckEpoch()
return false;
#endif
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -42,4 +42,3 @@
bool CheckEpoch();
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -47,5 +47,3 @@ uint32 eError::CalcHash( const char* name )
crcFinit(crc);
return crc.crc;
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -42,7 +42,6 @@
class eError
{
public:
//-------------------------------------------------------------------------
// Construction and Assignment
//-------------------------------------------------------------------------
@ -138,19 +137,24 @@ protected:
class except : public base \
{ \
public: \
except( const TSTRING& msg, uint32 flags = 0 ) \
: base( msg, flags ) {} \
TSS_BEGIN_EXCEPTION_EXPLICIT except( const except& rhs ) \
: base( rhs ) {} \
explicit except() : base() {} \
except(const TSTRING& msg, uint32 flags = 0) : base(msg, flags) \
{ \
} \
TSS_BEGIN_EXCEPTION_EXPLICIT except(const except& rhs) : base(rhs) \
{ \
} \
explicit except() : base() \
{ \
} \
\
virtual uint32 GetID() const \
{ \
return CalcHash(#except); \
}\
}
#define TSS_END_EXCEPTION() \
};
} \
;
///////////////////////////////////////////////////////////////////////////////
// TSS_BEGIN_EXCEPTION_NO_CTOR
@ -161,12 +165,14 @@ protected:
class except : public base \
{ \
public: \
explicit except() : base() {} \
explicit except() : base() \
{ \
} \
\
virtual uint32 GetID() const \
{ \
return CalcHash(#except); \
}\
}
///////////////////////////////////////////////////////////////////////////////
// TSS_EXCEPTION
@ -189,31 +195,22 @@ protected:
///////////////////////////////////////////////////////////////////////////////
// eError
///////////////////////////////////////////////////////////////////////////////
inline eError::eError( const TSTRING& msg, uint32 flags )
: mMsg ( msg ),
mFlags ( flags )
inline eError::eError(const TSTRING& msg, uint32 flags) : mMsg(msg), mFlags(flags)
{
}
///////////////////////////////////////////////////////////////////////////////
// eError
///////////////////////////////////////////////////////////////////////////////
inline eError::eError( const eError& rhs )
: mMsg ( rhs.mMsg ),
mFlags ( rhs.mFlags )
inline eError::eError(const eError& rhs) : mMsg(rhs.mMsg), mFlags(rhs.mFlags)
{
}
///////////////////////////////////////////////////////////////////////////////
// eError
///////////////////////////////////////////////////////////////////////////////
inline eError::eError( )
: mMsg ( _T("") ),
mFlags ( 0 )
inline eError::eError() : mMsg(_T("")), mFlags(0)
{
}
@ -231,7 +228,6 @@ inline void eError::operator=( const eError& rhs )
///////////////////////////////////////////////////////////////////////////////
inline eError::~eError()
{
}
///////////////////////////////////////////////////////////////////////////////
@ -275,7 +271,6 @@ inline void eError::SetFatality(bool fatal)
inline bool eError::IsFatal() const
{
return (mFlags & (uint32)NON_FATAL) == 0;
}
///////////////////////////////////////////////////////////////////////////////
@ -298,6 +293,4 @@ inline bool eError::SupressThird() const
}
#endif //__ERROR_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -57,7 +57,9 @@ class cErrorBucket
{
public:
cErrorBucket();
virtual ~cErrorBucket() {}
virtual ~cErrorBucket()
{
}
virtual void AddError(const eError& error);
// add an error to the bucket
@ -81,8 +83,7 @@ protected:
///////////////////
// cErrorBucket
///////////////////
inline cErrorBucket::cErrorBucket() :
mpChild(0)
inline cErrorBucket::cErrorBucket() : mpChild(0)
{
}
@ -99,4 +100,3 @@ inline cErrorBucket* cErrorBucket::SetChild(cErrorBucket* pNewChild)
}
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -52,9 +52,7 @@ void cErrorBucket::AddError(const eError& error)
//#############################################################################
void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra)
{
cDisplayEncoder e(
(cDisplayEncoder::Flags) ( cDisplayEncoder::NON_ROUNDTRIP |
cDisplayEncoder::ALLOW_WHITESPACE ) );
cDisplayEncoder e((cDisplayEncoder::Flags)(cDisplayEncoder::NON_ROUNDTRIP | cDisplayEncoder::ALLOW_WHITESPACE));
TSTRING errStr;
//
@ -74,8 +72,7 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra)
return;
// "First Part" header
errStr = TSS_GetString( cCore, error.IsFatal() ? core::STR_ERROR_ERROR
: core::STR_ERROR_WARNING );
errStr = TSS_GetString(cCore, error.IsFatal() ? core::STR_ERROR_ERROR : core::STR_ERROR_WARNING);
if (errStr.empty())
{
@ -136,7 +133,8 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra)
break;
}
TSTRING::size_type lastSpace = currentStr.find_last_of(SPACE, currentStr.length() >= WIDTH - 1 ? WIDTH - 1 : TSTRING::npos);
TSTRING::size_type lastSpace =
currentStr.find_last_of(SPACE, currentStr.length() >= WIDTH - 1 ? WIDTH - 1 : TSTRING::npos);
if (lastSpace == TSTRING::npos)
{
// can't find space to break at so this string will just have to be longer than screen width.
@ -148,15 +146,11 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra)
lastSpace = currentStr.length();
}
TCERR << TSS_GetString( cCore, core::STR_ERROR_HEADER )
<< currentStr.substr( 0, lastSpace )
<< std::endl;
TCERR << TSS_GetString(cCore, core::STR_ERROR_HEADER) << currentStr.substr(0, lastSpace) << std::endl;
currentStr.erase(0, lastSpace + 1);
}
while ( !currentStr.empty() );
}
while ( !errStr.empty() );
} while (!currentStr.empty());
} while (!errStr.empty());
}
// "Third Part" print 'exiting' or 'continuing'
@ -165,11 +159,8 @@ void cErrorReporter::PrintErrorMsg(const eError& error, const TSTRING& strExtra)
if ((error.GetFlags() & eError::SUPRESS_THIRD_MSG) == 0)
{
TCERR << TSS_GetString(cCore, core::STR_ERROR_HEADER)
<< TSS_GetString(
cCore,
error.IsFatal()
? core::STR_ERROR_EXITING
: core::STR_ERROR_CONTINUING ) << std::endl;
<< TSS_GetString(cCore, error.IsFatal() ? core::STR_ERROR_EXITING : core::STR_ERROR_CONTINUING)
<< std::endl;
}
}
@ -185,9 +176,7 @@ void cErrorTracer::HandleError(const eError& error)
{
cDebug d("cErrorTracer::HandleError");
d.TraceError( _T("%s : %s\n"),
cErrorTable::GetInstance()->Get( error.GetID() ).c_str(),
error.GetMsg().c_str() );
d.TraceError(_T("%s : %s\n"), cErrorTable::GetInstance()->Get(error.GetID()).c_str(), error.GetMsg().c_str());
}
//#############################################################################
@ -210,14 +199,12 @@ void cErrorQueue::HandleError(const eError& error)
mList.push_back(ePoly(error));
}
cErrorQueueIter::cErrorQueueIter(cErrorQueue& queue) :
mList(queue.mList)
cErrorQueueIter::cErrorQueueIter(cErrorQueue& queue) : mList(queue.mList)
{
SeekBegin();
}
cErrorQueueIter::cErrorQueueIter(const cErrorQueue& queue)
: mList( ((cErrorQueue*)&queue)->mList )
cErrorQueueIter::cErrorQueueIter(const cErrorQueue& queue) : mList(((cErrorQueue*)&queue)->mList)
{
SeekBegin();
}
@ -267,7 +254,6 @@ void cErrorQueue::Read(iSerializer* pSerializer, int32 version)
mList.push_back(ePoly(errorNumber, errorString, flags));
}
}
///////////////////////////////////////////////////////////////////////////////
@ -283,7 +269,6 @@ void cErrorQueue::Write(iSerializer* pSerializer) const
pSerializer->WriteString((*i).GetMsg());
pSerializer->WriteInt32((*i).GetFlags());
}
}
@ -303,4 +288,3 @@ void cErrorQueue::TraceContents(int dl) const
d.Trace(dl, _T("Error[%d]: num = %x string = %s\n"), counter, (*i).GetID(), (*i).GetMsg().c_str());
}
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -100,6 +100,7 @@ protected:
class cErrorQueue : public cErrorBucket, public iTypedSerializable
{
friend class cErrorQueueIter;
public:
void Clear();
// remove all errors from the queue
@ -119,6 +120,7 @@ public:
protected:
virtual void HandleError(const eError& error);
private:
typedef std::list<ePoly> ListType;
ListType mList;
@ -131,7 +133,9 @@ class cErrorQueueIter
public:
cErrorQueueIter(cErrorQueue& queue);
cErrorQueueIter(const cErrorQueue& queue);
~cErrorQueueIter() {}
~cErrorQueueIter()
{
}
// iteration methods
void SeekBegin();
@ -153,9 +157,14 @@ private:
//////////////////////////////////////////////////////
class cErrorBucketNull : public cErrorBucket
{
virtual void AddError(const eError& ) {}
virtual void AddError(const eError&)
{
}
protected:
virtual void HandleError(const eError& ) {}
virtual void HandleError(const eError&)
{
}
};
//////////////////////////////////////////////////////
@ -165,10 +174,10 @@ protected:
class cErrorBucketPassThru : public cErrorBucket
{
protected:
virtual void HandleError(const eError& ) {}
virtual void HandleError(const eError&)
{
}
};
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -46,4 +46,3 @@ TSS_EXCEPTION( eBadCmdLine, eErrorGeneral );
TSS_EXCEPTION(eBadModeSwitch, eErrorGeneral);
#endif //#ifndef __ERRORGENERAL_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -72,10 +72,10 @@ void cErrorTable::AssertMsgValidity(const TCHAR* msg)
// Sunpro got stuck in an infinite loop when we called GetString from this func;
TSTRING::size_type errorSize = 9;
TSTRING::size_type warningSize = 10;
TSTRING::size_type maxHeaderSize = (errorSize > warningSize ? errorSize : warningSize) + 6; // Add 6 to account for "### ' and ': '
TSTRING::size_type maxHeaderSize =
(errorSize > warningSize ? errorSize : warningSize) + 6; // Add 6 to account for "### ' and ': '
# endif
ASSERT(maxHeaderSize + errSize < 80);
}
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -113,12 +113,9 @@ inline void cErrorTable::Put( const eError& e, const TCHAR* msg )
RegisterErrors##pkgName::RegisterErrors##pkgName() \
{
#define TSS_REGISTER_ERROR( err, str ) \
cErrorTable::GetInstance()->Put \
( err, str );
# define TSS_REGISTER_ERROR(err, str) cErrorTable::GetInstance()->Put(err, str);
#define TSS_END_ERROR_REGISTRATION() \
}
# define TSS_END_ERROR_REGISTRATION() }
//===================
// h file macros
@ -132,9 +129,7 @@ inline void cErrorTable::Put( const eError& e, const TCHAR* msg )
//===================
// package init macros
//===================
#define TSS_REGISTER_PKG_ERRORS( pkgName ) \
RegisterErrors##pkgName register##pkgName;
# define TSS_REGISTER_PKG_ERRORS(pkgName) RegisterErrors##pkgName register##pkgName;
#endif //__ERRORTABLE_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -47,10 +47,9 @@ namespace //unique
snprintf(string, size, "%d", value);
return string;
}
}
} // namespace
eInternal::eInternal(TCHAR* sourceFile, int lineNum)
: eError(_T(""))
eInternal::eInternal(TCHAR* sourceFile, int lineNum) : eError(_T(""))
{
TCHAR buf[256];
@ -81,4 +80,3 @@ TSTRING cErrorUtil::MakeFileError( const TSTRING& msg, const TSTRING& fileName )
return ret;
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -108,7 +108,11 @@ public:
// TODO: ASSERT is always fatal in Unix, perhaps we could #ifdef the ASSERT
// to echo to cout the line number the exception occured at?
#define ThrowAndAssert(exception) { ASSERT(false); throw exception; }
#define ThrowAndAssert(exception) \
{ \
ASSERT(false); \
throw exception; \
}
//-----------------------------------------------------------------------------
@ -118,11 +122,8 @@ public:
///////////////////////////////////////////////////////////////////////////////
// ePoly
///////////////////////////////////////////////////////////////////////////////
inline ePoly::ePoly( uint32 id, const TSTRING& msg, uint32 flags )
: eError( msg, flags ),
mID( id )
inline ePoly::ePoly(uint32 id, const TSTRING& msg, uint32 flags) : eError(msg, flags), mID(id)
{
}
///////////////////////////////////////////////////////////////////////////////
@ -136,11 +137,8 @@ inline ePoly::ePoly( const eError& rhs )
///////////////////////////////////////////////////////////////////////////////
// ePoly
///////////////////////////////////////////////////////////////////////////////
inline ePoly::ePoly()
: eError( _T("") ),
mID( 0 )
inline ePoly::ePoly() : eError(_T("")), mID(0)
{
}
///////////////////////////////////////////////////////////////////////////////
@ -170,4 +168,3 @@ inline void ePoly::SetID( uint32 id )
}
#endif //__ERRORUTIL_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -88,8 +88,10 @@ public:
// note that reading from the file is implicit
OPEN_READ = 0x00000001, // not needed, but makes calls nice...
OPEN_WRITE = 0x00000002, // we will be writing to the file
OPEN_LOCKED_TEMP = 0x00000004, // the file should not be readable by other processes and should be removed when closed
OPEN_TRUNCATE = 0x00000008, // opens an empty file. creates it if it doesn't exist. Doesn't make much sense without OF_WRITE
OPEN_LOCKED_TEMP =
0x00000004, // the file should not be readable by other processes and should be removed when closed
OPEN_TRUNCATE =
0x00000008, // opens an empty file. creates it if it doesn't exist. Doesn't make much sense without OF_WRITE
OPEN_CREATE = 0x00000010, // create the file if it doesn't exist; this is implicit if OF_TRUNCATE is set
OPEN_TEXT = 0x00000020,
OPEN_EXCLUSIVE = 0x00000040, // Use O_CREAT | O_EXCL
@ -183,4 +185,3 @@ public:
#endif //__FILE_H

View File

@ -1,6 +1,6 @@
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -82,9 +82,9 @@ struct cFile_i
};
//Ctor
cFile_i::cFile_i() :
m_fd(-1), mpCurrStream(NULL), mFlags(0)
{}
cFile_i::cFile_i() : m_fd(-1), mpCurrStream(NULL), mFlags(0)
{
}
//Dtor
cFile_i::~cFile_i()
@ -113,8 +113,7 @@ cFile_i::~cFile_i()
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
cFile::cFile() :
mpData(NULL), isWritable(false)
cFile::cFile() : mpData(NULL), isWritable(false)
{
mpData = new cFile_i;
}
@ -174,7 +173,8 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
mode = _T("rb");
}
if (flags & OPEN_EXCLUSIVE) {
if (flags & OPEN_EXCLUSIVE)
{
perm |= O_CREAT | O_EXCL;
openmode = (mode_t)0600; // Make sure only root can read the file
}
@ -257,7 +257,6 @@ void cFile::Open( const TSTRING& sFileNameC, uint32 flags )
ioctl(fh, VX_SETCACHE, VX_SEQ | VX_NOREUSE);
}
#endif
}
@ -351,14 +350,19 @@ cFile::File_t cFile::Read( void* buffer, File_t nBytes ) const //throw(eFile)
if (nBytes == 0)
return 0;
if (mpData->mFlags & OPEN_DIRECT) {
if (mpData->mFlags & OPEN_DIRECT)
{
iBytesRead = read(mpData->m_fd, buffer, nBytes);
if (iBytesRead<0) {
if (iBytesRead < 0)
{
throw eFileRead(mpData->mFileName, iFSServices::GetInstance()->GetErrString());
}
} else {
}
else
{
iBytesRead = fread(buffer, sizeof(byte), nBytes, mpData->mpCurrStream);
if( ferror( mpData->mpCurrStream ) != 0 ) {
if (ferror(mpData->mpCurrStream) != 0)
{
throw eFileRead(mpData->mFileName, iFSServices::GetInstance()->GetErrString());
}
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -37,8 +37,7 @@
#include "corestrings.h"
// TODO: Make this use MakeFileError() for consistency
eFileError::eFileError( const TSTRING& filename, const TSTRING& description, uint32 flags )
: eError( _T(""), flags )
eFileError::eFileError(const TSTRING& filename, const TSTRING& description, uint32 flags) : eError(_T(""), flags)
{
mFilename = filename;
mMsg = description;
@ -73,4 +72,3 @@ TSTRING eFileError::GetDescription() const
return ret;
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -58,10 +58,13 @@ private:
public:
eFileError(const TSTRING& filename, const TSTRING& description, uint32 flags = 0);
explicit eFileError( const eFileError& rhs )
: eError( rhs ) { mFilename = rhs.mFilename; }
eFileError( const TSTRING& msg, uint32 flags = 0 )
: eError( msg, flags ) {}
explicit eFileError(const eFileError& rhs) : eError(rhs)
{
mFilename = rhs.mFilename;
}
eFileError(const TSTRING& msg, uint32 flags = 0) : eError(msg, flags)
{
}
TSTRING GetFilename() const;
@ -72,9 +75,9 @@ TSS_END_EXCEPTION()
# define TSS_FILE_EXCEPTION(except, base) \
TSS_BEGIN_EXCEPTION(except, base) \
except( const TSTRING& filename, const TSTRING& msg, uint32 flags = 0 ) \
: base( filename, msg, flags ) {} \
except(const TSTRING& filename, const TSTRING& msg, uint32 flags = 0) : base(filename, msg, flags) \
{ \
} \
TSS_END_EXCEPTION()
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -79,9 +79,7 @@ void cFileHeaderID::operator=( const cFileHeaderID& rhs )
int cFileHeaderID::operator==(const cFileHeaderID& rhs) const
{
return
( mIDLen == rhs.mIDLen ) &&
( ::memcmp( mID, rhs.mID, mIDLen * sizeof(char) ) == 0 );
return (mIDLen == rhs.mIDLen) && (::memcmp(mID, rhs.mID, mIDLen * sizeof(char)) == 0);
}
void cFileHeaderID::Read(iSerializer* pSerializer, int32 /*version*/) // throw (eSerializer, eArchive)
@ -108,8 +106,7 @@ void cFileHeaderID::Write(iSerializer* pSerializer) const // throw (eSerializer,
///////////////////////////////////////////////////////////////////////////////
// class cFileHeader
cFileHeader::cFileHeader()
: mVersion(0)
cFileHeader::cFileHeader() : mVersion(0)
{
#ifdef DEBUG
mEncoding = LAST_ENCODING; // set to invalid value so we can assert on write
@ -119,20 +116,14 @@ cFileHeader::cFileHeader()
}
cFileHeader::cFileHeader(const cFileHeader& rhs)
: iSerializable(),
mID(rhs.mID),
mVersion(rhs.mVersion),
mEncoding(rhs.mEncoding)
: iSerializable(), mID(rhs.mID), mVersion(rhs.mVersion), mEncoding(rhs.mEncoding)
{
if (rhs.mBaggage.Length() > 0)
{
mBaggage.MapArchive(0, rhs.mBaggage.Length());
rhs.mBaggage.MapArchive(0, rhs.mBaggage.Length());
::memcpy(
mBaggage.GetMap(),
rhs.mBaggage.GetMap(),
static_cast<size_t>( rhs.mBaggage.Length() ) );
::memcpy(mBaggage.GetMap(), rhs.mBaggage.GetMap(), static_cast<size_t>(rhs.mBaggage.Length()));
mBaggage.MapArchive(0, 0);
rhs.mBaggage.MapArchive(0, 0);
@ -250,4 +241,3 @@ void cFileHeader::Write(iSerializer* pSerializer) const // throw (eSerializer, e
pSerializer->WriteBlob(mBaggage.GetMap(), len);
}
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -70,7 +70,10 @@ private:
// the program is the only person who will see them.
int16 mIDLen;
enum { MAXBYTES = 256 };
enum
{
MAXBYTES = 256
};
char mID[MAXBYTES];
};
@ -84,9 +87,7 @@ inline cFileHeaderID::cFileHeaderID(const TCHAR* id)
*this = id;
}
inline
cFileHeaderID::cFileHeaderID( const cFileHeaderID& rhs ) :
iSerializable(), mIDLen( rhs.mIDLen )
inline cFileHeaderID::cFileHeaderID(const cFileHeaderID& rhs) : iSerializable(), mIDLen(rhs.mIDLen)
{
memcpy(mID, rhs.mID, MAXBYTES);
}
@ -163,4 +164,3 @@ inline const cMemoryArchive& cFileHeader::GetBaggage() const
}
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -48,4 +48,3 @@
#define fixed_basic_ofstream std::basic_ofstream
#endif //__FIXED_FILEBUF_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -43,5 +43,3 @@ iFSServices* iFSServices::mpInstance = 0;
//#############################################################################
// eFSServices
//#############################################################################

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -122,8 +122,10 @@ typedef int64 cFSType;
// this class is used only to pass arguments to iFSServices
// it is the union of MAX(elem) for all the file systems that we support
struct cFSStatArgs {
enum FileType {
struct cFSStatArgs
{
enum FileType
{
TY_INVALID, // lazy evaluation
TY_FILE,
TY_DIR,
@ -164,7 +166,6 @@ struct cFSStatArgs {
};
//=========================================================================
//
// eFSServices -- exception class
@ -185,7 +186,9 @@ TSS_FILE_EXCEPTION( eFSServicesGeneric, eFSServices );
class iFSServices
{
public:
virtual ~iFSServices() {}
virtual ~iFSServices()
{
}
///////////////////////////////////////////////////////////////
// ENUMS
///////////////////////////////////////////////////////////////
@ -357,4 +360,3 @@ inline void iFSServices::SetInstance( iFSServices* pInst )
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -47,7 +47,10 @@ public:
size_t mSize;
int8* mpData;
cHeap( size_t size ) : mSize( size ), mpData( new int8[size] ) { ASSERT(mpData != 0); }
cHeap(size_t size) : mSize(size), mpData(new int8[size])
{
ASSERT(mpData != 0);
}
// Note: The above ASSERT should never occur! If the new failed we should have thrown a bad_alloc().
};
typedef std::vector<cHeap> HeapList;
@ -59,7 +62,10 @@ public:
size_t mCurOff;
cGrowHeap_i(size_t initialSize, size_t growBy, const TCHAR* name);
~cGrowHeap_i() { Clear(); }
~cGrowHeap_i()
{
Clear();
}
size_t AlignSizeRequest(size_t size, size_t alignSize);
void* Malloc(size_t size);
@ -68,10 +74,7 @@ public:
cGrowHeap_i::cGrowHeap_i(size_t initialSize, size_t growBy, const TCHAR* name)
: mInitialSize( initialSize ),
mGrowBy ( growBy ),
mName ( name ),
mCurOff ( 0 )
: mInitialSize(initialSize), mGrowBy(growBy), mName(name), mCurOff(0)
{
// assure that initial size and growby are aligned
ASSERT(0 == (initialSize % BYTE_ALIGN));
@ -168,10 +171,9 @@ void cGrowHeap_i::Clear()
//-----------------------------------------------------------------------------
// cGrowHeap
//-----------------------------------------------------------------------------
cGrowHeap::cGrowHeap( size_t initialSize, size_t growBy, const TCHAR* name ) :
mpData( new cGrowHeap_i( initialSize, growBy, name ) )
cGrowHeap::cGrowHeap(size_t initialSize, size_t growBy, const TCHAR* name)
: mpData(new cGrowHeap_i(initialSize, growBy, name))
{
}
cGrowHeap::~cGrowHeap()
@ -191,4 +193,3 @@ void cGrowHeap::Clear()
{
mpData->Clear();
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -69,4 +69,3 @@ private:
#endif

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -32,5 +32,3 @@
//hashtable.cpp : implementation for hashtable which maps const TCHAR*'s to void*'s
#include "stdcore.h"
#include "hashtable.h"

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -67,8 +67,7 @@
// equality. There is also a specialization for TSTRINGS. If neither of these
// fit your needs, you must pass the hash table your own fn pointer or class
///////////////////////////////////////////////////////////////////////////////
template<class T>
class cDefaultCompare
template<class T> class cDefaultCompare
{
public:
bool operator()(const T& lhs, const T& rhs)
@ -79,8 +78,7 @@ public:
/////////////////////////////////////////////////////////
// specialization for TSTRINGS
/////////////////////////////////////////////////////////
template<>
inline bool cDefaultCompare<TSTRING>::operator()(const TSTRING& lhs, const TSTRING& rhs)
template<> inline bool cDefaultCompare<TSTRING>::operator()(const TSTRING& lhs, const TSTRING& rhs)
{
return (lhs.compare(rhs) == 0);
}
@ -90,8 +88,7 @@ inline bool cDefaultCompare<TSTRING>::operator()(const TSTRING& lhs, const TSTRI
// into a byte* and a key length (for hashing purposes). The default implementation
// just does a cast. A specialization is also provided for TSTRINGs.
///////////////////////////////////////////////////////////////////////////////
template<class T>
class cDefaultConvert
template<class T> class cDefaultConvert
{
public:
const byte* operator()(const T& obj, int* const pcbKeyLen)
@ -104,8 +101,7 @@ public:
/////////////////////////////////////////////////////////
// specialization for TSTRINGS
/////////////////////////////////////////////////////////
template<>
inline const byte* cDefaultConvert<TSTRING>::operator()(const TSTRING& obj, int* const pcbKeyLen )
template<> inline const byte* cDefaultConvert<TSTRING>::operator()(const TSTRING& obj, int* const pcbKeyLen)
{
*pcbKeyLen = sizeof(TCHAR) * obj.length();
return (byte*)obj.c_str();
@ -123,7 +119,8 @@ inline const byte* cDefaultConvert<TSTRING>::operator()(const TSTRING& obj, int*
///////////////////////////////////////////////////////////////////////////////
// these were moved outside of the class because it sucks to have to name the class with template parameters
// ie -- mTable(cHashTable<TSTRING, int>::MEDIUM
enum cHashTable_TableSize {
enum cHashTable_TableSize
{
HASH_VERY_SMALL = 17,
HASH_SMALL = 2007,
HASH_MEDIUM = 6007,
@ -132,17 +129,25 @@ enum cHashTable_TableSize {
};
// forward declaration
template <class KEY_TYPE, class VAL_TYPE, class COMPARE_OP = cDefaultCompare<KEY_TYPE>, class CONVERTER = cDefaultConvert<KEY_TYPE> >
template<class KEY_TYPE,
class VAL_TYPE,
class COMPARE_OP = cDefaultCompare<KEY_TYPE>,
class CONVERTER = cDefaultConvert<KEY_TYPE> >
class cHashTableIter;
//General version of cHashTable template:
template <class KEY_TYPE, class VAL_TYPE, class COMPARE_OP = cDefaultCompare<KEY_TYPE>, class CONVERTER = cDefaultConvert<KEY_TYPE> >
template<class KEY_TYPE,
class VAL_TYPE,
class COMPARE_OP = cDefaultCompare<KEY_TYPE>,
class CONVERTER = cDefaultConvert<KEY_TYPE> >
class cHashTable
{
friend class cHashTableIter<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>;
public:
//structure for hash table nodes.
struct node {
struct node
{
KEY_TYPE nKey;
VAL_TYPE nData;
node* next;
@ -169,7 +174,10 @@ public:
bool IsEmpty(void) const;
uint32 Hash(const KEY_TYPE& key) const;
//The hashing function, taken from old Tripwire
int32 GetNumValues() const { return mValuesInTable; };
int32 GetNumValues() const
{
return mValuesInTable;
};
// returns number of table entries filled
#ifdef DEBUG
@ -190,8 +198,7 @@ private:
// cHashTableIter
///////////////////////////////////////////////////////////////////////////////
template <class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER>
class cHashTableIter
template<class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER> class cHashTableIter
{
public:
cHashTableIter(const cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>& hashTbl);
@ -214,7 +221,6 @@ private:
};
//#############################################################################
// implementation
@ -222,8 +228,9 @@ private:
// iterator
///////////////////////////////////////////////////////////////////////////////
template<class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER>
inline cHashTableIter<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::cHashTableIter( const cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>& hashTbl) :
mHashTable(hashTbl)
inline cHashTableIter<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::cHashTableIter(
const cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>& hashTbl)
: mHashTable(hashTbl)
{
SeekBegin();
}
@ -334,7 +341,8 @@ bool cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Insert(KEY_TYPE key,
COMPARE_OP compare;
int hindex = Hash(key);
if (mTable[hindex] == NULL) {
if (mTable[hindex] == NULL)
{
//open index, perform insert
mTable[hindex] = new node;
(mTable[hindex])->nKey = key;
@ -393,19 +401,20 @@ bool cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Insert(KEY_TYPE key,
////////////////////////////////////////////////////////////////////////////////
// General Version:
template<class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER>
bool
cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Lookup(KEY_TYPE key, VAL_TYPE& d_out) const
bool cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Lookup(KEY_TYPE key, VAL_TYPE& d_out) const
{
COMPARE_OP compare;
int hindex = Hash(key);
if (mTable[hindex] == NULL)
return false;
else {
else
{
node* nodeptr = mTable[hindex];
while (nodeptr != NULL)
{
if( compare(nodeptr->nKey, key)) {
if (compare(nodeptr->nKey, key))
{
d_out = nodeptr->nData;
return true;
}
@ -421,21 +430,23 @@ cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Lookup(KEY_TYPE key, VAL_
////////////////////////////////////////////////////////////////////////////////
// General Version -
template<class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER>
bool
cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Remove(KEY_TYPE key)
bool cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Remove(KEY_TYPE key)
{
COMPARE_OP compare;
int hindex = Hash(key);
if (mTable[hindex] == NULL) {
if (mTable[hindex] == NULL)
{
delete (mTable[hindex]);
mTable[hindex] = NULL;
return true;
}
else {
else
{
node* nodeptr = mTable[hindex];
node* prev;
while(nodeptr != NULL) {
while (nodeptr != NULL)
{
prev = nodeptr;
if (compare(mTable[hindex]->nKey, key))
{
@ -456,15 +467,16 @@ cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Remove(KEY_TYPE key)
// Clear -- Clears entire hash table so that all indices are NULL
////////////////////////////////////////////////////////////////////////////////
template<class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER>
bool
cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Clear(void)
bool cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Clear(void)
{
for (int i = 0; i < mTableSize; ++i)
{
if (mTable[i] != NULL) {
if (mTable[i] != NULL)
{
node* curr = mTable[i];
node* del;
while(curr != NULL) {
while (curr != NULL)
{
del = curr;
curr = curr->next;
delete del;
@ -482,8 +494,7 @@ cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Clear(void)
// IsEmpty --
////////////////////////////////////////////////////////////////////////////////
template<class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER>
bool
cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::IsEmpty(void) const
bool cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::IsEmpty(void) const
{
bool ret = true;
for (int i = 0; i < mTableSize; ++i)
@ -538,12 +549,15 @@ void cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::TraceDiagnostics() c
d.TraceDebug("---------------Hash Table Statisics---------------\n");
d.TraceDebug("-- Number of slots: %d\n", mTableSize);
d.TraceDebug("-- Number of items: %d\n", numItems);
d.TraceDebug("-- Slots filled: %d (%lf %%)\n",slotsFilled, ((double)slotsFilled / (double)mTableSize) * 100.0);
d.TraceDebug("-- Slots with >1 item: %d (%lf %%)\n",numMultiSlot, ((double)numMultiSlot / (double)slotsFilled) * 100.0);
d.TraceDebug("-- Slots filled: %d (%lf %%)\n",
slotsFilled,
((double)slotsFilled / (double)mTableSize) * 100.0);
d.TraceDebug("-- Slots with >1 item: %d (%lf %%)\n",
numMultiSlot,
((double)numMultiSlot / (double)slotsFilled) * 100.0);
d.TraceDebug("--------------------------------------------------\n");
}
# endif // DEBUG
#endif //__HASHTABLE_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -66,11 +66,20 @@
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#if (WCHAR_IS_16_BITS)
namespace tss { typedef std::wstring dbstring; }
namespace tss
{
typedef std::wstring dbstring;
}
#elif (WCHAR_IS_32_BITS)
namespace std { template <> struct char_traits< dbchar_t >; }
namespace tss { typedef std::basic_string<dbchar_t> dbstring; }
namespace std
{
template<> struct char_traits<dbchar_t>;
}
namespace tss
{
typedef std::basic_string<dbchar_t> dbstring;
}
#else
# error "wchar_t is not correctly factored!"
@ -84,8 +93,7 @@
// specialize *std*::char_traits!!!
template<>
struct std::char_traits< dbchar_t >
template<> struct std::char_traits<dbchar_t>
{
typedef dbchar_t char_type;
typedef wint_t int_type;
@ -98,23 +106,22 @@ struct std::char_traits< dbchar_t >
typedef int state_type; // Shame on you KAI! This is ANSI-C!
# endif
static
void assign( char_type& lhs, const char_type& rhs ) {
static void assign(char_type& lhs, const char_type& rhs)
{
lhs = rhs;
}
static
bool eq( const char_type& lhs, const char_type& rhs ) {
static bool eq(const char_type& lhs, const char_type& rhs)
{
return lhs == rhs;
}
static
bool lt( const char_type& lhs, const char_type& rhs ) {
static bool lt(const char_type& lhs, const char_type& rhs)
{
return lhs < rhs;
}
static
int compare( const char_type* lhs, const char_type* rhs, size_t N )
static int compare(const char_type* lhs, const char_type* rhs, size_t N)
{
for (; N; ++lhs, ++rhs, --N)
if (*lhs != *rhs)
@ -123,21 +130,20 @@ struct std::char_traits< dbchar_t >
return 0;
}
static
size_t length( const char_type* psz )
static size_t length(const char_type* psz)
{
if (psz == 0)
return 0;
else
{
const char_type* end;
for ( end = psz; *end; end++ );
for (end = psz; *end; end++)
;
return (size_t)(end - psz);
}
}
static
char_type* copy( char_type* lhs, const char_type* rhs, size_t N )
static char_type* copy(char_type* lhs, const char_type* rhs, size_t N)
{
for (char_type* at = lhs; N; ++at, ++rhs, --N)
*at = *rhs;
@ -145,9 +151,7 @@ struct std::char_traits< dbchar_t >
return lhs;
}
static
const char_type*
find( const char_type* psz, size_t N, const char_type& ch )
static const char_type* find(const char_type* psz, size_t N, const char_type& ch)
{
for (; N; ++psz, --N)
if (*psz == ch)
@ -156,40 +160,35 @@ struct std::char_traits< dbchar_t >
return 0;
}
static
char_type* move( char_type* lhs, const char_type* rhs, size_t N ) {
static char_type* move(char_type* lhs, const char_type* rhs, size_t N)
{
return (char_type*)memmove(lhs, rhs, N * sizeof(char_type));
}
static
char_type* assign( char_type* lhs, size_t N, char_type ch )
static char_type* assign(char_type* lhs, size_t N, char_type ch)
{
for (char_type* at = lhs; N; ++at, --N)
*at = ch;
return lhs;
}
static
int_type not_eof( const int_type& ch ) {
static int_type not_eof(const int_type& ch)
{
return int_type(!eq(ch, eof()) ? ch : ~ch);
}
static
char_type to_char_type( const int_type& ch )
static char_type to_char_type(const int_type& ch)
{
return
eq_int_type( ch, to_int_type( ch ) )
? ch
: char_type(0);
return eq_int_type(ch, to_int_type(ch)) ? ch : char_type(0);
}
static
int_type to_int_type( const char_type& ch ) {
static int_type to_int_type(const char_type& ch)
{
return (int_type)ch;
}
static
bool eq_int_type( const int_type& lhs, const int_type& rhs ) {
static bool eq_int_type(const int_type& lhs, const int_type& rhs)
{
return lhs == rhs;
}
@ -198,31 +197,31 @@ struct std::char_traits< dbchar_t >
// CAUTION:RAD -- Extra members required by Modena!!
# ifdef MBSTATE_T_DEFINED // This is ANSI-C *not* ANSI-C++!!
static
state_type get_state( pos_type pos ) {
static state_type get_state(pos_type pos)
{
return pos.state();
}
static
pos_type get_pos( pos_type pos, state_type state ) {
static pos_type get_pos(pos_type pos, state_type state)
{
return pos_type(pos.offset(), state);
}
# endif //MBSTATE_T_DEFINED
static
char_type newline() {
static char_type newline()
{
return L'\n';
}
static
char_type eos() {
static char_type eos()
{
return 0;
}
# endif //IS_STDLIB_MODENA
static
int_type eof() {
static int_type eof()
{
return (wint_t)(0xFFFF);
}
};
@ -231,4 +230,3 @@ struct std::char_traits< dbchar_t >
#endif //__NTDBS_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -47,13 +47,11 @@
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
#ifndef TSS_Raise // Should add file and line info in DEBUG mode!!!!
#define TSS_Raise( Xcpt, pkg, ids ) \
throw Xcpt( TSS_GetString( pkg, ids ) )
# define TSS_Raise(Xcpt, pkg, ids) throw Xcpt(TSS_GetString(pkg, ids))
#endif //TSS_Raise
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// NTMBS Utils -- Definition
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -134,8 +132,7 @@ tss::mbsdec( const_ntmbs_t beg, const_ntmbs_t curr )
* POSTCONDITIONS:
* Returns non-const pointer after moving it.
*/
ntmbs_t
tss::mbsinc( const_ntmbs_t psz )
ntmbs_t tss::mbsinc(const_ntmbs_t psz)
{
cDebug dbg("tss::mbsinc -");
@ -153,10 +150,7 @@ tss::mbsinc( const_ntmbs_t psz )
}
dbg.TraceDebug("Incorrectly Formed, Cannot Normalize!\n");
TSS_Raise(
eCharacterEncoding,
cCore,
core::STR_ERR_BADCHAR );
TSS_Raise(eCharacterEncoding, cCore, core::STR_ERR_BADCHAR);
}
return (((ntmbs_t)psz) + nBytes);
@ -180,8 +174,7 @@ tss::mbsinc( const_ntmbs_t psz )
* POSTCONDITIONS:
* Returns size_t value indicating bytes in the range of [0,nCount).
*/
size_t
tss::mbsbytes( const_ntmbs_t psz, size_t nCount )
size_t tss::mbsbytes(const_ntmbs_t psz, size_t nCount)
{
const_ntmbs_t at = psz;
while (nCount--)
@ -192,21 +185,19 @@ tss::mbsbytes( const_ntmbs_t psz, size_t nCount )
/// To Null terminator
size_t
tss::mbsbytes( const_ntmbs_t psz )
size_t tss::mbsbytes(const_ntmbs_t psz)
{
if (psz == 0)
throw eCharacter(TSS_GetString(cCore, core::STR_ERR_ISNULL));
const_ntmbs_t at;
for ( at = psz; *at; ++at );
for (at = psz; *at; ++at)
;
return (size_t)((char*)at - (char*)psz);
}
/*
* TSS::mbscount
*
@ -224,25 +215,22 @@ tss::mbsbytes( const_ntmbs_t psz )
* POSTCONDITIONS:
* Returns size_t value indicating characters in the range of [psz + 0, psz + nBytes).
*/
size_t
tss_mbscount( const_ntmbs_t psz, size_t nBytes )
size_t tss_mbscount(const_ntmbs_t psz, size_t nBytes)
{
size_t nCount = 0;
const_ntmbs_t at = psz;
const_ntmbs_t end = psz + nBytes;
for ( ; at < end; nCount++, at = tss::mbsinc( at ) );
for (; at < end; nCount++, at = tss::mbsinc(at))
;
return nCount;
}
/// To Null terminator
size_t
tss::mbscount( const_ntmbs_t psz )
size_t tss::mbscount(const_ntmbs_t psz)
{
size_t nCount = 0;
for ( ; *psz; psz = tss::mbsinc( psz ), nCount++ );
for (; *psz; psz = tss::mbsinc(psz), nCount++)
;
return nCount;
}

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -78,7 +78,6 @@
#endif //NTWCS_T_DEFINED
/// NOTE: Size Specific (2 [double] or 4 [quad] byte wide characters)
//--Null-terminated double(2)-byte Character Sequence
@ -109,7 +108,6 @@
#endif //NTQBS_T_DEFINED
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// NTMBS Manipulators
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -131,10 +129,11 @@ namespace tss
size_t mbsbytes(const_ntmbs_t);
size_t mbscount(const_ntmbs_t);
inline size_t mbslen( const_ntmbs_t psz ) { // RAD: Yeesh!
inline size_t mbslen(const_ntmbs_t psz)
{ // RAD: Yeesh!
return tss::mbscount(psz);
}
}//tss::
} // namespace tss
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -149,9 +148,8 @@ namespace tss
//--DEC
template< class CT >
inline
CT* strdec( const CT*, const CT* psz ) {
template<class CT> inline CT* strdec(const CT*, const CT* psz)
{
return const_cast<CT*>(psz - 1);
}
@ -166,33 +164,25 @@ namespace tss
//--INC
template< class CT >
inline
CT* strinc( const CT* psz )
template<class CT> inline CT* strinc(const CT* psz)
{
ASSERT(psz);
return const_cast<CT*>((*psz ? psz + 1 : psz));
}
template< class CT, class SIZET >
inline
CT* strinc( const CT* psz, SIZET N )
template<class CT, class SIZET> inline CT* strinc(const CT* psz, SIZET N)
{
ASSERT(psz);
return const_cast<CT*>((*psz ? psz + N : psz));
}
template<>
inline
ntmbs_t strinc( const_ntmbs_t psz )
template<> inline ntmbs_t strinc(const_ntmbs_t psz)
{
return tss::mbsinc(psz);
}
template<>
inline
ntmbs_t strinc( const_ntmbs_t psz, size_t N )
template<> inline ntmbs_t strinc(const_ntmbs_t psz, size_t N)
{
ntmbs_t at = const_cast<ntmbs_t>(psz);
while (N--)
@ -206,52 +196,50 @@ namespace tss
//--BYTES
template< class CT >
size_t strsize( const CT* psz )
template<class CT> size_t strsize(const CT* psz)
{
const CT* at = psz;
while ( *at ) at++;
while (*at)
at++;
return (size_t)((char*)at - (char*)psz);
}
template< class CT >
size_t strsize( const CT*, size_t N )
template<class CT> size_t strsize(const CT*, size_t N)
{
return N * sizeof(CT);
}
template<>
inline size_t strsize( const_ntmbs_t psz ) {
template<> inline size_t strsize(const_ntmbs_t psz)
{
return mbsbytes(psz);
}
template<>
inline size_t strsize( const_ntmbs_t psz, size_t N ) {
template<> inline size_t strsize(const_ntmbs_t psz, size_t N)
{
return mbsbytes(psz, N);
}
//--COUNT
template< class CT >
size_t strcount( const CT* psz )
template<class CT> size_t strcount(const CT* psz)
{
const CT* at = psz;
while ( *at ) at++;
while (*at)
at++;
return (size_t)(at - psz);
}
template< class CT >
size_t strcount( const CT*, size_t N )
template<class CT> size_t strcount(const CT*, size_t N)
{
return N;
}
template<>
inline size_t strcount( const_ntmbs_t psz ) {
template<> inline size_t strcount(const_ntmbs_t psz)
{
return mbscount(psz);
}
template<>
inline size_t strcount( const_ntmbs_t psz, size_t N ) {
template<> inline size_t strcount(const_ntmbs_t psz, size_t N)
{
return mbscount(psz, N);
}
@ -274,23 +262,21 @@ done with it */
//--FIND_FIRST: ITER
template< class InputT, class E >
InputT
find_first( InputT beg, InputT end, const E& item )
template<class InputT, class E> InputT find_first(InputT beg, InputT end, const E& item)
{
for ( ; beg < end && *beg != item; beg = (InputT)tss::strinc( beg ) );
for (; beg < end && *beg != item; beg = (InputT)tss::strinc(beg))
;
return beg;
}
//--FIND_LAST: ITER
template< class InputT, class E >
InputT
find_last( InputT beg, InputT end, const E& item )
template<class InputT, class E> InputT find_last(InputT beg, InputT end, const E& item)
{
InputT at = end;
for ( ; beg < end ; beg = (InputT)tss::strinc( beg ) );
for (; beg < end; beg = (InputT)tss::strinc(beg))
;
if (*beg == item)
at = beg;
@ -300,12 +286,9 @@ done with it */
//--FIND_FIRST: STRING
template< class StrT >
StrT::size_type
find_first( const StrT& sin, StrT::const_reference item )
template<class StrT> StrT::size_type find_first(const StrT& sin, StrT::const_reference item)
{
StrT::const_iterator
beg = sin.begin();
StrT::const_iterator beg = sin.begin();
end = sin.end();
StrT::size_type N;
@ -319,17 +302,15 @@ done with it */
//--FIND_LAST: STRING
template< class StrT >
StrT::size_type
find_last( const StrT& sin, StrT::const_reference item )
template<class StrT> StrT::size_type find_last(const StrT& sin, StrT::const_reference item)
{
StrT::size_type N = 0;
StrT::size_type nResult = StrT::npos;
StrT::const_iterator
beg = sin.begin();
StrT::const_iterator beg = sin.begin();
end = sin.end();
for ( ; beg < end ; beg = (InputT)tss::strinc( beg ) );
for (; beg < end; beg = (InputT)tss::strinc(beg))
;
if (*beg == item)
nResult = N;
@ -339,16 +320,11 @@ done with it */
//--FIND_FIRST_OF: ITER
template< class InputT >
InputT
find_first_of(
InputT beg,
InputT end,
InputT setbeg,
InputT setend )
template<class InputT> InputT find_first_of(InputT beg, InputT end, InputT setbeg, InputT setend)
{
InputT at;
for ( ; beg < end; beg = (InputT)tss::strinc( beg ) );
for (; beg < end; beg = (InputT)tss::strinc(beg))
;
for (at = setbeg; setbeg < setend; at = (InputT)tss::strinc(at))
if (*beg == *at)
return beg;
@ -359,9 +335,7 @@ done with it */
//--FIND_FIRST_OF: STRING (SAFE!!!)
template< class StrT >
StrT::size_type
find_first_of( const StrT& sin, StrT::const_iterator set )
template<class StrT> StrT::size_type find_first_of(const StrT& sin, StrT::const_iterator set)
{
// Point to beg of input
StrT::iterator beg = sin.begin();
@ -380,12 +354,7 @@ done with it */
//--FIND_FIRST_OF: STRING (NOT SAFE!!!)
template<class StrT>
StrT::size_type
find_first_of(
const StrT& sin,
StrT::const_iterator set,
StrT::size_type nPos,
StrT::size_type nCount )
StrT::size_type find_first_of(const StrT& sin, StrT::const_iterator set, StrT::size_type nPos, StrT::size_type nCount)
{
ASSERT( nPos < tss::strcount( sin.begin() );
@ -393,7 +362,8 @@ done with it */
{
ASSERT(nCount > tss::strcount(set));
StrT::const_iterator endset; // Get end of set
while ( nCount-- ) endset++;
while (nCount--)
endset++;
// Advance to nPos
StrT::const_iterator at = tss::strinc(sin.begin(), nPos);
@ -415,13 +385,11 @@ done with it */
//--FIND_LAST_OF: ITER
template<class InputT1, class InputT2>
InputT
find_last_of(
const InputT1 beg, const InputT1 end,
const InputT2 setbeg, const InputT2 setend )
InputT find_last_of(const InputT1 beg, const InputT1 end, const InputT2 setbeg, const InputT2 setend)
{
const InputT1 ans = end;
for ( ; beg < end; beg = tss::strinc( beg ) );
for (; beg < end; beg = tss::strinc(beg))
;
for (InputT2 at = setbeg; setbeg != setend; at = tss::strinc(at))
if (*beg == *at)
ans = beg;
@ -432,9 +400,7 @@ done with it */
//--FIND_LAST_OF: STRING (SAFE!!!)
template< class StrT >
StrT::size_type
find_last_of( const StrT& sin, StrT::const_iterator set )
template<class StrT> StrT::size_type find_last_of(const StrT& sin, StrT::const_iterator set)
{
StrT::size_type nResult = StrT::npos;
StrT::size_type N = 0;
@ -450,17 +416,11 @@ done with it */
template<class StrT>
StrT::size_type
find_last_of(
const StrT& sin,
StrT::const_iterator set,
StrT::size_type nStart,
StrT::size_type nCount )
StrT::size_type find_last_of(const StrT& sin, StrT::const_iterator set, StrT::size_type nStart, StrT::size_type nCount)
{
if (nCount > 0 && sin.size())
{
for ( StrT::const_iterator at = sin.begin()
+ (nStart < _Len ? nStart : _Len - 1); ; --_U)
for (StrT::const_iterator at = sin.begin() + (nStart < _Len ? nStart : _Len - 1);; --_U)
if (_Tr::find(set, nCount, *_U) != 0)
return (_U - _Ptr);
else if (_U == _Ptr)
@ -479,10 +439,7 @@ done with it */
{
// Preserves bit values when enlarging a type to a size_t
// Good for preventing sign extension
template< class E >
inline
size_t
char_to_size( E ch )
template<class E> inline size_t char_to_size(E ch)
{
// if this fails, 'ch' can't be cast to a
// size_t and preserve bit values
@ -498,15 +455,12 @@ done with it */
}
inline
size_t
char_to_size( char ch )
inline size_t char_to_size(char ch)
{
return (size_t)(unsigned char)ch;
}
}
}//tss::
} // namespace util
} // namespace tss
#endif //__NTMBS_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -91,12 +91,9 @@
//--PACKAGE Helpers
#define TSS_Package( pkg ) \
pkg::GetInstance() // Access "the" Package obj
#define TSS_Dependency( pkg ) \
TSS_Package( pkg ) // Declare a Package Depend.
#define TSS_Package(pkg) pkg::GetInstance() // Access "the" Package obj
#define TSS_Dependency(pkg) TSS_Package(pkg) // Declare a Package Depend.
#define TSS_BeginPackage(pkg) \
@ -107,7 +104,8 @@
#define TSS_EndPackage(pkg) \
};
} \
;
#define TSS_ImplementPackage(pkg) \
pkg& pkg::GetInstance() \
@ -123,21 +121,19 @@
}
//--STRINGTABLE Helperfs
#define TSS_GetString( pkg, id ) \
TSS_Package( pkg ).GetString( id ) // Access the Message String
#define TSS_GetString(pkg, id) TSS_Package(pkg).GetString(id) // Access the Message String
#define TSS_DECLARE_STRINGTABLE \
public: \
Messages::String \
GetString( \
Messages::ConstKeyRef id ) const { \
return m_messages.Get( id ); } \
Messages::String GetString(Messages::ConstKeyRef id) const \
{ \
return m_messages.Get(id); \
} \
void LoadStrings(); \
\
private: \
Messages m_messages // Decare a Stringtable
@ -145,30 +141,36 @@
#ifdef DEBUG
# define TSS_BeginStringtable(pkg) \
void pkg::LoadStrings() \
{ cDebug d( #pkg "::LoadStrings()" ); \
{ \
cDebug d(#pkg "::LoadStrings()"); \
d.TraceDebug("Loading strings for " #pkg " package.\n"); \
Messages::Pair astr[] = { // Define a Stringtable
#else // DEBUG
# define TSS_BeginStringtable(pkg) \
void pkg::LoadStrings() \
{ Messages::Pair astr[] = { // Define a Stringtable
{ \
Messages::Pair astr[] = { // Define a Stringtable
#endif // DEBUG
#define TSS_EndStringtable(pkg) \
}; m_messages.Put( \
astr, astr + countof(astr) ); } // End define Strintable
} \
; \
m_messages.Put(astr, astr + countof(astr)); \
} // End define Strintable
#define TSS_StringEntry( id, s ) \
Messages::Pair( id, s ) // Stringtable Entry
#define TSS_StringEntry(id, s) Messages::Pair(id, s) // Stringtable Entry
#define TSS_BeginStringIds(pns) \
namespace pns { \
enum { // Define String IDs
namespace pns \
{ \
enum \
{ // Define String IDs
#define TSS_EndStringIds(pns) \
}; } // End define String IDs
} \
; \
} // End define String IDs
//=============================================================================
@ -194,11 +196,9 @@
//
//
template< class CharT >
class cPackageBase_
template<class CharT> class cPackageBase_
{
public:
typedef cMessages_<int, CharT> Messages;
void LoadStrings()
@ -208,4 +208,3 @@ class cPackageBase_
#endif //__PACKAGE_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -249,7 +249,6 @@
# endif
/* XXX: COMP may now not resolve, because autoconf may
* detect GCC. This is done in the hopes that all
* COMP detections, and indeed both OS & COMP detechtions
@ -293,7 +292,9 @@
// complier detection
#define IS_KAI (COMP == COMP_KAI_GCC || COMP == COMP_KAI_SUNPRO || COMP == COMP_KAI_GLIBC || COMP == COMP_KAI_VISUALAGE || COMP == COMP_KAI_HPANSIC || COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA)
# define IS_KAI \
(COMP == COMP_KAI_GCC || COMP == COMP_KAI_SUNPRO || COMP == COMP_KAI_GLIBC || COMP == COMP_KAI_VISUALAGE || \
COMP == COMP_KAI_HPANSIC || COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA)
# define IS_MSVC (COMP == COMP_MSVC)
# define IS_SUNPRO (COMP == COMP_SUNPRO)
@ -306,9 +307,12 @@
# define IS_KAI_3_4 (IS_KAI && (COMP == COMP_KAI_IRIX || COMP == COMP_KAI_OSF1ALPHA || COMP == COMP_KAI_GLIBC))
// Used in twlocale
#define USE_STD_CPP_LOCALE_WORKAROUND (IS_SUNPRO || (IS_KAI && !IS_KAI_3_4)) // TODO:BAM -- name this something more general.
# define USE_STD_CPP_LOCALE_WORKAROUND \
(IS_SUNPRO || (IS_KAI && !IS_KAI_3_4)) // TODO:BAM -- name this something more general.
# define USE_CLIB_LOCALE IS_KAI || HAVE_GCC
#define USES_CLIB_DATE_FUNCTION ( USE_CLIB_LOCALE || IS_SUNPRO || IS_MSVC ) // if we use clib, can't use C++ time_put, and SUNPRO and MSVC add characters
# define USES_CLIB_DATE_FUNCTION \
(USE_CLIB_LOCALE || IS_SUNPRO || \
IS_MSVC) // if we use clib, can't use C++ time_put, and SUNPRO and MSVC add characters
//#define USE_CLIB_LOCALE (IS_ALPHA || IS_IRIX || (IS_KAI && !IS_KAI_3_4))
// Threading API
@ -320,7 +324,10 @@
# define WCHAR_IS_16_BITS IS_WIN32
# define WCHAR_IS_32_BITS IS_UNIX
# define WCHAR_REP_IS_UCS2 IS_WIN32
#define USES_MPOPEN IS_UNIX
// msystem+mpopen fail on Syllable, so use the libc equivalents until we figure out why.
// TODO: Figure out why.
# define USES_MPOPEN (IS_UNIX && !IS_SYLLABLE)
# define USES_MSYSTEM (IS_UNIX && !IS_SYLLABLE)
# define SUPPORTS_WCHART IS_WIN32 // TODO: Remove after getting new ver of KAI
# define USES_GLIBC ((COMP == COMP_KAI_GLIBC) || HAVE_GCC)
# define SUPPORTS_MEMBER_TEMPLATES (!IS_SUNPRO)
@ -372,7 +379,4 @@ typedef unsigned long ptr_size_type; // true for all of our current platforms
# endif
#endif // __PLATFORM_H

View File

@ -1,6 +1,6 @@
//
// The developer of the original code and/or files is Tripwire, Inc.
// Portions created by Tripwire, Inc. are copyright (C) 2000-2017 Tripwire,
// Portions created by Tripwire, Inc. are copyright (C) 2000-2018 Tripwire,
// Inc. Tripwire is a registered trademark of Tripwire, Inc. All rights
// reserved.
//
@ -149,4 +149,3 @@ void cRefCountObj::Delete() const
{
delete this;
}

Some files were not shown because too many files have changed in this diff Show More