Skip to content

Commit

Permalink
add new LDAPSEARCH_PARAMS parameter (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidcoutadeur committed Jul 11, 2023
1 parent 48f76c1 commit f940c1c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
7 changes: 4 additions & 3 deletions slapd-cli
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ SLAPCAT_PARAMS="-o ldif-wrap=no"
SLAPINDEX_BIN="$SLAPD_PATH/sbin/slapindex"
SLAPTEST_BIN="$SLAPD_PATH/sbin/slaptest"
LDAPSEARCH_BIN="${SLAPD_PATH}/bin/ldapsearch"
LDAPSEARCH_PARAMS=""

# Backup
BACKUP_AT_SHUTDOWN="1"
Expand Down Expand Up @@ -778,7 +779,7 @@ slapd_version() {

# test if SLAPD_SERVICES contains an ldapi:/// listening port
if echo "${SLAPD_SERVICES}" | grep -q 'ldapi:' ; then
VERSION=$( ${LDAPSEARCH_BIN} -Y EXTERNAL -H "${HOST}" -b "${BASE}" -s "${SCOPE}" -LLL "${ATTR}" 2>/dev/null| grep "${ATTR}" )
VERSION=$( ${LDAPSEARCH_BIN} -Y EXTERNAL -H "${HOST}" -b "${BASE}" -s "${SCOPE}" ${LDAPSEARCH_PARAMS} -LLL "${ATTR}" 2>/dev/null| grep "${ATTR}" )
fi

if [ "${VERSION}" = "" ] ; then
Expand Down Expand Up @@ -1353,7 +1354,7 @@ check_sync() {
PBASEDN=$RETVAL
echo "Checking contextCSN for suffix ${SUFFIX} on remote host ${PHOST}"
# Get remote provider contextCSN (one contextCSN per line)
CONTEXTCSN=$( ${LDAPSEARCH_BIN} -x -H "${PHOST}" -D "${PBINDDN}" -w "${PBINDPW}" -b "${PBASEDN}" -o nettimeout=5 -s base contextCSN -LLL 2>/dev/null )
CONTEXTCSN=$( ${LDAPSEARCH_BIN} -x -H "${PHOST}" -D "${PBINDDN}" -w "${PBINDPW}" -b "${PBASEDN}" -o nettimeout=5 -s base ${LDAPSEARCH_PARAMS} contextCSN -LLL 2>/dev/null )

# Checking status of previous command
if [ $? -ne 0 ]; then
Expand All @@ -1364,7 +1365,7 @@ check_sync() {
CONTEXTCSN=$( echo "$CONTEXTCSN" | grep contextCSN | sed -e 's/^contextCSN: //i' )

# get local contextCSN
localContextCSN=$( ${LDAPSEARCH_BIN} -x -H "${LOCAL_URL}" -D "${PBINDDN}" -w "${PBINDPW}" -b "${PBASEDN}" -o nettimeout=5 -s base contextCSN -LLL 2>/dev/null | grep 'contextCSN' | sed -e 's/^contextCSN: //' )
localContextCSN=$( ${LDAPSEARCH_BIN} -x -H "${LOCAL_URL}" -D "${PBINDDN}" -w "${PBINDPW}" -b "${PBASEDN}" -o nettimeout=5 -s base ${LDAPSEARCH_PARAMS} contextCSN -LLL 2>/dev/null | grep 'contextCSN' | sed -e 's/^contextCSN: //' )

# compare contextCSN values
# for each provider contextCSN
Expand Down
1 change: 1 addition & 0 deletions slapd-cli.conf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ SLAPCAT_PARAMS="-o ldif-wrap=no"
SLAPINDEX_BIN="$SLAPD_PATH/sbin/slapindex"
SLAPTEST_BIN="$SLAPD_PATH/sbin/slaptest"
LDAPSEARCH_BIN="${SLAPD_PATH}/bin/ldapsearch"
LDAPSEARCH_PARAMS=""

# Other options for slapd launch
SLAPD_USER=""
Expand Down

0 comments on commit f940c1c

Please sign in to comment.