Merge branch 'f19'

This commit is contained in:
Tim Waugh 2013-06-28 17:10:11 +01:00
commit 0c4a9f19c4
2 changed files with 51 additions and 28 deletions

View File

@ -1,6 +1,6 @@
diff -up cups-1.6.2/cups/http-support.c.avahi-address cups-1.6.2/cups/http-support.c 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.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 +++ cups-1.6.2/cups/http-support.c 2013-06-28 13:42:15.834715511 +0100
@@ -2121,7 +2121,7 @@ http_resolve_cb( @@ -2121,7 +2121,7 @@ http_resolve_cb(
const char *type, /* I - Registration type */ const char *type, /* I - Registration type */
const char *domain, /* I - Domain (unused) */ const char *domain, /* I - Domain (unused) */
@ -10,34 +10,54 @@ diff -up cups-1.6.2/cups/http-support.c.avahi-address cups-1.6.2/cups/http-suppo
uint16_t port, /* I - Port number */ uint16_t port, /* I - Port number */
AvahiStringList *txt, /* I - TXT record */ AvahiStringList *txt, /* I - TXT record */
AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */ AvahiLookupResultFlags flags, /* I - Lookup flags (unused) */
@@ -2253,36 +2253,37 @@ http_resolve_cb( @@ -2248,41 +2248,59 @@ http_resolve_cb(
* getting the IP address of the .local name and then do reverse-lookups...
*/
- http_addrlist_t *addrlist, /* List of addresses */
- *addr; /* Current address */
+ http_addr_t addr;
+ size_t addrlen;
+ int error;
DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget)); DEBUG_printf(("8http_resolve_cb: Looking up \"%s\".", hostTarget));
- snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port)); - snprintf(fqdn, sizeof(fqdn), "%d", ntohs(port));
- if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL) - if ((addrlist = httpAddrGetList(hostTarget, AF_UNSPEC, fqdn)) != NULL)
+ int error = getnameinfo(&(address->data), + switch (address->proto)
+ address->proto == AVAHI_PROTO_INET ? {
+ sizeof (AvahiIPv4Address) : - for (addr = addrlist; addr; addr = addr->next)
+ (address->proto == AVAHI_PROTO_INET6 ? + case AVAHI_PROTO_INET:
+ sizeof (AvahiIPv6Address) : + addr.ipv4.sin_family = AF_INET;
+ sizeof (address->data)), + addrlen = sizeof (addr.ipv4.sin_addr);
+ memcpy (&addr.ipv4.sin_addr, &address->data, addrlen);
+ break;
+ case AVAHI_PROTO_INET6:
+ addr.ipv6.sin6_family = AF_INET6;
+ addrlen = sizeof (addr.ipv6.sin6_addr);
+ memcpy (&addr.ipv6.sin6_addr, &address->data, addrlen);
+ break;
+ default:
+ DEBUG_printf(("8http_resolve_cb: unknown address family %d",
+ address->proto));
+ addrlen = 0;
+ }
+
+ if (addrlen > 0) {
+ error = getnameinfo(&addr.addr, httpAddrLength (&addr),
+ fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD); + fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
+ +
+ if (!error) + 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), - int error = getnameinfo(&(addr->addr.addr),
- httpAddrLength(&(addr->addr)), - httpAddrLength(&(addr->addr)),
- fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD); - fqdn, sizeof(fqdn), NULL, 0, NI_NAMEREQD);
- + DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
- if (!error) - if (!error)
- { + if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
+ _cups_strcasecmp(hostptr, ".local"))
{
- DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn)); - DEBUG_printf(("8http_resolve_cb: Found \"%s\".", fqdn));
- -
- if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn || - if ((hostptr = fqdn + strlen(fqdn) - 6) <= fqdn ||
@ -46,28 +66,28 @@ diff -up cups-1.6.2/cups/http-support.c.avahi-address cups-1.6.2/cups/http-suppo
- hostTarget = fqdn; - hostTarget = fqdn;
- break; - break;
- } - }
- }
+ hostTarget = fqdn; + hostTarget = fqdn;
+ } }
+ } + } else {
+ avahi_address_snprint (fqdn, sizeof (fqdn), address);
+ hostTarget = fqdn;
#ifdef DEBUG #ifdef DEBUG
- else - else
- DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d", - DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
- httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)), - httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)),
- error)); - error));
+ else
+ DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d", + DEBUG_printf(("8http_resolve_cb: \"%s\" did not resolve: %d",
+ httpAddrString(&(addr->addr), fqdn, sizeof(fqdn)), + fqdn, error));
+ error));
#endif /* DEBUG */ #endif /* DEBUG */
- } }
-
- httpAddrFreeList(addrlist);
}
+ } else { + } else {
+ /* + /*
+ * Use the IP address that responded... + * Use the IP address that responded...
+ */ + */
+
- httpAddrFreeList(addrlist);
- }
+ avahi_address_snprint (fqdn, sizeof (fqdn), address); + avahi_address_snprint (fqdn, sizeof (fqdn), address);
+ hostTarget = fqdn; + hostTarget = fqdn;
} }

View File

@ -14,7 +14,7 @@ Summary: CUPS printing system
Name: cups Name: cups
Epoch: 1 Epoch: 1
Version: 1.7 Version: 1.7
Release: 0.11.%{prever}%{?dist} Release: 0.12.%{prever}%{?dist}
License: GPLv2 License: GPLv2
Group: System Environment/Daemons Group: System Environment/Daemons
Url: http://www.cups.org/ Url: http://www.cups.org/
@ -638,6 +638,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz %{_mandir}/man5/ipptoolfile.5.gz
%changelog %changelog
* Fri Jun 28 2013 Tim Waugh <twaugh@redhat.com> 1:1.7-0.12.b1
- Fix for DNSSD name resolution.
* Wed Jun 26 2013 Tim Waugh <twaugh@redhat.com> 1:1.7-0.11.b1 * Wed Jun 26 2013 Tim Waugh <twaugh@redhat.com> 1:1.7-0.11.b1
- Default to IPP/1.1 for now (bug #977813). - Default to IPP/1.1 for now (bug #977813).