From: Zdenek Dohnal Date: Wed, 2 Mar 2022 12:42:59 +0000 (+0100) Subject: scheduler/ipp.c: Resolve possible mDNS uri (Fixes #340, #343) X-Git-Tag: v2.4.2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=777c1ec8e51bc385814ba0ef7aeb9d00230fdb8a;p=thirdparty%2Fcups.git scheduler/ipp.c: Resolve possible mDNS uri (Fixes #340, #343) Users sometimes pass URIs from dnssd and driverless backends as a device URI for IPP Everywhere queues. These URIs have mDNS hostnames in it, so they need to be resolved before used in connection. --- diff --git a/CHANGES.md b/CHANGES.md index 2f2bce0ea8..0aa4d904f3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,6 +5,8 @@ Changes in CUPS v2.4.2 (TBA) ---------------------------- - Fixed conditional jump based on uninitialized value in cups/ppd.c (Issue #329) +- mDNS hostname in device uri is not resolved when installaling a permanent + IPP Everywhere queue (Issues #340, #343) Changes in CUPS v2.4.1 (27th January 2020) diff --git a/scheduler/ipp.c b/scheduler/ipp.c index 4f307c2556..35d2a06aed 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -17,6 +17,7 @@ */ #include "cupsd.h" +#include #include #ifdef __APPLE__ @@ -5271,6 +5272,7 @@ create_local_bg_thread( userpass[256], /* User:pass */ host[256], /* Hostname */ resource[1024], /* Resource path */ + uri[1024], /* Resolved URI, unused */ line[1024]; /* Line from PPD */ int port; /* Port number */ http_encryption_t encryption; /* Type of encryption to use */ @@ -5292,7 +5294,7 @@ create_local_bg_thread( cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Generating PPD file from \"%s\"...", printer->name, printer->device_uri); - if (httpSeparateURI(HTTP_URI_CODING_ALL, printer->device_uri, scheme, sizeof(scheme), userpass, sizeof(userpass), host, sizeof(host), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK) + if (httpSeparateURI(HTTP_URI_CODING_ALL, _httpResolveURI(printer->device_uri, uri, sizeof(uri), _HTTP_RESOLVE_DEFAULT, NULL, NULL), scheme, sizeof(scheme), userpass, sizeof(userpass), host, sizeof(host), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK) { cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Bad device URI \"%s\".", printer->name, printer->device_uri); return (NULL);