X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=tests%2Fscripts%2Ftest035-meta;h=895644f8737847138abb339bb974f32134bf6d46;hb=31b5ff36610506942dc4662d2d914f0618cbbf85;hp=3d427aa31ed27e42fc3868b450336eed907792c7;hpb=838421f416d5e14a71382df71843f327b6aea31a;p=openldap diff --git a/tests/scripts/test035-meta b/tests/scripts/test035-meta index 3d427aa31e..895644f873 100755 --- a/tests/scripts/test035-meta +++ b/tests/scripts/test035-meta @@ -37,6 +37,8 @@ if test $WAIT != 0 ; then fi KILLPIDS="$PID" +sleep 1 + echo "Using ldapsearch to check that slapd is running..." for i in 0 1 2 3 4 5; do $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT1 \ @@ -74,6 +76,8 @@ if test $WAIT != 0 ; then fi KILLPIDS="$KILLPIDS $PID" +sleep 1 + echo "Using ldapsearch to check that slapd is running..." for i in 0 1 2 3 4 5; do $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT2 \ @@ -111,6 +115,8 @@ if test $WAIT != 0 ; then fi KILLPIDS="$KILLPIDS $PID" +sleep 1 + echo "Using ldapsearch to check that slapd is running..." for i in 0 1 2 3 4 5; do $LDAPSEARCH -s base -b "$MONITOR" -h $LOCALHOST -p $PORT3 \ @@ -135,11 +141,25 @@ echo "Searching base=\"$BASEDN\"..." echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" >> $SEARCHOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Search failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Search failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Search failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac # # Do some modifications @@ -231,21 +251,49 @@ changetype: delete EOMODS RC=$? -if test $RC != 0 ; then - echo "Modify failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Modify failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Modify failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac echo "Searching base=\"$BASEDN\"..." echo "# searching base=\"$BASEDN\"..." >> $SEARCHOUT $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" >> $SEARCHOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Search failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Search failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Search failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac BASEDN="o=Example,c=US" echo " base=\"$BASEDN\"..." @@ -253,11 +301,25 @@ echo "# base=\"$BASEDN\"..." >> $SEARCHOUT $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" -M "$FILTER" '*' ref \ >> $SEARCHOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Search failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Search failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Search failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac BASEDN="o=Example,c=US" FILTER="(seeAlso=cn=all staff,ou=Groups,$BASEDN)" @@ -270,11 +332,25 @@ echo "# base=\"$BASEDN\"..." >> $SEARCHOUT $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" "$FILTER" seeAlso \ >> $SEARCHOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Search failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Search failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Search failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac FILTER="(uid=example)" echo "Searching filter=\"$FILTER\"" @@ -286,11 +362,25 @@ echo "# base=\"$BASEDN\"..." >> $SEARCHOUT $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" "$FILTER" uid \ >> $SEARCHOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Search failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Search failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Search failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac FILTER="(member=cn=Another Added Group,ou=Groups,$BASEDN)" echo "Searching filter=\"$FILTER\"" @@ -302,11 +392,25 @@ echo "# base=\"$BASEDN\"..." >> $SEARCHOUT $LDAPSEARCH -S "" -h $LOCALHOST -p $PORT3 -b "$BASEDN" "$FILTER" member \ >> $SEARCHOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Search failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Search failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Search failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac echo "Filtering ldapsearch results..." . $LDIFFILTER < $SEARCHOUT > $SEARCHFLT @@ -327,66 +431,165 @@ $LDAPPASSWD -h $LOCALHOST -p $PORT3 -D "cn=Manager,$BASEDN" -w $PASSWD \ -s $PASSWD "cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN" \ >> $TESTOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Passwd ExOp failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Passwd ExOp failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Passwd ExOp failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac echo "Binding with newly changed password to database \"$BASEDN\"..." $LDAPWHOAMI -h $LOCALHOST -p $PORT3 \ -D "cn=Ursula Hampster,ou=Alumni Association,ou=People,$BASEDN" \ -w $PASSWD >> $TESTOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "WhoAmI failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "WhoAmI failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + ;; + *) + echo "WhoAmI failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac echo "Binding as newly added user to database \"$BASEDN\"..." $LDAPWHOAMI -h $LOCALHOST -p $PORT3 \ -D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \ -w $PASSWD >> $TESTOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "WhoAmI failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "WhoAmI failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + ;; + *) + echo "WhoAmI failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac echo "Changing password to database \"$BASEDN\"..." $LDAPPASSWD -h $LOCALHOST -p $PORT3 -D "cn=Manager,$BASEDN" -w $PASSWD \ -s meta "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \ >> $TESTOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "Passwd ExOp failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "Passwd ExOp failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit 0 + ;; + *) + echo "Passwd ExOp failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac echo "Binding with newly changed password to database \"$BASEDN\"..." $LDAPWHOAMI -h $LOCALHOST -p $PORT3 \ -D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \ -w meta >> $TESTOUT 2>&1 RC=$? -if test $RC != 0 ; then - echo "WhoAmI failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 0 ; then +# echo "WhoAmI failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + ;; + *) + echo "WhoAmI failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac + +echo "Binding with incorrect password to database \"$BASEDN\"..." +$LDAPWHOAMI -h $LOCALHOST -p $PORT3 \ + -D "cn=Added User,ou=Same as above,ou=Meta,$BASEDN" \ + -w bogus >> $TESTOUT 2>&1 +RC=$? +#if test $RC != 0 ; then +# echo "WhoAmI failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 0) + echo "WhoAmI should have failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit -1 + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + ;; + *) + ;; +esac echo "Comparing to database \"$BASEDN\"..." $LDAPCOMPARE -h $LOCALHOST -p $PORT3 \ "cn=Another Added Group,ou=Groups,$BASEDN" \ "member:cn=Added Group,ou=Groups,$BASEDN" >> $TESTOUT 2>&1 RC=$? -if test $RC != 6 ; then - echo "Compare failed ($RC)!" - test $KILLSERVERS != no && kill -HUP $KILLPIDS - exit $RC -fi +#if test $RC != 6 ; then +# echo "Compare failed ($RC)!" +# test $KILLSERVERS != no && kill -HUP $KILLPIDS +# exit $RC +#fi +case $RC in + 6) + ;; + 51) + echo "### Hit LDAP_BUSY problem; you may want to re-run the test" + ;; + *) + echo "Compare failed ($RC)!" + test $KILLSERVERS != no && kill -HUP $KILLPIDS + exit $RC + ;; +esac test $KILLSERVERS != no && kill -HUP $KILLPIDS