cups/cups-resolve-uri.patch

32 lines
1.4 KiB
Diff

diff -up cups-2.4.1/scheduler/ipp.c.resolve-uri cups-2.4.1/scheduler/ipp.c
--- cups-2.4.1/scheduler/ipp.c.resolve-uri 2022-03-04 08:13:13.712346134 +0100
+++ cups-2.4.1/scheduler/ipp.c 2022-03-04 08:17:17.486819820 +0100
@@ -5271,6 +5271,7 @@ create_local_bg_thread(
userpass[256], /* User:pass */
host[256], /* Hostname */
resource[1024], /* Resource path */
+ uri[1024], /* Resolved URI, if needed */
line[1024]; /* Line from PPD */
int port; /* Port number */
http_encryption_t encryption; /* Type of encryption to use */
@@ -5292,6 +5293,19 @@ create_local_bg_thread(
cupsdLogMessage(CUPSD_LOG_DEBUG, "%s: Generating PPD file from \"%s\"...", printer->name, printer->device_uri);
+ if (strstr(printer->device_uri, "._tcp"))
+ {
+ cupsdLogMessage(CUPSD_LOG_DEBUG2, "%s: Resolving mDNS URI \"%s\".", printer->name, printer->device_uri);
+
+ if (!_httpResolveURI(printer->device_uri, uri, sizeof(uri), _HTTP_RESOLVE_DEFAULT, NULL, NULL))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Couldn't resolve mDNS URI \"%s\".", printer->name, printer->device_uri);
+ return (NULL);
+ }
+
+ printer->device_uri = 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)
{
cupsdLogMessage(CUPSD_LOG_ERROR, "%s: Bad device URI \"%s\".", printer->name, printer->device_uri);