1 | #! /bin/sh
|
---|
2 |
|
---|
3 | #
|
---|
4 | # Copyright Rainer Wichmann (2006)
|
---|
5 | #
|
---|
6 | # License Information:
|
---|
7 | # This program is free software; you can redistribute it and/or modify
|
---|
8 | # it under the terms of the GNU General Public License as published by
|
---|
9 | # the Free Software Foundation; either version 2 of the License, or
|
---|
10 | # (at your option) any later version.
|
---|
11 | #
|
---|
12 | # This program is distributed in the hope that it will be useful,
|
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | # GNU General Public License for more details.
|
---|
16 | #
|
---|
17 | # You should have received a copy of the GNU General Public License
|
---|
18 | # along with this program; if not, write to the Free Software
|
---|
19 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
20 | #
|
---|
21 |
|
---|
22 | BUILDOPTS="--quiet $TRUST --enable-debug --enable-xml-log --enable-login-watch --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=$RCFILE --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock --with-data-file=$PW_DIR/.samhain_file"
|
---|
23 | export BUILDOPTS
|
---|
24 |
|
---|
25 | MAXTEST=1; export MAXTEST
|
---|
26 |
|
---|
27 | testrun_deltadb ()
|
---|
28 | {
|
---|
29 | tcount=1
|
---|
30 |
|
---|
31 | if test -r "Makefile"; then
|
---|
32 | $MAKE distclean >/dev/null
|
---|
33 | fi
|
---|
34 |
|
---|
35 | ${TOP_SRCDIR}/configure ${BUILDOPTS}
|
---|
36 |
|
---|
37 | if test x$? = x0; then
|
---|
38 | [ -z "$verbose" ] || log_msg_ok "configure...";
|
---|
39 | $MAKE >/dev/null 2>>test_log
|
---|
40 | if test x$? = x0; then
|
---|
41 | [ -z "$verbose" ] || log_msg_ok "make...";
|
---|
42 | else
|
---|
43 | [ -z "$quiet" ] && log_msg_fail "make...";
|
---|
44 | return 1
|
---|
45 | fi
|
---|
46 |
|
---|
47 | else
|
---|
48 | [ -z "$quiet" ] && log_msg_fail "configure...";
|
---|
49 | return 1
|
---|
50 | fi
|
---|
51 |
|
---|
52 | prep_init
|
---|
53 | check_err $? ${tcount}; errval=$?
|
---|
54 |
|
---|
55 | if [ $errval -eq 0 ]; then
|
---|
56 | prep_testdata
|
---|
57 | check_err $? ${tcount}; errval=$?
|
---|
58 | fi
|
---|
59 | if [ $errval -eq 0 ]; then
|
---|
60 | prep_testpolicy 1
|
---|
61 | check_err $? ${tcount}; errval=$?
|
---|
62 | fi
|
---|
63 |
|
---|
64 | rm "${BASE}/a/a/b/x"
|
---|
65 | rm -f file.*.*-*-*-*-*
|
---|
66 |
|
---|
67 | ./samhain --create-database=./tmp_list_file
|
---|
68 |
|
---|
69 | check_err $? ${tcount}; errval=$?
|
---|
70 | if [ $errval -eq 0 ]; then
|
---|
71 | num=$( ./samhain -a -d file.*.*-*-*-*-* | grep "1970-01-01T00:00:00" >/dev/null | wc -l )
|
---|
72 | if [ $num -ne 1 ]; then
|
---|
73 | [ -z "$verbose" ] || log_msg_ok "list...";
|
---|
74 | else
|
---|
75 | [ -z "$quiet" ] && log_msg_fail "list...";
|
---|
76 | log_fail ${tcount} ${MAXTEST};
|
---|
77 | fi
|
---|
78 | else
|
---|
79 | [ -z "$quiet" ] && log_msg_fail "create...";
|
---|
80 | log_fail ${tcount} ${MAXTEST};
|
---|
81 | fi
|
---|
82 |
|
---|
83 | if [ $errval -eq 0 ]; then
|
---|
84 | ./samhain --verify-database file.*.*-*-*-*-*
|
---|
85 | fi
|
---|
86 |
|
---|
87 | check_err $? ${tcount}; errval=$?
|
---|
88 | if [ $errval -eq 0 ]; then
|
---|
89 | echo "o_O" > "${BASE}/a/a/b/y"
|
---|
90 | ./samhain --verify-database file.*.*-*-*-*-*
|
---|
91 | fi
|
---|
92 | if [ $? -eq 0 ]; then
|
---|
93 | [ -z "$quiet" ] && log_msg_fail "detect modify...";
|
---|
94 | check_err 1 ${tcount}; errval=1
|
---|
95 | fi
|
---|
96 |
|
---|
97 | if [ $errval -eq 0 ]; then
|
---|
98 | [ -z "$quiet" ] && log_ok ${tcount} ${MAXTEST};
|
---|
99 | fi
|
---|
100 |
|
---|
101 | [ -z "$cleanup" ] || rm -f file.*.*-*-*-*-*
|
---|
102 | return 0
|
---|
103 | }
|
---|
104 |
|
---|
105 | testrun1g ()
|
---|
106 | {
|
---|
107 | log_start "RUN CL Create DeltaDB"
|
---|
108 |
|
---|
109 | testrun_deltadb
|
---|
110 |
|
---|
111 | log_end "RUN CL Create DeltaDB"
|
---|
112 | return 0
|
---|
113 | }
|
---|
114 |
|
---|