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