nss-pam-ldapd commit: r1308 - nss-pam-ldapd/debian
[
Date Prev][
Date Next]
[
Thread Prev][
Thread Next]
nss-pam-ldapd commit: r1308 - nss-pam-ldapd/debian
- From: Commits of the nss-pam-ldapd project <nss-pam-ldapd-commits [at] lists.arthurdejong.org>
- To: nss-pam-ldapd-commits [at] lists.arthurdejong.org
- Reply-to: nss-pam-ldapd-users [at] lists.arthurdejong.org
- Subject: nss-pam-ldapd commit: r1308 - nss-pam-ldapd/debian
- Date: Sun, 7 Nov 2010 21:04:59 +0100 (CET)
Author: arthur
Date: Sun Nov 7 21:04:58 2010
New Revision: 1308
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1308
Log:
split updating configuration file based on debconf value to separate function
and make config option renaming consistent
Modified:
nss-pam-ldapd/debian/nslcd.postinst
Modified: nss-pam-ldapd/debian/nslcd.postinst
==============================================================================
--- nss-pam-ldapd/debian/nslcd.postinst Sun Nov 7 20:45:46 2010 (r1307)
+++ nss-pam-ldapd/debian/nslcd.postinst Sun Nov 7 21:04:58 2010 (r1308)
@@ -140,6 +140,20 @@
return 0
}
+update_config()
+{
+ debconf_param="$1"
+ cfg_param="$2"
+ # update configuration option based on debconf value
+ db_get "$debconf_param"
+ if [ -n "$RET" ]
+ then
+ cfg_set "$cfg_param" "$RET"
+ else
+ cfg_disable "$cfg_param"
+ fi
+}
+
# real functions begin here
if [ "$1" = "configure" ]
then
@@ -167,34 +181,26 @@
fi
# create a default configuration
create_config
- # set server uri
- db_get nslcd/ldap-uris
- cfg_uris "$RET"
- # set search base
- db_get nslcd/ldap-base
- if [ -n "$RET" ]
+ # rename tls_checkpeer to tls_reqcert
+ if grep -qi '^tls_checkpeer[[:space:]]' $CONFFILE
then
- cfg_set base "$RET"
- else
- cfg_disable base
+ echo "Renaming tls_checkpeer to tls_reqcert in $CONFFILE..." >&2
+ sed -i 's/^tls_checkpeer[[:space:]]/tls_reqcert /' "$CONFFILE"
fi
- # set bind dn/pw
- db_get nslcd/ldap-binddn
- if [ -n "$RET" ]
+ # rename reconnect_maxsleeptime to reconnect_retrytime
+ if grep -qi '^reconnect_maxsleeptime[[:space:]]' $CONFFILE
then
- cfg_set binddn "$RET"
- db_get nslcd/ldap-bindpw
- if [ -n "$RET" ]
- then
- cfg_set bindpw "$RET"
- else
- cfg_disable bindpw
- fi
- else
- # no binddn/pw, disable options
- cfg_disable binddn
- cfg_disable bindpw
+ echo "Renaming reconnect_maxsleeptime to reconnect_retrytime in
$CONFFILE..." >&2
+ sed -i 's/^reconnect_maxsleeptime[[:space:]]/reconnect_retrytime /'
"$CONFFILE"
fi
+ # set server uri
+ db_get nslcd/ldap-uris
+ cfg_uris "$RET"
+ # update some options
+ update_config nslcd/ldap-base base
+ update_config nslcd/ldap-binddn binddn
+ update_config nslcd/ldap-bindpw bindpw
+ update_config nslcd/ldap-reqcert tls_reqcert
# remove password from database
db_set nslcd/ldap-bindpw ""
# set ssl option
@@ -206,25 +212,8 @@
then
cfg_disable ssl
fi
- # rename any tls_checkpeer options
- sed -i 's/^tls_checkpeer/tls_reqcert/i' "$CONFFILE"
- # set tls_reqcert option
- db_get nslcd/ldap-reqcert
- if [ -n "$RET" ]
- then
- # set tls_reqcert option
- cfg_set tls_reqcert "$RET"
- else
- cfg_disable tls_reqcert
- fi
# we're done
db_stop
- # rename reconnect_maxsleeptime to reconnect_retrytime
- if grep -qi '^reconnect_maxsleeptime[[:space:]]' $CONFFILE
- then
- echo "Renaming reconnect_maxsleeptime to reconnect_retrytime in
$CONFFILE..." >&2
- sed -i 's/^reconnect_maxsleeptime[[:space:]]/reconnect_retrytime /'
"$CONFFILE"
- fi
# fix permissions of configfile if upgrading from an old version
if dpkg --compare-versions "$2" lt-nl "0.6.7.1"
then
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits
- nss-pam-ldapd commit: r1308 - nss-pam-ldapd/debian,
Commits of the nss-pam-ldapd project