if [ x$CLOUD_NAME = xAzuriteCloud ]; then #WAS Emulator
azurite &
- fi
+ fi
if [ x$CLOUD_NAME = xFakeAzureCloud ]; then #WAS Emulator
make -C build/scripts install-generic-cloud-as-was > /dev/null 2>&1
- fi
+ fi
#FIXME : if we find an existing Cloud, might be worth it to remove it here
grep $CLOUD_NAME $conf/bacula-sd.conf > /dev/null
fi
if grep $CLOUD_NAME $cfile > /dev/null; then
$bperl -e "extract_resource('$cfile', 'Cloud', '$CLOUD_NAME')" >> $conf/bacula-sd.conf
- else
+ else
echo "Missing cloud $CLOUD_NAME in $cfile. Contact R@D manager for more info."
exit 1
fi
fi
}
-require_tape_drive()
+require_tape_drive()
{
# tape not comptible with aligned
if test x$FORCE_ALIGNED = xyes; then
}
require_second_drive()
-{
+{
if test x${TAPE_DRIVE1} = x/dev/null ; then
echo "$JobName needs second drive, but has none."
exit 1
fi
}
-require_vtape()
+require_vtape()
{
# vtape not comptible with aligned
if test x$FORCE_ALIGNED = xyes; then
fi
}
-require_disk()
+require_disk()
{
# vtape not comptible with aligned
if test x$FORCE_ALIGNED = xyes; then
fi
}
-require_changer()
+require_changer()
{
# disk changer not comptible with cloud
if test x$FORCE_CLOUD = xyes; then
else
out="output"
fi
-}
+}
print_debug()
{
}
bscan_libdbi()
-{
+{
B=`echo $LIBDBI | sed 's/;//' | sed 's/;//g'`
B_D=`echo $B | awk '{print $3}'`
B_t=`echo $B | awk '{print $6}'`
B_p=`echo $B | awk '{print $9}'`
BSCANLIBDBI="${LIBDBI:+1}"
-
+
if test "$BSCANLIBDBI" = "1" ; then
BSCANLIBDBI="-D $B_D -h $B_t -t $B_p"
else
.status storage header
quit
EOF
- cat $tmp/stop.$$ | $bin/bconsole -c $conf/bconsole.conf -u 1
+ cat $tmp/stop.$$ | $bin/bconsole -c $conf/bconsole.conf -u 1 2>&1 > /dev/null
pid=`awk -F= '/pid=/ { print $2; exit; }' $tmp/stop.$$.out 2> /dev/null`
if [ "$pid" != "" ]; then
$bperl -e "check_openfile('/proc/$pid/fd')"
{
code=$1
msg=$2
-
+
print_debug $msg
stop_bacula
-
+
if test "$code" -gt "$ddestat" ; then
ddestat=$code
fi
#
check_dedup_enable()
{
- if [ "$FORCE_DEDUP" != "yes" ] ; then
+ if [ "$FORCE_DEDUP" != "yes" ] ; then
print_debug "This test is dedicated to DEDUP, set variable FORCE_DEDUP to 'yes'"
exit 0
fi
local filename="$1"
local hash_count=$2
local chunk_used=$3
-
+
grep "DDE:" ${filename} | grep "hash_count=${hash_count}" >/dev/null && \
grep "Containers:" ${filename} | grep "chunk_used=${chunk_used}" >/dev/null
}
check_size_interval()
{
# if mi == -1 then then ignore mi (idem for ma)
- mi=$1
+ mi=$1
value=$2
ma=$3
-
- test \( -1 -eq $mi -o $mi -le $value \) -a \( -1 -eq $ma -o $value -le $ma \)
+
+ test \( -1 -eq $mi -o $mi -le $value \) -a \( -1 -eq $ma -o $value -le $ma \)
}
check_restore_diff()
fi
rm -f /tmp/d$$
diff -ur ${src} ${tmp}/bacula-restores${src}
- else
+ else
$rscripts/diff.pl -notop -s ${src} -d ${tmp}/bacula-restores${src} 2>&1 >/dev/null
if test $? -ne 0; then
dstat=1
fi
rm -f /tmp/d$$
diff -ur ${bin} ${tmp}/bacula-restores${bin}
- else
+ else
$rscripts/diff.pl -notop -s ${bin} -d ${tmp}/bacula-restores${bin} 2>&1 >/dev/null
if test $? -ne 0; then
dstat=1
#
end_test()
{
- if [ x$notracedump != xyes ]; then
+ if [ x$notracedump != xyes ]; then
cat ${working}/bacula.*.traceback 2>/dev/null
cp -f ${working}/bacula.*.traceback ${dumps} 2>/dev/null
fi
then
echo "Try to upgrade the FileDaemon:\t"
wget -qO - "$WIN32_ADDR:8091/install"
- else
+ else
echo "Windows binaries not found, skiping upgrade"
fi
}
fi
}
-load_slot1()
+load_slot1()
{
# Get a tape from slot1
slot=`${scripts}/$MTX ${AUTOCHANGER} loaded 0 ${TAPE_DRIVE} $DRIVE1`
# Temp source directory so we don't mess up $src
tmpsrc=${tmpsrc:-"$cwd/tmp/build"}
-# Unit Tests source directory
+# Unit Tests source directory
unitsrc=${unitsrc:-"$cwd/src"}
estat=0
LD_LIBRARY_PATH=$bin:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH
-trap "{ estat=999; end_test; }" TERM
+trap "{ estat=999; end_test; }" TERM
start_test
-#export debug=1
+# export debug=1
cat << END_OF_DATA >${tmp}/bconcmds
@output /dev/null
messages
@$out ${tmp}/log.out
+status dir
quit
END_OF_DATA
run_bacula
+# now check if we have ldap-dir loaded
+if [ `grep ldap-dir ${tmp}/log.out | wc -l` -lt 1 ]
+then
+ echo "BPAM LDAP Plugin is not loaded, cannot perform the test!"
+ exit 1
+fi
+
# now we should test authentication
printf "Authentication test ... "
estat=0
-printf "root\nrootroot\nstatus dir\n" | ${bin}/bconsole -p > ${tmp}/log1.out
-if [ `grep Version: ${tmp}/log1.out | wc -l` -le 1 ]
+
+cat << END_OF_DATA >${tmp}/bconcmds
+@output /dev/null
+setdebug dir level=500 trace=1
+quit
+END_OF_DATA
+run_bconsole
+
+#check invalid login
+printf "admin\nadmin\nstatus dir\n" | ${bin}/bconsole -p -C ldaptest -c bconsole.auth-ldap-plugin.conf 2>&1 > ${tmp}/log1.out
+if [ `grep Version: ${tmp}/log1.out | wc -l` -gt 0 ]
then
printf "failed ... "
estat=1
+else
+ if [ `grep "LDAP Authentication Successfull" ${working}/*.trace | wc -l` -gt 0 ]
+ then
+ estat=2
+ fi
fi
+
+#check proper login
+printf "root\nrootroot\nstatus dir\n" | ${bin}/bconsole -p -C ldaptest -c bconsole.auth-ldap-plugin.conf 2>&1 > ${tmp}/log2.out
+if [ `grep Version: ${tmp}/log2.out | wc -l` -lt 1 ]
+then
+ printf "failed ... "
+ estat=3
+else
+ if [ `grep "LDAP Authentication Successfull" ${working}/*.trace | wc -l` -lt 1 ]
+ then
+ estat=4
+ fi
+fi
+
echo "done"
stop_bacula