dnssd icon indicating copy to clipboard operation
dnssd copied to clipboard

Connecting to browse result with name containing "." yields -65540

Open nevyn opened this issue 13 years ago • 3 comments

If the name of the found reply contains ".", reply.name returns the name up to the dot and no more. Trying to resolve or connect to it fails with -65540.

Not sure if I'm doing something wrong having "." in my name or if it's a bug in dnssd...

puts reply.name, reply.type, reply.domain

yields:

12 23.12 123.office.spotify.net: Spotify._nuremote._tcp.local.

(pretend that 12.23.12.123 is a valid IP)

nevyn avatar Feb 02 '12 15:02 nevyn

Im not sure if I will explain this correctly…

Is the full name "12.23.12.123.office.spotify.net"?

If "12.123.12.123" is considered one part of the name the dots should be escaped like "12.123.12.123". This is how my domain showed with the old back-to-my-mac, "eric.hodel.members.mac.com"

If you don't have control over escaping the name I'll see what I can do to work around it

drbrain avatar Feb 02 '12 20:02 drbrain

Sorry, this time with different escaping: 12\.123\.12\.123 and eric\.hodel.members.mac.com

drbrain avatar Feb 02 '12 20:02 drbrain

I've just hit this issue too:

one_service = DNSSD::Service.new
two_service = DNSSD::Service.new
one_service.register "hereis.myservice", "_testservice._tcp", nil, 8080
two_service.browse("_testservice._tcp") { |b| puts b.inspect }

This fails with ArgumentError: could not construct full service name

The browse reply has:

@name == "hereis"
@type == "myservice._testservice"
@domain == "_tcp.local."

Subsequently passing these values to DNSSD::Service.fullname and on to DNSServiceConstructFullName fails for obvious reasons.

AFAIK the service name can legitimately contain an unescaped dot, and the set_names method on DNSSD::Reply is going to fail when it does, because it does not escape them.

I can patch and submit a PR implementing this if escaping at this stage seems correct? I've only got a passing familiarity with the code and DNSSD in general, so I might have missed something.

mattmacleod avatar Jan 19 '13 16:01 mattmacleod