diff -u nss-mdns-0.9/debian/NOTES.Debian nss-mdns-0.9/debian/NOTES.Debian --- nss-mdns-0.9/debian/NOTES.Debian +++ nss-mdns-0.9/debian/NOTES.Debian @@ -3,6 +3,9 @@ The first version in Debian was 0.3-2. +Postinst +======== + Starting with version 0.8-4.2 inclusive, the package started touching /etc/nsswitch.conf in debian/postinst. @@ -62,0 +66,28 @@ +In version 0.8-6.1 and later, the postinst would: +- if upgrading from 0.8-6: + - revert breakage introduced in 0.8-6 + - avoid doing anything if any of "mdns4_minimal", "mdns4", "mdns", + "mdns_minimal", "mdns6", "mdns6_minimal" was found in the hosts line; that + is, manually configured /etc/nsswitch.conf were kept intact + - otherwise change the "dns" entry in /etc/hosts into: + "mdns4_minimal [NOTFOUND=return] dns mdns4" +- for first installs and upgrades from versions lower than + 0.8-4.2, the postinst would: + - avoid doing anything if any of "mdns4_minimal", "mdns4", "mdns", + "mdns_minimal", "mdns6", "mdns6_minimal" was found in the hosts line; that + is, manually configured /etc/nsswitch.conf were kept intact + - otherwise change the "dns" entry in /etc/hosts into: + "mdns4_minimal [NOTFOUND=return] dns mdns4" + + +Postrm +====== + +Concerning postrm, one was introduced in version 0.8-4.2 to remove any +keyword from a set of mdns keywords from the "hosts:" line of nsswitch.conf +during purge. This postinst snippet was dropped in 0.8-6. + +In version 0.9-0.1, the same snippet was reintroduced, but is run on package +removal instead of purge to ensure perl is still present and to avoid DNS +issues in case of a removed package. + diff -u nss-mdns-0.9/debian/control nss-mdns-0.9/debian/control --- nss-mdns-0.9/debian/control +++ nss-mdns-0.9/debian/control @@ -1,16 +1,16 @@ Source: nss-mdns Section: admin Priority: optional -Maintainer: Anand Kumria +Maintainer: Ubuntu Core developers +XSBC-Original-Maintainer: Anand Kumria Build-Depends: debhelper (>> 4.0.0), lynx Standards-Version: 3.7.2 Package: libnss-mdns Section: admin -Depends: perl, avahi-daemon +Depends: ${shlibs:Depends}, base-files (>= 3.1.10), perl, avahi-daemon (>= 0.6.16-1) Suggests: avahi-autoipd | zeroconf Architecture: any -Depends: ${shlibs:Depends}, base-files (>= 3.1.10) Description: NSS module for Multicast DNS name resolution nss-mdns is a plugin for the GNU Name Service Switch (NSS) functionality of the GNU C Library (glibc) providing host name resolution via Multicast diff -u nss-mdns-0.9/debian/rules nss-mdns-0.9/debian/rules --- nss-mdns-0.9/debian/rules +++ nss-mdns-0.9/debian/rules @@ -27,7 +27,7 @@ config.status: configure dh_testdir # Add here commands to configure the package. - ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=\${prefix}/lib/nss-mdns CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" --disable-legacy + ./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/ --mandir=/usr/share/man --infodir=/usr/share/info --sysconfdir=/etc --localstatedir=/var --libexecdir=/lib/nss-mdns CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs" --disable-legacy build: build-stamp diff -u nss-mdns-0.9/debian/changelog nss-mdns-0.9/debian/changelog --- nss-mdns-0.9/debian/changelog +++ nss-mdns-0.9/debian/changelog @@ -1,3 +1,49 @@ +nss-mdns (0.9-0.2ubuntu1) feisty; urgency=low + + * Merge from debian unstable, remaining changes: + - debian/postinst: Automatically transition the dapper default hosts: line + 'files dns mdns' to the recommended value, since dns before mdns is + inefficient, a DNS server DoS, and an information leak. + * Now ships libraries in /lib, not /usr/lib. (LP: #87207) + * Reapply debian/patches/00_dns_unaligned_access.patch; debian/rules does + not do this, and this got dropped in an earlier merge. + * debian/control: Set Ubuntu maintainer. + + -- Martin Pitt Tue, 27 Feb 2007 16:54:20 +0100 + +nss-mdns (0.9-0.2) unstable; urgency=high + + * Non-maintainer upload to fix a RC bug. + * Configure with a prefix of / instead of /usr as libnss-mdns needs to be in + /lib for the resolver to work correctly during boot; this is also needed + for chrooted processes such as Postfix's smtpd which uses a copy of the + NSS libs as well of the NSS configuration and fails when mdns is missing + in the chroot but referenced in nsswitch.conf. Update other configured + dirs (mandir, infodir, sysconfdir) as well, but these are currently not + used. + + -- Loic Minier Thu, 22 Feb 2007 14:48:45 +0100 + +nss-mdns (0.9-0.1) unstable; urgency=high + + * Non-maintainer upload to fix broken dependencies in the 0.8-6.1 NMU. + * Fix Depends on perl and avahi-daemon. + * Bump up dependency on avahi-daemon to >= 0.6.16-1 for the auto-disabling + functionality on sites with a .local SOA. + * New upstream release. + - Does not export unnecessary symbols and fixes segfault in nmbclient + which had symbols with the same name; closes: #404266. + - Does not use the "search" keyword of resolv.conf anymore; + closes: #404534, #405327. + * Re-add a postrm to cleanup the mdns_* entries from nsswitch.conf but act on + package removal instead of purge to avoid breaking the DNS when the lib is + removed and to ensure perl is still present; closes: #406198. + * Document the changes made to postinst in NOTES.Debian and document the + history of the postrm as well. + * Updates to README.Debian; add upstream URL for troubleshooting. + + -- Loic Minier Tue, 9 Jan 2007 18:45:27 +0100 + nss-mdns (0.9-0ubuntu1) feisty; urgency=low * New upstream bugfix release: @@ -222,0 +269 @@ + diff -u nss-mdns-0.9/debian/README.Debian nss-mdns-0.9/debian/README.Debian --- nss-mdns-0.9/debian/README.Debian +++ nss-mdns-0.9/debian/README.Debian @@ -1,5 +1,5 @@ -MODIFYING /etc/nsswitch.conf ----------------------------- +Packages automagically modifies /etc/nsswitch.conf +-------------------------------------------------- Previously the base-files package shipped /etc/nsswitch.conf and specified: @@ -14,11 +14,9 @@ hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 -This is currently not removed on removal or purge of nss-mdns. - -.local domains --------------- +Sites with a .local DNS zone +---------------------------- Making nss-mdns authoritative for .local breaks resolution on networks where .local is a real domain name. To workaround this, avahi-daemon @@ -29,0 +28,3 @@ +See also this excellent summary on the upstream website: + + only in patch2: unchanged: --- nss-mdns-0.9.orig/src/dns.c +++ nss-mdns-0.9/src/dns.c @@ -32,6 +32,33 @@ #include "dns.h" +#define SET_16_P(data, value) \ + do { \ + uint16_t __value = value; \ + memcpy(data, &__value, sizeof(uint16_t)); \ + } while(0) + +#define SET_16(data, idx, value) \ + SET_16_P(((uint8_t *)data) + idx * sizeof(uint16_t)/sizeof(uint8_t), value) + +#define GET_16_P(data, value) \ + do { \ + uint8_t *__value = ((uint8_t *)&value); \ + memcpy(__value, data, sizeof(uint16_t)); \ + } while(0) + +#define GET_16(data, idx, value) \ + GET_16_P(((uint8_t *)data) + idx * sizeof(uint16_t)/sizeof(uint8_t), value) + +#define GET_32_P(data, value) \ + do { \ + uint8_t *__value = ((uint8_t *)&value); \ + memcpy(__value, data, sizeof(uint32_t)); \ + } while(0) + +#define GET_32(data, idx, value) \ + GET_32_P(((uint8_t *)data) + idx * sizeof(uint32_t)/sizeof(uint8_t), value) + struct dns_packet* dns_packet_new(void) { struct dns_packet *p; @@ -51,15 +78,19 @@ void dns_packet_set_field(struct dns_packet *p, unsigned idx, uint16_t v) { assert(p); assert(idx < 2*6); + - ((uint16_t*) p->data)[idx] = htons(v); + SET_16(p->data, idx, htons(v)); } uint16_t dns_packet_get_field(struct dns_packet *p, unsigned idx) { assert(p); assert(idx < 2*6); + uint16_t r; + + GET_16(p->data, idx, r); - return ntohs(((uint16_t*) p->data)[idx]); + return ntohs(r); } uint8_t* dns_packet_append_name(struct dns_packet *p, const char *name) { @@ -102,7 +133,7 @@ assert(p); d = dns_packet_extend(p, sizeof(uint16_t)); - *((uint16_t*) d) = htons(v); + SET_16_P(d, htons(v)); return d; } @@ -120,7 +151,7 @@ } uint8_t *dns_packet_append_name_compressed(struct dns_packet *p, const char *name, uint8_t *prev) { - int16_t *d; + uint8_t *d; signed long k; assert(p); @@ -131,8 +162,8 @@ if (k < 0 || k >= 0x4000 || (size_t) k >= p->size) return dns_packet_append_name(p, name); - d = (int16_t*) dns_packet_extend(p, sizeof(uint16_t)); - *d = htons((0xC000 | k)); + d = dns_packet_extend(p, sizeof(uint16_t)); + SET_16_P(d, htons((0xC000 | k))); return prev; } @@ -256,11 +287,13 @@ int dns_packet_consume_uint16(struct dns_packet *p, uint16_t *ret_v) { assert(p && ret_v); + uint16_t r; if (p->rindex + sizeof(uint16_t) > p->size) return -1; - - *ret_v = ntohs(*((uint16_t*) (p->data + p->rindex))); + + GET_16_P(p->data + p->rindex, r); + *ret_v = ntohs(r); p->rindex += sizeof(uint16_t); return 0; @@ -268,11 +301,13 @@ int dns_packet_consume_uint32(struct dns_packet *p, uint32_t *ret_v) { assert(p && ret_v); + uint32_t r; if (p->rindex + sizeof(uint32_t) > p->size) return -1; - *ret_v = ntohl(*((uint32_t*) (p->data + p->rindex))); + GET_32_P(p->data + p->rindex, r); + *ret_v = ntohl(r); p->rindex += sizeof(uint32_t); return 0; only in patch2: unchanged: --- nss-mdns-0.9.orig/debian/postrm +++ nss-mdns-0.9/debian/postrm @@ -0,0 +1,43 @@ +#!/bin/sh +set -e +#DEBHELPER# + +log() { + echo "$*" +} + +remove_mdns() { + log "Checking NSS setup..." + # abort if /etc/nsswitch.conf does not exist + if ! [ -e /etc/nsswitch.conf ]; then + log "Could not find /etc/nsswitch.conf." + return + fi + 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 +} + +action="$1" + +if [ "$action" = remove ]; then + remove_mdns +fi