"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/setup_slapd.sh" between
nss-pam-ldapd-0.9.11.tar.gz and nss-pam-ldapd-0.9.12.tar.gz

About: nss-pam-ldapd is a Name Service Switch (NSS) module and Pluggable Authentication Module (PAM) that allows your LDAP server to provide user account, group, host name, alias, netgroup, and basically any other information that you would normally get from /etc flat files or NIS. It also allows you to do authentication to an LDAP server.

setup_slapd.sh  (nss-pam-ldapd-0.9.11):setup_slapd.sh  (nss-pam-ldapd-0.9.12)
#!/bin/sh #!/bin/sh
# run_slapd.sh - configure and run a slapd instance # run_slapd.sh - configure and run a slapd instance
# #
# Copyright (C) 2013 Arthur de Jong # Copyright (C) 2013-2021 Arthur de Jong
# #
# This library is free software; you can redistribute it and/or # This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public # modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either # License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at your option) any later version. # version 2.1 of the License, or (at your option) any later version.
# #
# This library is distributed in the hope that it will be useful, # This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details. # Lesser General Public License for more details.
skipping to change at line 66 skipping to change at line 66
# check whether our slapd is running # check whether our slapd is running
our_slapd_is_running() { our_slapd_is_running() {
if [ -f "$basedir/slapd.pid" ] && kill -s 0 `cat "$basedir/slapd.pid"` > /dev/ null 2>&1 if [ -f "$basedir/slapd.pid" ] && kill -s 0 `cat "$basedir/slapd.pid"` > /dev/ null 2>&1
then then
return 0 # is running return 0 # is running
fi fi
return 1 return 1
} }
# the directory where to construct the environment # the directory where to construct the environment
if test $# -ne 2 if test $# -lt 2
then then
usage usage
exit 1 exit 1
fi fi
basedir="$1" basedir="$1"
# gather configuration information # gather configuration information
user="$( (getent passwd openldap || getent passwd ldap || getent passwd nobody) | sed 's/:.*//')" user="$( (getent passwd openldap || getent passwd ldap || getent passwd nobody) | sed 's/:.*//')"
group="$( (getent group openldap || getent group ldap || getent group nogroup) | sed 's/:.*//')" group="$( (getent group openldap || getent group ldap || getent group nogroup) | sed 's/:.*//')"
skipping to change at line 97 skipping to change at line 97
echo "FAILED: already exists and is not empty or old environment" echo "FAILED: already exists and is not empty or old environment"
exit 1 exit 1
;; ;;
esac esac
rm -rf "$basedir" rm -rf "$basedir"
mkdir -p "$basedir/slapd.d" "$basedir/ldapdb" || (echo " FAILED"; exit 1) mkdir -p "$basedir/slapd.d" "$basedir/ldapdb" || (echo " FAILED"; exit 1)
echo " done." echo " done."
echo "Loading cn=config..." echo "Loading cn=config..."
tmpldif=`mktemp -t slapadd.XXXXXX` tmpldif=`mktemp -t slapadd.XXXXXX`
sed "s|@BASEDIR@|$basedir|g" < "$srcdir/config.ldif" > "$tmpldif" sed "s|@BASEDIR@|$basedir|g" < "$srcdir/config.ldif" > "$tmpldif"
if [ -f /etc/ldap/schema/ppolicy.ldif ]
then
sed -i "s|#PPOLICY#||g" "$tmpldif"
fi
slapadd -v -F "$basedir/slapd.d" -b "cn=config" -l "$tmpldif" || (echo " FAI LED"; exit 1) slapadd -v -F "$basedir/slapd.d" -b "cn=config" -l "$tmpldif" || (echo " FAI LED"; exit 1)
rm -f "$tmpldif" rm -f "$tmpldif"
echo "Loading dc=test,dc=tld..." echo "Loading dc=test,dc=tld..."
slapadd -F "$basedir/slapd.d" -b "dc=test,dc=tld" -l "$srcdir/test.ldif" || (echo " FAILED"; exit 1) slapadd -F "$basedir/slapd.d" -b "dc=test,dc=tld" -l "$srcdir/test.ldif" || (echo " FAILED"; exit 1)
echo -n "Fixing permissions..." echo -n "Fixing permissions..."
chown -R "$user":"$group" "$basedir" || (echo " FAILED"; exit 1) chown -R "$user":"$group" "$basedir" || (echo " FAILED"; exit 1)
touch "$basedir/setup-complete" touch "$basedir/setup-complete"
echo " done." echo " done."
exit 0 exit 0
;; ;;
skipping to change at line 121 skipping to change at line 125
*) *)
echo " FAILED: environment not ready" echo " FAILED: environment not ready"
exit 1 exit 1
;; ;;
esac esac
if our_slapd_is_running if our_slapd_is_running
then then
echo " already running." echo " already running."
exit 0 exit 0
fi fi
shift
shift
slapd -F "$basedir/slapd.d" -u "$user" -g "$group" \ slapd -F "$basedir/slapd.d" -u "$user" -g "$group" \
-h "ldap:/// ldaps:/// ldapi:///" || (echo " FAILED"; exit 1) -h "ldap:/// ldaps:/// ldapi:///" "$@" || (echo " FAILED"; exit 1)
echo "." echo "."
;; ;;
stop) stop)
# (perhaps implement stop-any) # (perhaps implement stop-any)
echo -n "Stopping OpenLDAP: slapd" echo -n "Stopping OpenLDAP: slapd"
if ! our_slapd_is_running if ! our_slapd_is_running
then then
echo " not running." echo " not running."
exit 0 exit 0
fi fi
 End of changes. 5 change blocks. 
3 lines changed or deleted 9 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)