On Fri, May 27, 2005 at 09:10:50AM +0800, Eugene Konev wrote:
> >> +# Find out slapd db directories
> >> +SLAPD_DBDIRS=`sed -ne 's/^directory[[:space:]]\+"*\([^"]\+\).*/\1/p' \
> >> + "$SLAPD_CONF" `
> >> +
>
> TL> I'd rather gather this list at the time when it is needed. Apart from
> TL> that I don't really grok that sed expression :)
>
> It has only possible failure if path contains double quotes in it, which
> is very unlikely situation. And this:
Yes, I was able to parse it finally :)
> TL> +# Find bdb environment dirs
> TL> +find_bdb_envs() {
> TL> + local d
> TL> + for d in `awk '/directory/ {print $2}' < "$SLAPD_CONF"`; do
> TL> + if [ -d "$d" -a -f "$d/objectClass.bdb" ]; then
> TL> + echo $d
> TL> + fi
> TL> + done
> TL> +}
>
> will happily skip entries like:
> directory "/var/lib/ldap"
> (note the quotes), which are by default in sarge install.
Yep. I was using eval to strip them and removed that before sending the
email as it can have really serious results depending on your
slapd.conf.
On Fri, May 27, 2005 at 09:10:50AM +0800, Eugene Konev wrote:
> >> +# Find out slapd db directories [:space: ]]\+"*\ ([^"]\+ \).*/\1/ p' \
> >> +SLAPD_DBDIRS=`sed -ne 's/^directory[
> >> + "$SLAPD_CONF" `
> >> +
>
> TL> I'd rather gather this list at the time when it is needed. Apart from
> TL> that I don't really grok that sed expression :)
>
> It has only possible failure if path contains double quotes in it, which
> is very unlikely situation. And this:
Yes, I was able to parse it finally :)
> TL> +# Find bdb environment dirs .bdb" ]; then
> TL> +find_bdb_envs() {
> TL> + local d
> TL> + for d in `awk '/directory/ {print $2}' < "$SLAPD_CONF"`; do
> TL> + if [ -d "$d" -a -f "$d/objectClass
> TL> + echo $d
> TL> + fi
> TL> + done
> TL> +}
>
> will happily skip entries like:
> directory "/var/lib/ldap"
> (note the quotes), which are by default in sarge install.
Yep. I was using eval to strip them and removed that before sending the
email as it can have really serious results depending on your
slapd.conf.
Greetings
Torsten