Sorry to keep sending patches, but I realized it also need to look for
search foo.local type things, so here's an updated patch.

-- 
see shy jo
diff -ur old/nss-mdns-0.8/debian/README.Debian nss-mdns-0.8/debian/README.Debian
--- old/nss-mdns-0.8/debian/README.Debian       2006-10-14 16:35:37.000000000 
-0400
+++ nss-mdns-0.8/debian/README.Debian   2006-10-15 13:14:03.000000000 -0400
@@ -11,6 +11,18 @@
 will be preserved. If this package is purged, the mdns items will be
 removed from the hosts line.
 
+PROBLEMS WITH "search local" IN /etc/resolv.conf
+------------------------------------------------
+
+If you have "search local" (or a search line for any subdomain of local
+such as "foo.local") in /etc/resolv.conf, this will not behave well
+with mdns. In the best case, every hostname lookup will be slowed down as a
+mdns lookup is done first; in the worst case all dns lookups will fail.
+
+The author of nss-mdns does not consider using "search local" with mdns to
+be a supported configuration. Either change /etc/resolv.conf, or remove the
+mdns entries from /etc/nsswitch.conf.
+
 WHAT ABOUT IPv6?
 ----------------
 
diff -ur old/nss-mdns-0.8/debian/changelog nss-mdns-0.8/debian/changelog
--- old/nss-mdns-0.8/debian/changelog   2006-10-14 16:35:37.000000000 -0400
+++ nss-mdns-0.8/debian/changelog       2006-10-14 16:25:21.000000000 -0400
@@ -1,3 +1,16 @@
+nss-mdns (0.8-6) UNRELEASED; urgency=low
+
+  * Document in README.Debian that using "search local" in /etc/resolv.conf
+    does not get along well at all with using mdns in /etc/nsswitch.conf.
+    This is not a supported configuration.
+  * Check for systems that have "search local" in /etc/resolv.conf and use
+    mdns, print a warning, and disable mdns. Do this on upgrade to this
+    version, and on new installs; if you really want the problimatic
+    configuration you can add it back and it will be preserved from now on.
+    Closes: #392813
+
+ -- Joey Hess <[EMAIL PROTECTED]>  Sat, 14 Oct 2006 16:20:25 -0400
+
 nss-mdns (0.8-5) unstable; urgency=low
 
   * Take over the package for the pkg-utopia team. T
diff -ur old/nss-mdns-0.8/debian/postinst nss-mdns-0.8/debian/postinst
--- old/nss-mdns-0.8/debian/postinst    2006-10-14 16:35:37.000000000 -0400
+++ nss-mdns-0.8/debian/postinst        2006-10-15 13:15:26.000000000 -0400
@@ -2,6 +2,30 @@
 set -e
 #DEBHELPER#
 
+remove_nss () {
+       perl -i -pe '
+               my @remove=(
+                       "mdns4_minimal [NOTFOUND=return]",
+                       "mdns4_minimal",
+                       "mdns4",
+                       "mdns6_minimal [NOTFOUND=return]",
+                       "mdns6_minimal",
+                       "mdns6",
+                       "mdns_minimal [NOTFOUND=return]",
+                       "mdns_minimal",
+                       "mdns",
+               );
+               sub remove {
+                       my $s=shift;
+                       foreach my $bit (@remove) {
+                               $s=~s/\s+\Q$bit\E//g;
+                       }
+                       return $s;
+               }
+               s/^(hosts:)(.*)/$1.remove($2)/e;
+       ' /etc/nsswitch.conf
+}
+
 if [ "$1" = configure ] && [ -e /etc/nsswitch.conf ]; then
        if [ -z "$2" ] || dpkg --compare-versions "$2" le 0.8-4.1; then
                perl -i -pe '
@@ -19,4 +43,18 @@
                        s/^(hosts:\s+)(.*)/$1.insert($2)/e;
                ' /etc/nsswitch.conf
        fi
+
+       if [ -z "$2" ] || dpkg --compare-versions "$2" le 0.8-6; then
+               if [ -e /etc/resolv.conf ] && \
+                  egrep -q  '^ *search (.*\.)?local *$' /etc/resolv.conf && \
+                  grep -q "mdns" /etc/nsswitch.conf; then
+                       cat <<EOF >&2
+* Warning: /etc/resolv.conf contains "search local" or similar
+  and /etc/nsswitch.conf uses mdns. This combination is not supported.
+  Removing mdns from /etc/nsswitch.conf. See
+  /usr/share/doc/libnss-mdns/README.Debian for details.
+EOF
+                       remove_nss
+               fi
+       fi
 fi
diff -ur old/nss-mdns-0.8/debian/postrm nss-mdns-0.8/debian/postrm
--- old/nss-mdns-0.8/debian/postrm      2006-10-14 16:35:37.000000000 -0400
+++ nss-mdns-0.8/debian/postrm  2006-10-14 18:06:26.000000000 -0400
@@ -2,7 +2,7 @@
 set -e
 #DEBHELPER#
 
-if [ "$1" = purge ] && [ -e /etc/nsswitch.conf ]; then
+remove_nss () {
        perl -i -pe '
                my @remove=(
                        "mdns4_minimal [NOTFOUND=return]",
@@ -24,4 +24,8 @@
                }
                s/^(hosts:)(.*)/$1.remove($2)/e;
        ' /etc/nsswitch.conf
+}
+
+if [ "$1" = purge ] && [ -e /etc/nsswitch.conf ]; then
+       remove_nss
 fi

Attachment: signature.asc
Description: Digital signature

Reply via email to