summaryrefslogblamecommitdiff
path: root/user/openldap/test079.patch
blob: a902ba8784df77cee18a38fb0634c149e876a6c7 (plain) (tree)































































































































































                                                                                                                                                                                  
From 0031b8ed342386960ab9d0cd1566196ba0e6ae42 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Wed, 1 Jun 2022 04:36:24 -0500
Subject: [PATCH] Tests: Use ldapsearch(1) correctly in test079

Before this change, ldapsearch(1) was not being called with the correct
parameter syntax.  This caused the test to fail on musl libc environments
where getopt(3) is more strict, with messages like:

Error: LDAP connection to remote LDAP server is not found (1)

The test.out file simply stated:

ldap_sasl_bind(SIMPLE): Can't contact LDAP server (-1)

Indeed, strace showed that the `-H` param was missed and we were trying
to connect to port 389:

connect(3, {sa_family=AF_INET6, sin6_port=htons(389), sin6_flowinfo=htonl(0), inet_pton(AF_INET6, "::1", &sin6_addr), sin6_scope_id=0}, 28) = -1 ECONNREFUSED (Connection refused)
---
 tests/scripts/test079-proxy-timeout | 40 ++++++++++++++---------------
 1 file changed, 20 insertions(+), 20 deletions(-)

diff --git a/tests/scripts/test079-proxy-timeout b/tests/scripts/test079-proxy-timeout
index 6a8e0c7a8..9ece4c1a1 100755
--- a/tests/scripts/test079-proxy-timeout
+++ b/tests/scripts/test079-proxy-timeout
@@ -139,10 +139,10 @@ fi
 
 echo "Checking that proxy has created connections towards backend (time_t now=`date +%s`)"
 
-$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 0 ; then
     echo "Error: LDAP connection to remote LDAP server is not found ($RC)"
@@ -150,10 +150,10 @@ if test $RC != 0 ; then
     exit $RC
 fi
 
-$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 0 ; then
     echo "Error: LDAP connection to remote LDAP server is not found ($RC)"
@@ -171,10 +171,10 @@ sleep `expr $CONN_EXPIRES - $NOW + 2`
 
 echo "Checking that proxy has closed expired connections towards the remote LDAP server (time_t now=`date +%s`)"
 
-$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 1 ; then
     echo "Error: LDAP connection to remote LDAP server was not closed"
@@ -182,10 +182,10 @@ if test $RC != 1 ; then
     exit $RC
 fi
 
-$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 1 ; then
     echo "Error: LDAP connection to remote LDAP server was not closed"
@@ -235,10 +235,10 @@ sleep 2
 
 echo "Checking that proxy has created connections towards backend (time_t now=`date +%s`)"
 
-$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 0 ; then
     echo "Error: LDAP connection to remote LDAP server is not found ($RC)"
@@ -246,10 +246,10 @@ if test $RC != 0 ; then
     exit $RC
 fi
 
-$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 0 ; then
     echo "Error: LDAP connection to remote LDAP server is not found ($RC)"
@@ -267,10 +267,10 @@ sleep `expr $CONN_EXPIRES - $NOW + 2`
 
 echo "Checking that proxy has closed expired connections towards the remote LDAP server (time_t now=`date +%s`)"
 
-$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 1 ; then
     echo "Error: LDAP connection to remote LDAP server was not closed"
@@ -278,10 +278,10 @@ if test $RC != 1 ; then
     exit $RC
 fi
 
-$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 3,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 1 ; then
     echo "Error: LDAP connection to remote LDAP server was not closed"
@@ -339,10 +339,10 @@ fi
 NOW=`date +%s`
 sleep `expr $CONN_EXPIRES - $NOW - 2`
 echo "Check that connection is still alive due to idle-timeout reset (time_t now=`date +%s`)"
-$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 0 ; then
     echo "Error: LDAP connection to remote LDAP server is not found ($RC)"
@@ -354,10 +354,10 @@ fi
 NOW=`date +%s`
 sleep `expr $CONN_EXPIRES - $NOW + 2`
 echo "Check that connection is closed after extended idle-timeout has passed (time_t now=`date +%s`)"
-$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL olmDbConnURI \
+$LDAPSEARCH -b "cn=Connections,cn=database 2,cn=databases,cn=monitor" -s one -LLL \
         -D "cn=Manager,dc=local,dc=com" \
         -H $URI2 \
-        -w $PASSWD  2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
+        -w $PASSWD olmDbConnURI 2>&1 | tee -a $TESTOUT | grep ldap://${LOCALHOST}:$PORT1 >/dev/null
 RC=$?
 if test $RC != 1 ; then
     echo "Error: LDAP connection to remote LDAP server was not closed"
-- 
2.32.0 (Apple Git-132)