|
|
55c9869 |
diff -up cups-1.6.2/cups/http-support.c.avahi-address cups-1.6.2/cups/http-support.c
|
|
|
55c9869 |
--- cups-1.6.2/cups/http-support.c.avahi-address 2013-03-11 18:44:36.000000000 +0000
|
|
|
55c9869 |
+++ cups-1.6.2/cups/http-support.c 2013-04-04 15:39:06.651847041 +0100
|
|
|
55c9869 |
@@ -2121,7 +2121,7 @@ http_resolve_cb(
|
|
|
55c9869 |
const char *type, /* I - Registration type */
|
|
|
55c9869 |
const char *domain, /* I - Domain (unused) */
|
|
|
55c9869 |
const char *hostTarget, /* I - Hostname */
|
|
|
55c9869 |
- const AvahiAddress *address, /* I - Address (unused) */
|
|
|
55c9869 |
+ const AvahiAddress *address, /* I - Address */
|
|
|
55c9869 |
uint16_t port, /* I - Port number */
|
|
|
55c9869 |
AvahiStringList *txt, /* I - TXT record */
|
|
|
55c9869 |
AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */
|
|
|
55c9869 |
@@ -2253,36 +2253,37 @@ http_resolve_cb(
|
|
|
55c9869 |
|
|
|
55c9869 |
DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
|
|
|
55c9869 |
|
|
|
55c9869 |
- snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
|
|
|
55c9869 |
- if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
|
|
|
55c9869 |
+ int error = getnameinfo(&(address->data),
|
|
|
55c9869 |
+ address->proto == AVAHI_PROTO_INET ?
|
|
|
55c9869 |
+ sizeof (AvahiIPv4Address) :
|
|
|
55c9869 |
+ (address->proto == AVAHI_PROTO_INET6 ?
|
|
|
55c9869 |
+ sizeof (AvahiIPv6Address) :
|
|
|
55c9869 |
+ sizeof (address->data)),
|
|
|
55c9869 |
+ fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
|
|
|
55c9869 |
+
|
|
|
55c9869 |
+ if (!error)
|
|
|
55c9869 |
{
|
|
|
55c9869 |
- for (addr = addrlist; addr; addr = addr->next)
|
|
|
55c9869 |
+ DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
|
|
|
55c9869 |
+
|
|
|
55c9869 |
+ if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
|
|
|
55c9869 |
+ _cups_strcasecmp(hostptr, ".local"))
|
|
|
55c9869 |
{
|
|
|
55c9869 |
- int error = getnameinfo(&(addr->addr.addr),
|
|
|
55c9869 |
- httpAddrLength(&(addr->addr)),
|
|
|
55c9869 |
- fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
|
|
|
55c9869 |
-
|
|
|
55c9869 |
- if (!error)
|
|
|
55c9869 |
- {
|
|
|
55c9869 |
- DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
|
|
|
55c9869 |
-
|
|
|
55c9869 |
- if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
|
|
|
55c9869 |
- _cups_strcasecmp(hostptr, ".local"))
|
|
|
55c9869 |
- {
|
|
|
55c9869 |
- hostTarget = fqdn;
|
|
|
55c9869 |
- break;
|
|
|
55c9869 |
- }
|
|
|
55c9869 |
- }
|
|
|
55c9869 |
+ hostTarget = fqdn;
|
|
|
55c9869 |
+ }
|
|
|
55c9869 |
+ }
|
|
|
55c9869 |
#ifdef DEBUG
|
|
|
55c9869 |
- else
|
|
|
55c9869 |
- DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
|
|
|
55c9869 |
- httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
|
|
|
55c9869 |
- error));
|
|
|
55c9869 |
+ else
|
|
|
55c9869 |
+ DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
|
|
|
55c9869 |
+ httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
|
|
|
55c9869 |
+ error));
|
|
|
55c9869 |
#endif /* DEBUG */
|
|
|
55c9869 |
- }
|
|
|
55c9869 |
+ } else {
|
|
|
55c9869 |
+ /*
|
|
|
55c9869 |
+ * Use the IP address that responded...
|
|
|
55c9869 |
+ */
|
|
|
55c9869 |
|
|
|
55c9869 |
- httpAddrFreeList(addrlist);
|
|
|
55c9869 |
- }
|
|
|
55c9869 |
+ avahi_address_snprint (fqdn, sizeof (fqdn), address);
|
|
|
55c9869 |
+ hostTarget = fqdn;
|
|
|
55c9869 |
}
|
|
|
55c9869 |
|
|
|
55c9869 |
/*
|