source: trunk/test/testrun_2h.sh@ 572

Last change on this file since 572 was 561, checked in by katerina, 3 years ago

Fix for ticket #451 (signify-openbsd in client/server mode not working).

File size: 6.5 KB
RevLine 
[561]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
22LOGFILE="$PW_DIR/.samhain_log"; export LOGFILE
23RCFILE="$PW_DIR/testrc_2"; export RCFILE
24RCFILE_C="$PW_DIR/testrc_1.dyn"; export RCFILE_C
25
26SERVER_BUILDOPTS="--quiet $TRUST --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"; export SERVER_BUILDOPTS
27
28CLIENT_BUILDOPTS="--quiet $TRUST --enable-micro-stealth=137 --enable-debug --enable-network=client --enable-srp --prefix=$PW_DIR --with-tmp-dir=$PW_DIR --localstatedir=$PW_DIR --with-config-file=REQ_FROM_SERVER${RCFILE_C} --with-data-file=REQ_FROM_SERVER$PW_DIR/.samhain_file --with-logserver=localhost --with-log-file=$LOGFILE --with-pid-file=$PW_DIR/.samhain_lock"; export CLIENT_BUILDOPTS
29
30testrun2h_internal ()
31{
32 SIGNIFY="$1"
33
34 [ -z "$verbose" ] || {
35 echo;
36 echo Working directory: $PW_DIR; echo MAKE is $MAKE; echo SIGNIFY is $SIGNIFY;
37 echo;
38 }
39
40 [ -z "$verbose" ] || { echo; echo "${S}Building client and server${E}"; echo; }
41
42 if test -r "Makefile"; then
43 $MAKE distclean
44 fi
45
46 #
47 # Bootstrapping
48 #
49 ${TOP_SRCDIR}/configure >/dev/null 2>/dev/null
50 if test x$? = x0; then
51 [ -z "$verbose" ] || log_msg_ok "configure (bootstrap)...";
52 $MAKE > /dev/null 2>&1
53 if test x$? = x0; then
54 [ -z "$verbose" ] || log_msg_ok "make (bootstrap)...";
55 else
56 [ -z "$quiet" ] && log_msg_fail "make (bootstrap)...";
57 return 1
58 fi
59
60 else
61 [ -z "$quiet" ] && log_msg_fail "configure (bootstrap)...";
62 return 1
63 fi
64
65 ${TOP_SRCDIR}/configure --with-signify=${SIGNIFY} --with-checksum=yes ${CLIENT_BUILDOPTS} >/dev/null 2>&1
66
67 if test x$? = x0; then
68 [ -z "$verbose" ] || log_msg_ok "configure...";
69 $MAKE > /dev/null 2>>test_log
70 if test x$? = x0; then
71 [ -z "$verbose" ] || log_msg_ok "make...";
72 else
73 [ -z "$quiet" ] && log_msg_fail "make...";
74 return 1
75 fi
76 else
77 [ -z "$quiet" ] && log_msg_fail "configure...";
78 return 1
79 fi
80
81 cp ${SCRIPTDIR}/testrc_1i.dyn "$RCFILE_C"
82 if test x$? = x0; then
83 [ -z "$verbose" ] || log_msg_ok "copy signify signed config file...";
84 else
85 [ -z "$quiet" ] && log_msg_fail "copy signify signed config file...";
86 return 1
87 fi
88
89 # save binary and build server
90
91 cp samhain samhain.build || return 1
92 $MAKE clean >/dev/null || return 1
93
94 ${TOP_SRCDIR}/configure ${SERVER_BUILDOPTS}
95
96 if test x$? = x0; then
97 [ -z "$verbose" ] || log_msg_ok "configure...";
98 $MAKE > /dev/null 2>>test_log
99 if test x$? = x0; then
100 [ -z "$verbose" ] || log_msg_ok "make...";
101 else
102 [ -z "$quiet" ] && log_msg_fail "make...";
103 return 1
104 fi
105
106 else
107 [ -z "$quiet" ] && log_msg_fail "configure...";
108 return 1
109 fi
110
111
112 #####################################################################
113 #
114 #
115 rm -f ./.samhain_file
116 rm -f ./.samhain_log
117 rm -f ./.samhain_lock
118 rm -f ./rc.${SH_LOCALHOST}
119 rm -f ./file.${SH_LOCALHOST}
120
121 cp ${SCRIPTDIR}/testrc_2.in testrc_2
122
123 ./samhain.build -t init -p none
124
125 if test x$? = x0; then
126 [ -z "$verbose" ] || log_msg_ok "init...";
127 else
128 [ -z "$quiet" ] && log_msg_fail "init...";
129 return 1
130 fi
131
132 cp ${SCRIPTDIR}/test1i_file.sig $PW_DIR/.samhain_file
133 if test x$? = x0; then
134 [ -z "$verbose" ] || log_msg_ok "copy signed database file...";
135 else
136 [ -z "$quiet" ] && log_msg_fail "copy signed database file...";
137 return 1
138 fi
139
140 # Create a password
141
142 SHPW=`./yule -G`
143 if test x"$SHPW" = x; then
144 [ -z "$quiet" ] && log_msg_fail "password not generated -- aborting"
145 return 1
146 fi
147
148 # Set in client
149
150 ./samhain_setpwd samhain.build new $SHPW >/dev/null
151
152 if test x$? = x0; then
153 [ -z "$verbose" ] || log_msg_ok "./samhain_setpwd samhain.build new $SHPW";
154 else
155 [ -z "$quiet" ] && log_msg_fail "./samhain_setpwd samhain.build new $SHPW";
156 return 1
157 fi
158
159 mv samhain.build.new samhain.new || return 1
160
161 rm -f ./.samhain_log*
162 rm -f ./.samhain_lock
163
164 SHCLT=`./yule -P $SHPW`
165
166 if test x$? = x0; then
167 [ -z "$verbose" ] || log_msg_ok "yule -P $SHPW";
168 else
169 [ -z "$quiet" ] && log_msg_fail "yule -P $SHPW";
170 return 1
171 fi
172
173 SHCLT1=`echo "${SHCLT}" | sed s%HOSTNAME%${SH_LOCALHOST}%`
174 AHOST=`find_hostname`
175 SHCLT2=`echo "${SHCLT}" | sed s%HOSTNAME%${AHOST}%`
176
177
178 echo $SHCLT1 >> testrc_2
179 echo $SHCLT2 >> testrc_2
180
181
182 cp "${RCFILE_C}" ./rc.${SH_LOCALHOST}
183 mv $PW_DIR/.samhain_file ./file.${SH_LOCALHOST}
184
185 ALTHOST=`find_hostname`
186 cp "${RCFILE_C}" "./rc.${ALTHOST}"
187 cp ./file.${SH_LOCALHOST} "./file.${ALTHOST}" 2>/dev/null
188}
189
190MAXTEST=1; export MAXTEST
191
192testrun2h ()
193{
194 log_start "RUN FULL CLIENT/SERVER W/SIGNIFY";
195 #
196 if [ x"$1" = x ]; then
197 [ -z "$quiet" ] && log_msg_fail "Missing hostname"
198 fi
199 #
200 SIGNIFY=`find_path signify-openbsd`
201 if [ -z "$SIGNIFY" ]; then
202 SIGNIFY=`find_path signify`
203 fi
204 if [ -z "$SIGNIFY" ]; then
205 log_skip 1 $MAXTEST 'signify not found in $PATH'
206 fi
207
208 SH_LOCALHOST=$1; export SH_LOCALHOST
209
210 testrun2h_internal "${SIGNIFY}"
211
212 SAVE_VALGRIND="${VALGRIND}"; VALGRIND=''; export VALGRIND
213 do_test_1_a
214 out=$?
215 VALGRIND="${SAVE_VALGRIND}"; export VALGRIND
216
217 if [ $out -eq 0 ]; then
218 [ -z "$quiet" ] && log_ok 1 ${MAXTEST} "Client download+logging w/signify";
219 else
220 [ -z "$quiet" ] && log_fail 1 ${MAXTEST} "Client download+logging w/signify";
221 fi
222
223 if [ -n "$cleanup" ]; then
224 rm -f ./rc.${SH_LOCALHOST}
225 rm -f ./file.${SH_LOCALHOST}
226 ALTHOST=`find_hostname`
227 rm -f "./file.${ALTHOST}"
228 rm -f "./rc.${ALTHOST}"
229 fi
230
231 log_end "RUN FULL CLIENT/SERVER W/SIGNIFY"
232}
233
Note: See TracBrowser for help on using the repository browser.