From eb0fd9a62e00a488ded184eafc0518c23870fa13 Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Mon, 18 Dec 2006 21:54:21 +0000 Subject: handle cases where commands in backticks return an error code git-svn-id: http://arthurdejong.org/svn/nss-pam-ldapd/libnss_ldapd@175 ef36b2f9-881f-0410-afb5-c4e39611909c --- debian/libnss-ldapd.config | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'debian') diff --git a/debian/libnss-ldapd.config b/debian/libnss-ldapd.config index 7073b3c..6e86bb8 100644 --- a/debian/libnss-ldapd.config +++ b/debian/libnss-ldapd.config @@ -22,23 +22,23 @@ db_title "Configuring libnss-ldapd" parsesys() { # guess domain based on system information - domain=`hostname --domain` - [ -z "$domain" ] && domain=`hostname --nis | grep '\.'` - [ -z "$domain" ] && domain=`hostname --fqdn | sed -n 's/^[^.]*\.//p'` - [ -z "$domain" ] && domain=`sed -n 's/^ *\(domain\|search\) *\([^ ]*\) *$/\2/p' /etc/resolv.conf | head -n 1` + domain=`hostname --domain` || true + [ -z "$domain" ] && domain=`hostname --nis | grep '\.'` || true + [ -z "$domain" ] && domain=`hostname --fqdn | sed -n 's/^[^.]*\.//p'` || true + [ -z "$domain" ] && domain=`sed -n 's/^ *\(domain\|search\) *\([^ ]*\) *$/\2/p' /etc/resolv.conf | head -n 1` || true if [ -n "$domain" ] then # set search base - searchbase=`echo "$domain" | sed 's/^/dc=/;s/\./,dc=/'` + searchbase=`echo "$domain" | sed 's/^/dc=/;s/\./,dc=/'` || true db_set libnss-ldapd/ldap-base "$searchbase" fi # guess ldap server - server=`getent hosts ldap` - [ -z "$server" ] && server=`getent hosts dirhost` + server=`getent hosts ldap` || true + [ -z "$server" ] && server=`getent hosts dirhost` || true if [ -n "$domain" ] && [ -z "$server" ] then - server=`getent hosts ldap."$domain"` - [ -z "$server" ] && server=`getent hosts dirhost."$domain"` + server=`getent hosts ldap."$domain"` || true + [ -z "$server" ] && server=`getent hosts dirhost."$domain"` || true fi if [ -n "$server" ] then @@ -62,11 +62,11 @@ parsecfg() port=`sed -n 's/^port[[:space:]]*//ip' "$cfgfile"` for host in $hosts do - if [ -n "$port" ] && [ -z `echo $host | grep ':'` ] + if [ -z "$port" ] || (echo "$host" | grep -q ':' ) then - uris="$uris ldap://$host:$port/" - else uris="$uris ldap://$host/" + else + uris="$uris ldap://$host:$port/" fi done fi -- cgit v1.2.3