~ubuntu-branches/ubuntu/intrepid/pdns/intrepid-security

« back to all changes in this revision

Viewing changes to debian/pdns-server.postinst

  • Committer: Bazaar Package Importer
  • Author(s): Debian PowerDNS Maintainers
  • Date: 2005-07-29 20:24:33 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20050729202433-cfrk71byx0mmmbk6
Tags: 2.9.18-1
* New upstream release (Closes: #318798)
* Drop patches: 64bit-compile-fix.dpatch, addfeatures-ldapbackend.dpatch,
  amd64-compilefix.dpatch, blankout-domain-fix.dpatch,
  consistent-sql.dpatch, dosfix-ldapbackend.dpatch, fix-exit-status.dpatch,
  gpgsql-compilefix.dpatch, gsqlite-compilefix.dpatch, gsqlite-slave.dpatch,
  recursor-slowdown.patch.dpatch, typoinitscript.dpatch, zone2ldap.dpatch
  They are applied upstream.
* The ldapbackend did not properly escape all queries, allowing it to fail
  and not answer questions. (CAN-2005-2301)
* Questions from clients denied recursion could blank out answers to clients
  who are allowed recursion services, temporarily. (CAN-2005-2302)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
# postinst script for pdns-server
 
3
#
 
4
# see: dh_installdeb(1)
 
5
 
 
6
set -e
 
7
 
 
8
. /usr/share/debconf/confmodule
 
9
 
 
10
# summary of how this script can be called:
 
11
#        * <postinst> `configure' <most-recently-configured-version>
 
12
#        * <old-postinst> `abort-upgrade' <new version>
 
13
#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
 
14
#          <new-version>
 
15
#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
 
16
#          <failed-install-package> <version> `removing'
 
17
#          <conflicting-package> <version>
 
18
# for details, see http://www.debian.org/doc/debian-policy/ or
 
19
# the debian-policy package
 
20
#
 
21
 
 
22
PDNSCONF=/etc/powerdns/pdns.conf
 
23
PDNSDEFAULT=/etc/default/pdns
 
24
if [ -e $PDNSCONF ]; then
 
25
  PDNSDIR=`cat $PDNSCONF | grep include | awk -F '=' '{print $2}'`
 
26
fi
 
27
if [ -z $PDNSDIR ]; then
 
28
  PDNSDIR=/etc/powerdns/pdns.d
 
29
fi
 
30
PDNSLOCAL=$PDNSDIR/pdns.local
 
31
 
 
32
# Temporary files
 
33
PDNSCONFTEMP=`mktemp`
 
34
PDNSLOCALTEMP=`mktemp`
 
35
PDNSDEFAULTTEMP=`mktemp`
 
36
 
 
37
splitconfig() {
 
38
  if [ -e $PDNSCONF ]; then
 
39
    for i in geo ldap gmysql gpgsql pipe gsqlite; do
 
40
      CONF=`(cat $PDNSCONF | grep -- $i-) || /bin/true`
 
41
      if [ ! -z "$CONF" ]; then
 
42
        for j in $CONF; do
 
43
          echo $j >> $PDNSLOCALTEMP
 
44
        done
 
45
      fi
 
46
    done
 
47
  fi
 
48
}
 
49
 
 
50
case "$1" in
 
51
  configure)
 
52
    # Fill the temporary files with config items.
 
53
    cat /usr/share/pdns-server/pdns.conf > $PDNSCONFTEMP
 
54
    cat /usr/share/pdns-server/pdns.local > $PDNSLOCALTEMP
 
55
    cat /usr/share/pdns-server/pdns > $PDNSDEFAULTTEMP
 
56
 
 
57
    # Split config
 
58
    splitconfig
 
59
 
 
60
    # Do we listen on a specified address
 
61
    db_get pdns-server/localaddress || true
 
62
    if [ ! -z "$RET" ]; then
 
63
      sed -i -e "s|^\(#\)\?\(# \)\?local-address=.*$|local-address=$RET|" $PDNSCONFTEMP
 
64
    fi
 
65
 
 
66
    # Allow recursion subnets ?
 
67
    db_get pdns-server/allowrecursion || true
 
68
    if [ ! -z "$RET" ]; then
 
69
      sed -i -e "s|^\(#\)\?\(# \)\?allow-recursion=.*$|allow-recursion=$RET|" $PDNSCONFTEMP
 
70
    fi
 
71
 
 
72
    # Start on boot ?
 
73
    db_get pdns-server/autostart || true
 
74
    [ -z "$RET" ] && RET=false
 
75
    if [ "$RET" = "true" ]; then
 
76
      sed -i -e "s/^START=.*$/START=yes/" $PDNSDEFAULTTEMP
 
77
    fi
 
78
 
 
79
    # Stop the debconf stuff
 
80
    db_stop || true
 
81
 
 
82
    # Install the new configuration files if the user wants it.
 
83
    ucf $PDNSCONFTEMP $PDNSCONF
 
84
    ucf $PDNSDEFAULTTEMP $PDNSDEFAULT
 
85
    ucf $PDNSLOCALTEMP $PDNSLOCAL
 
86
 
 
87
    # Clean up temporary files.
 
88
    rm -f $PDNSCONFTEMP $PDNSDEFAULTTEMP $PDNSLOCALTEMP
 
89
 
 
90
    # There could be passwords in these files. PowerDNS first reads the
 
91
    # configuration files and then drop root privileges.
 
92
    chmod 0600 $PDNSCONF $PDNSLOCAL
 
93
    chmod 0700 $PDNSDIR
 
94
  ;;
 
95
 
 
96
  abort-upgrade|abort-remove|abort-deconfigure)
 
97
  ;;
 
98
 
 
99
  *)
 
100
    echo "postinst called with unknown argument \`$1'" >&2
 
101
    exit 1
 
102
  ;;
 
103
esac
 
104
 
 
105
if [ -x "/etc/init.d/pdns" ]; then
 
106
  update-rc.d pdns defaults 20 85 >/dev/null || exit 0
 
107
  if [ -x /usr/sbin/invoke-rc.d ]; then
 
108
    invoke-rc.d pdns start || exit 0
 
109
  else
 
110
    /etc/init.d/pdns start || exit 0
 
111
  fi
 
112
fi
 
113
 
 
114
# dh_installdeb will replace this with shell code automatically
 
115
# generated by other debhelper scripts.
 
116
 
 
117
#DEBHELPER#
 
118
 
 
119
exit 0
 
120