getconf method ldapsearch
getconf passwordfile
getconf binddn
+getconf ldaphost
+getconf tls yes
+
+if [ $tls = 'yes' ]
+ URLBASE="ldaps"
+else
+ URLBASE="ldap"
+fi
status="ok"
fi
if [ "$method" == "slapcat" ]; then
- execstr="$SLAPCAT -f $conf -b $dbsuffix"
+ if [ "$compress" == "yes" ]; then
+ execstr="$SLAPCAT -f $conf -b $dbsuffix | $GZIP"
+ else
+ execstr="$SLAPCAT -f $conf -b $dbsuffix"
+ fi
debug "$execstr"
else
- execstr="$LDAPSEARCH -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile"
+ if [ "$compress" == "yes" ]; then
+ if [ -n "$ldaphost" ]
+ execstr="$LDAPSEARCH -H $URLBASE://$ldaphost -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile | $GZIP"
+ else
+ execstr="$LDAPSEARCH -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile | $GZIP"
+ fi
+ else
+ if [ -n "$ldaphost" ]
+ execstr="$LDAPSEARCH -H $URLBASE://$ldaphost -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile"
+ else
+ execstr="$LDAPSEARCH -x -L -b ""$dbsuffix"" -D ""$binddn"" -y $passwordfile"
+ fi
+ fi
[ -f "$passwordfile" ] || fatal "Password file $passwordfile not found. When method is set to ldapsearch, you must also specify a password file."
debug "$execstr"
fi
fatal "Couldn't create ldif dump file: $dumpdir/$dbsuffix.ldif"
fi
- output=`$execstr > $dumpdir/$dbsuffix.ldif`
+ if [ "$compress" == "yes" ]; then
+ output=`$execstr > $dumpdir/$dbsuffix.ldif.gz`
+ else
+ output=`$execstr > $dumpdir/$dbsuffix.ldif`
+ fi
code=$?
if [ "$code" == "0" ]; then
debug $output
warning $output
warning "Failed ldif export of $dbsuffix"
fi
- if [ "$compress" == "yes" ]; then
- output=`$GZIP -f "$dumpdir/$dbsuffix.ldif" 2>&1`
- debug $output
- fi
if [ "$restart" == "yes" ]; then
debug "Starting ldap server..."