[debian-edu-commits] debian-edu/pkg-team/ 02/07: Add new revert-broken-zones.patch to change ldap2bind to revert to previous zone if the new is rejected by bind (Closes: #710362).

Petter Reinholdtsen pere at moszumanska.debian.org
Wed Oct 1 05:29:38 UTC 2014


This is an automated email from the git hooks/post-receive script.

pere pushed a commit to branch master
in repository ldap2zone.

commit 9307ec513c852e8ff523b5fc093211addc9682cd
Author: Petter Reinholdtsen <pere at hungry.com>
Date:   Wed Oct 1 07:00:13 2014 +0200

    Add new revert-broken-zones.patch to change ldap2bind to revert to
    previous zone if the new is rejected by bind (Closes: #710362).
---
 debian/patches/revert-broken-zones.patch | 39 ++++++++++++++++++++++++++++++++
 debian/patches/series                    |  1 +
 2 files changed, 40 insertions(+)

diff --git a/debian/patches/revert-broken-zones.patch b/debian/patches/revert-broken-zones.patch
new file mode 100644
index 0000000..c8363f3
--- /dev/null
+++ b/debian/patches/revert-broken-zones.patch
@@ -0,0 +1,39 @@
+Description: Keep old zone if new one break bind setup
+ If bind reject the zone file, revert to the previous version and
+ log an error to syslog, instead of breaking the DNS setup completely.
+Author: Petter Reinholdtsen <pere at hungry.com>
+Bug-Debian: http://bugs.debian.org/710362
+Last-Update: 2014-09-30
+
+--- ldap2zone-0.2.orig/ldap2bind
++++ ldap2zone-0.2/ldap2bind
+@@ -78,15 +78,24 @@ EOF
+ fi
+ 
+ for domain in $ZONES; do
+-	if $ldap2zone $domain $LDAP_URI $TTL > /tmp/$domain; then
+-		lines=$(cat /tmp/$domain | wc -l)
+-		[ $lines -gt 1 ] && mv /tmp/$domain $BIND_DATA/${PREFIX}${domain}
++	TMPFILE=$TMPFILE
++	CURRENT=$BIND_DATA/${PREFIX}${domain}
++	OLD=$BIND_DATA/${PREFIX}${domain}.old-$$
++	if $ldap2zone $domain $LDAP_URI $TTL > $TMPFILE; then
++		lines=$(cat $TMPFILE | wc -l)
++		if [ $lines -gt 1 ] ; then
++		    mv $CURRENT $OLD
++		    mv $TMPFILE $CURRENT
++		fi
+ 	fi
+ 
+ 	result=$($rndc reload $domain 2>&1)
+ 	if [ $? -ne 0 ]; then
+-                logger -t ldap2bind "Reloading the zone '$domain' failed: $result\n"
++		logger -t ldap2bind "Reloading the zone '$domain' failed: $result. Reverting.\n"
++		mv $CURRENT $CURRENT.broken
++		mv $OLD $CURRENT
+ 	else
+-                logger -t ldap2bind "Reloading the zone '$domain' was successful\n"
++		rm $OLD
++		logger -t ldap2bind "Reloading the zone '$domain' was successful\n"
+ 	fi
+ done
diff --git a/debian/patches/series b/debian/patches/series
index 6b25073..0813895 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,3 +1,4 @@
 fix-default-location
 ldap_host_param
 heap-corruption.patch
+revert-broken-zones.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/ldap2zone.git



More information about the debian-edu-commits mailing list