Package: pdnsd Version: 1.2.6-par-1 Severity: normal Tags: patch I want to use resolconf with pdnsd and be able to bind to an interface different than the loopback one, but the current scripts hardcode the 127.0.0.1 address.
Attached you will find a patch that tries to read the server_ip value from the pdnsd.conf file and uses it when available; if it can't find the value falls back to use the loopback address. -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 2.6.22-1-vserver-amd64 (SMP w/2 CPU cores) Locale: LANG=ca_ES.UTF-8, LC_CTYPE=ca_ES.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages pdnsd depends on: ii adduser 3.105 add and remove users and groups ii debconf [debconf-2.0] 1.5.14 Debian configuration management sy ii libc6 2.6.1-5 GNU C Library: Shared libraries Versions of packages pdnsd recommends: ii resolvconf 1.37 nameserver information handler -- debconf information excluded -- Sergio Talens-Oliag <[EMAIL PROTECTED]> <http://people.debian.org/~sto/> Key fingerprint = 29DF 544F 1BD9 548C 8F15 86EF 6770 052B B8C1 FA69
diff -ruN pdnsd-1.2.6-par.orig/debian/changelog pdnsd-1.2.6-par/debian/changelog --- pdnsd-1.2.6-par.orig/debian/changelog 2007-09-24 19:48:15.000000000 +0200 +++ pdnsd-1.2.6-par/debian/changelog 2007-09-24 19:53:13.000000000 +0200 @@ -1,3 +1,11 @@ +pdnsd (1.2.6-par-1.1) unstable; urgency=low + + * Non-maintainer upload. + * Modified init.d and resolvconf scripts to support the use of pdnsd + + resolvconf when pdnsd is listening on an IP other than 127.0.0.1 + + -- Sergio Talens-Oliag <[EMAIL PROTECTED]> Mon, 24 Sep 2007 19:51:10 +0200 + pdnsd (1.2.6-par-1) unstable; urgency=low * New upstream release. diff -ruN pdnsd-1.2.6-par.orig/debian/init.d pdnsd-1.2.6-par/debian/init.d --- pdnsd-1.2.6-par.orig/debian/init.d 2007-09-24 19:48:15.000000000 +0200 +++ pdnsd-1.2.6-par/debian/init.d 2007-09-24 19:50:34.000000000 +0200 @@ -13,6 +13,7 @@ NAME="pdnsd" DESC="proxy DNS server" +CONFIG_FILE="/etc/pdnsd.conf" DAEMON="/usr/sbin/pdnsd" PIDFILE="/var/run/pdnsd.pid" CACHE="/var/cache/pdnsd/pdnsd.cache" @@ -25,7 +26,8 @@ if test -n "$AUTO_MODE" && test -f /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf then - START_OPTIONS="${START_OPTIONS} -c /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf" + CONFIG_FILE="/usr/share/pdnsd/pdnsd-$AUTO_MODE.conf" + START_OPTIONS="${START_OPTIONS} -c ${CONFIG_FILE}" fi . /lib/lsb/init-functions @@ -63,7 +65,15 @@ pdnsd-ctl status >/dev/null 2>&1 || return $? if [ -x /sbin/resolvconf ] ; then - echo "nameserver 127.0.0.1" | /sbin/resolvconf -a "lo.$NAME" + if [ -f "${CONFIG_FILE}" ]; then + NAMESERVER="$( sed -n -e '/server_ip/ { s/^.*server_ip.*=[^0-9]*\([0-9.]*\).*$/\1/; p; }' ${CONFIG_FILE})" + if [ -z "$NAMESERVER" ]; then + NAMESERVER="127.0.0.1"; + fi + else + NAMESERVER="127.0.0.1"; + fi + echo "nameserver $NAMESERVER" | /sbin/resolvconf -a "lo.$NAME" fi } diff -ruN pdnsd-1.2.6-par.orig/debian/resolvconf pdnsd-1.2.6-par/debian/resolvconf --- pdnsd-1.2.6-par.orig/debian/resolvconf 2007-09-24 19:48:15.000000000 +0200 +++ pdnsd-1.2.6-par/debian/resolvconf 2007-09-24 19:50:45.000000000 +0200 @@ -22,6 +22,24 @@ [ -x /lib/resolvconf/list-records ] || exit 1 [ -e /var/cache/pdnsd/pdnsd.status ] || exit 0 +CONFIG_FILE="/etc/pdnsd.conf" +if test -r /etc/default/pdnsd; then + . "/etc/default/pdnsd" +fi +if test -n "$AUTO_MODE" && test -f /usr/share/pdnsd/pdnsd-$AUTO_MODE.conf +then + CONFIG_FILE="/usr/share/pdnsd/pdnsd-$AUTO_MODE.conf" +fi + +if test -r "${CONFIG_FILE}"; then + NAMESERVER="$( sed -n -e '/server_ip/ { s/^.*server_ip.*=[^0-9]*\([0-9.]*\).*$/\1/; p; }' ${CONFIG_FILE})" + if [ -z "$NAMESERVER" ]; then + NAMESERVER="127.0.0.1"; + fi +else + NAMESERVER="127.0.0.1"; +fi + PATH=/bin:/sbin uniquify() @@ -39,7 +57,7 @@ uniquify "`cat $(/lib/resolvconf/list-records) /dev/null \ | sed -n -e 's/^[[:space:]]*nameserver[[:space:]]\+//p' \ - | grep -v '^127.0.0.1$'`" + | grep -v "^$NAMESERVER$"`" if [ -n "$RSLT" ] ; then OUTPUT="$(/usr/sbin/pdnsd-ctl server resolvconf up "$RSLT" || :)"