lists.arthurdejong.org
RSS feed

nss-pam-ldapd commit: r1310 - nss-pam-ldapd/debian

[Date Prev][Date Next] [Thread Prev][Thread Next]

nss-pam-ldapd commit: r1310 - nss-pam-ldapd/debian



Author: arthur
Date: Sun Nov  7 23:13:26 2010
New Revision: 1310
URL: http://arthurdejong.org/viewvc/nss-pam-ldapd?view=rev&revision=1310

Log:
split reading values from a configfile into a separate function and also ensure 
that tls_reqcert is correctly read

Modified:
   nss-pam-ldapd/debian/nslcd.config

Modified: nss-pam-ldapd/debian/nslcd.config
==============================================================================
--- nss-pam-ldapd/debian/nslcd.config   Sun Nov  7 23:05:59 2010        (r1309)
+++ nss-pam-ldapd/debian/nslcd.config   Sun Nov  7 23:13:26 2010        (r1310)
@@ -20,6 +20,21 @@
 # default.
 #
 
+# read a configuration value from the specified file
+# (it takes care in not overwriting a previously written value)
+read_config()
+{
+  debconf_param="$1"
+  cfg_param="$2"
+  # get debconf value to ensure we don't overwrite an already set value
+  db_get "$debconf_param"
+  if [ -z "$RET" ]
+  then
+    value=`sed -n 
's/^'"$cfg_param"'[[:space:]]*\([^[:space:]].*[^[:space:]]\)[[:space:]]*$/\1/ip'
 "$cfgfile" | tail -n 1`
+    [ -n "$value" ] && db_set "$debconf_param" "$value"
+  fi
+}
+
 # check the system (non-LDAP configuration files) for some
 # reasonable defaults
 parsesys()
@@ -91,27 +106,10 @@
     fi
     [ -n "$uris" ] && db_set nslcd/ldap-uris "$uris"
   fi
-  # find base config
-  db_get nslcd/ldap-base
-  if [ -z "$RET" ]
-  then
-    searchbase=`sed -n 
's/^base[[:space:]]*\([^[:space:]]*\)[[:space:]]*$/\1/ip' "$cfgfile" | tail -n 
1`
-    [ -n "$searchbase" ] && db_set nslcd/ldap-base "$searchbase"
-  fi
-  # find binddn
-  db_get nslcd/ldap-binddn
-  if [ -z "$RET" ]
-  then
-    binddn=`sed -n 's/^binddn[[:space:]]*//ip' "$cfgfile" | tail -n 1`
-    db_set nslcd/ldap-binddn "$binddn"
-  fi
-  # find bindpw
-  db_get nslcd/ldap-bindpw
-  if [ -z "$RET" ]
-  then
-    bindpw=`sed -n 's/^bindpw[[:space:]]*//ip' "$cfgfile" | tail -n 1`
-    db_set nslcd/ldap-bindpw "$bindpw"
-  fi
+  # read simple options
+  read_config nslcd/ldap-base base
+  read_config nslcd/ldap-binddn binddn
+  read_config nslcd/ldap-bindpw bindpw
   # check ssl option
   db_get nslcd/ldap-starttls
   if [ -z "$RET" ]
@@ -147,6 +145,7 @@
   db_set nslcd/ldap-binddn ""
   db_set nslcd/ldap-bindpw ""
   db_set nslcd/ldap-starttls ""
+  db_set nslcd/ldap-reqcert ""
   # parse current configuration
   parsecfg "$CONFFILE"
 else
--
To unsubscribe send an email to
nss-pam-ldapd-commits-unsubscribe@lists.arthurdejong.org or see
http://lists.arthurdejong.org/nss-pam-ldapd-commits