1 | #! /bin/sh
|
---|
2 |
|
---|
3 | SERVER_BUILDOPTS="--quiet $TRUST --enable-xml-log --enable-debug --enable-network=server --prefix=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=${SH_LOCALHOST} --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock --with-database=mysql"; export SERVER_BUILDOPTS
|
---|
4 |
|
---|
5 | CLIENT_BUILDOPTS="--quiet $TRUST --prefix=$PW_DIR --localstatedir=$PW_DIR --enable-network=client --disable-mail --disable-external-scripts --enable-login-watch --enable-xml-log --enable-db-reload --with-logserver=localhost --with-config-file=REQ_FROM_SERVER$PW_DIR/testrc_2 --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-log-file=$PW_DIR/.samhain_log --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
|
---|
6 |
|
---|
7 | check_mysql_log () {
|
---|
8 | DATE="$1"
|
---|
9 |
|
---|
10 | rm -f test_log_db
|
---|
11 | echo "SELECT * FROM log WHERE entry_status = 'NEW' and log_time > '"${DATE}"';" | mysql --password=samhain -u samhain samhain >test_log_db
|
---|
12 | #
|
---|
13 | egrep "START.*Yule" test_log_db >/dev/null 2>&1
|
---|
14 | if [ $? -ne 0 ]; then
|
---|
15 | [ -z "$verbose" ] || log_msg_fail "Server start";
|
---|
16 | return 1
|
---|
17 | fi
|
---|
18 | egrep "NEW CLIENT" test_log_db >/dev/null 2>&1
|
---|
19 | if [ $? -ne 0 ]; then
|
---|
20 | [ -z "$verbose" ] || log_msg_fail "Client connect";
|
---|
21 | return 1
|
---|
22 | fi
|
---|
23 | egrep "Checking.*/bin" test_log_db >/dev/null 2>&1
|
---|
24 | if [ $? -ne 0 ]; then
|
---|
25 | [ -z "$verbose" ] || log_msg_fail "Client file check";
|
---|
26 | return 1
|
---|
27 | fi
|
---|
28 | egrep "EXIT.*Samhain" test_log_db >/dev/null 2>&1
|
---|
29 | if [ $? -ne 0 ]; then
|
---|
30 | [ -z "$verbose" ] || log_msg_fail "Client exit";
|
---|
31 | return 1
|
---|
32 | fi
|
---|
33 | egrep "EXIT.*Yule.*SIGTERM" test_log_db >/dev/null 2>&1
|
---|
34 | if [ $? -ne 0 ]; then
|
---|
35 | [ -z "$verbose" ] || log_msg_fail "Server exit";
|
---|
36 | return 1
|
---|
37 | fi
|
---|
38 | return 0
|
---|
39 | }
|
---|
40 |
|
---|
41 | MAXTEST=1; export MAXTEST
|
---|
42 |
|
---|
43 | testrun2c ()
|
---|
44 | {
|
---|
45 | log_start "RUN FULL CLIENT/SERVER W/MYSQL"
|
---|
46 | #
|
---|
47 | if [ -z "$doall" ]; then
|
---|
48 | log_skip 1 $MAXTEST 'Client/server w/mysql (or use --really-all)'
|
---|
49 | return 0
|
---|
50 | fi
|
---|
51 | if [ x"$1" = x ]; then
|
---|
52 | [ -z "$quiet" ] && log_msg_fail "Missing hostname"
|
---|
53 | fi
|
---|
54 | MYSQL=`find_path mysql`
|
---|
55 | if [ -z "$MYSQL" ]; then
|
---|
56 | log_skip 1 $MAXTEST "mysql not found";
|
---|
57 | return 1
|
---|
58 | else
|
---|
59 | TEST=`echo "DESCRIBE log;" | mysql --password=samhain -u samhain samhain 2>/dev/null`
|
---|
60 | if [ $? -ne 0 -o -z "$TEST" ]; then
|
---|
61 | log_skip 1 $MAXTEST "mysql not default setup"
|
---|
62 | return 1
|
---|
63 | fi
|
---|
64 | fi
|
---|
65 | #
|
---|
66 | SH_LOCALHOST=$1; export SH_LOCALHOST
|
---|
67 | #
|
---|
68 | DATE=`date '+%Y-%m-%d %T'`
|
---|
69 | #
|
---|
70 | testrun2a_internal
|
---|
71 | #
|
---|
72 | ORIGINAL="DatabaseSeverity=none"
|
---|
73 | REPLACEMENT="DatabaseSeverity=info"
|
---|
74 | ex $RCFILE <<EOF
|
---|
75 | :%s/$ORIGINAL/$REPLACEMENT/g
|
---|
76 | :wq
|
---|
77 | EOF
|
---|
78 | #
|
---|
79 | do_test_1_a
|
---|
80 | if [ $? -ne 0 ]; then
|
---|
81 | [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/mysql";
|
---|
82 | else
|
---|
83 | #
|
---|
84 | check_mysql_log "${DATE}"
|
---|
85 | if [ $? -ne 0 ]; then
|
---|
86 | [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client/server w/mysql";
|
---|
87 | else
|
---|
88 | [ -z "$quiet" ] && log_ok 1 ${MAXTEST} "Client/server w/mysql";
|
---|
89 | fi
|
---|
90 | fi
|
---|
91 | #
|
---|
92 | if [ -n "$cleanup" ]; then
|
---|
93 | rm -f ./rc.${SH_LOCALHOST}
|
---|
94 | rm -f ./file.${SH_LOCALHOST}
|
---|
95 | ALTHOST=`find_hostname`
|
---|
96 | rm -f "./file.${ALTHOST}"
|
---|
97 | rm -f "./rc.${ALTHOST}"
|
---|
98 | fi
|
---|
99 | #
|
---|
100 | log_end "RUN FULL CLIENT/SERVER W/MYSQL"
|
---|
101 | }
|
---|
102 |
|
---|