SEARCH=0
SEARCH=`expr $SEARCH + 1`
+sleep $SLEEP0
echo "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(objectClass=dynamicObject)' '*' entryTtl \
fi
SEARCH=`expr $SEARCH + 1`
+sleep $SLEEP0
echo "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(objectClass=dynamicObject)' '*' entryTtl \
fi
SEARCH=`expr $SEARCH + 1`
+sleep $SLEEP0
echo "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(objectClass=dynamicObject)' '*' entryTtl \
fi
SEARCH=`expr $SEARCH + 1`
+sleep $SLEEP0
echo "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(objectClass=dynamicObject)' '*' entryTtl \
fi
SEARCH=`expr $SEARCH + 1`
+sleep $SLEEP0
echo "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(objectClass=dynamicObject)' '*' entryTtl \
sleep $SLEEP
SEARCH=`expr $SEARCH + 1`
+sleep $SLEEP0
echo "# [$SEARCH] Searching the dynamic portion of the database..." >> $SEARCHOUT
$LDAPSEARCH -S "" -b "$BASEDN" -h $LOCALHOST -p $PORT1 \
'(objectClass=dynamicObject)' '*' entryTtl \
LDIF=$DDSOUT
+# dds removes entryTtl and re-adds it, changing the order of attributes
echo "Filtering ldapsearch results..."
-$LDIFFILTER < $SEARCHOUT > $SEARCHFLT
+$LDIFFILTER -s a < $SEARCHOUT > $SEARCHFLT
+grep -i -v -e '^entryttl: ' < $SEARCHFLT > $SEARCHFLT2
echo "Filtering original ldif used to create database..."
-$LDIFFILTER < $LDIF > $LDIFFLT
+$LDIFFILTER -s a < $LDIF > $LDIFFLT
+grep -i -v -e '^entryttl: ' < $LDIFFLT > $LDIFFLT2
echo "Comparing filter output..."
-$CMP $SEARCHFLT $LDIFFLT > $CMPOUT
+$CMP $SEARCHFLT2 $LDIFFLT2 > $CMPOUT
if test $? != 0 ; then
echo "Comparison failed"
exit 1
fi
+echo "Listing entryTtl values from ldapsearch results..."
+grep -i -e '^entryttl: ' < $SEARCHFLT | awk '{ print $2 }' > $SEARCHFLT2
+echo "Listing entryTtl values from original ldif used to create database..."
+grep -i -e '^entryttl: ' < $LDIFFLT | awk '{ print $2 }' > $LDIFFLT2
+
+if ! type paste >/dev/null 2>&1; then
+ echo "Cannot find 'paste' command, skipping entryTtl checks..."
+else
+ echo "Checking entryTtl appears to decrease with time..."
+ paste $SEARCHFLT2 $LDIFFLT2 | while read resultTTL savedTTL; do
+ if [ `expr $savedTTL - $resultTTL` -lt $SLEEP0 ]; then
+ echo "TTL has not reduced accordingly"
+ exit 1
+ fi
+ done
+fi
+
echo ">>>>> Test succeeded"
test $KILLSERVERS != no && wait