apple / cups

Apple CUPS Sources
https://www.cups.org
Apache License 2.0
1.9k stars 461 forks source link

Missing '.' seperator in debugging output from backend/dnssd #4444

Closed michaelrsweet closed 10 years ago

michaelrsweet commented 10 years ago

Version: 1.7.3 CUPS.org User: pseudonomous

See ubuntu bug (cups 1.7.2):

https://bugs.launchpad.net/ubuntu/+source/cups/+bug/1334449?comments=all If for debugging purposes one reads the output from running:

/usr/lib/cups/backend/dnssd

at the command line, one will see statements like:

DEBUG: Found "Sales._ipp._tcpzeroconf.org"... DEBUG: Querying "Sales._ipp._tcp.zeroconf.org"... DEBUG: sent=0, count=1 DEBUG: Found "Stuart's Home AirPrint Printer._ipp._tcpzeroconf.org"... DEBUG: Found "3rd. Floor Copy Room._ipp._tcpzeroconf.org"... DEBUG: Found "Engineering._ipp._tcpzeroconf.org"... DEBUG: Found "Marketing._ipp._tcpzeroconf.org"...

The domain component is not separated from the 'protocol component' of the dns record.

I have been unable to get cups to work with non-local (I mean services that are not served up by mdns in the domain .local) dns-sd ipp printers. (using unicast dns, I have gotten this to work with cups on OS X 10.6). I kept getting a DNS error:

ERROR: DNS failure: NXDOMAIN

At first I believed this was because the dns name was being constructed incorrectly, but after reading the source, I believe the problem is unrelated.

It seems likely to me that there is actually a problem with doing unicast dns lookups with Avahi, however, because of the weird debugging output from backend/dnssd, one is misled to believe that cups is constructing the wrong dnsname to look up.

I have confirmed the bug exists in cups 1.7.3 on Arch Linux as well. It's trivial to fix, but I've included a patch anyways. This bug does not exist with the version of cups (1.4.7) shipped with OS X 10.6.8, I do not know if it exists on more recent versions of OS X, but I don't see any reason why the code should be platform specific.

It should be trivial to patch; patch is attached.

michaelrsweet commented 10 years ago

CUPS.org User: mike

The problem is that mDNSResponder includes a trailing "." on the regtype value while Avahi doesn't. So the correct fix is to make this some more conditional code... :/

michaelrsweet commented 10 years ago

CUPS.org User: mike

Fixed in Subversion repository.

michaelrsweet commented 10 years ago

"dnssd.c.patch":

--- dnssd.c 2014-06-25 17:00:48.447803109 -0500 +++ dnssd.c.orig 2014-06-25 16:44:59.739098716 -0500 @@ -924,7 +924,7 @@

michaelrsweet commented 10 years ago

"str4444.patch":

Index: backend/dnssd.c

--- backend/dnssd.c (revision 11968) +++ backend/dnssd.c (working copy) @@ -1,33 +1,17 @@ /*