From 8b7ff199319ef29c5a7eab147b9567bb88e19190 Mon Sep 17 00:00:00 2001 From: Zdenek Dohnal Date: Thu, 11 Jun 2020 10:34:41 +0200 Subject: [PATCH] ipptool doesn't support mdns uris --- cups-ipptool-mdns-uri.patch | 43 +++++++++++++++++++++++++++++++++++++ cups.spec | 5 +++++ 2 files changed, 48 insertions(+) create mode 100644 cups-ipptool-mdns-uri.patch diff --git a/cups-ipptool-mdns-uri.patch b/cups-ipptool-mdns-uri.patch new file mode 100644 index 0000000..6919e96 --- /dev/null +++ b/cups-ipptool-mdns-uri.patch @@ -0,0 +1,43 @@ +diff --git a/cups/ipp-vars.c b/cups/ipp-vars.c +index 395b0eb..60aa991 100644 +--- a/cups/ipp-vars.c ++++ b/cups/ipp-vars.c +@@ -13,6 +13,7 @@ + */ + + #include ++#include + #include "ipp-private.h" + #include "string-private.h" + #include "debug-internal.h" +@@ -221,9 +222,29 @@ _ippVarsSet(_ipp_vars_t *v, /* I - IPP variables */ + if (!strcmp(name, "uri")) + { + char uri[1024]; /* New printer URI */ ++ char resolved[1024]; /* Resolved mDNS URI */ ++ char value_uri[1024]; /* URI from value */ + http_uri_status_t uri_status; /* URI status */ + +- if ((uri_status = httpSeparateURI(HTTP_URI_CODING_ALL, value, v->scheme, sizeof(v->scheme), v->username, sizeof(v->username), v->host, sizeof(v->host), &(v->port), v->resource, sizeof(v->resource))) < HTTP_URI_STATUS_OK) ++ snprintf(value_uri, sizeof(value_uri), "%s", value); ++ value_uri[1023] = '\0'; ++ ++ if (strstr(value_uri, "._tcp")) ++ { ++ /* ++ * Resolve URI... ++ */ ++ ++ if (!_httpResolveURI(value_uri, resolved, sizeof(resolved), _HTTP_RESOLVE_DEFAULT, NULL, NULL)) ++ { ++ return (0); ++ } ++ ++ snprintf(value_uri, sizeof(value_uri), "%s", resolved); ++ value_uri[1023] = '\0'; ++ } ++ ++ if ((uri_status = httpSeparateURI(HTTP_URI_CODING_ALL, value_uri, v->scheme, sizeof(v->scheme), v->username, sizeof(v->username), v->host, sizeof(v->host), &(v->port), v->resource, sizeof(v->resource))) < HTTP_URI_STATUS_OK) + return (0); + + if (v->username[0]) diff --git a/cups.spec b/cups.spec index 0c0bf90..ae3c969 100644 --- a/cups.spec +++ b/cups.spec @@ -106,6 +106,9 @@ Patch26: cups-etimedout.patch # cgi script creates a bad uri in web ui # https://github.com/apple/cups/pull/5792 Patch27: cups-webui-uri.patch +# ipptool doesn't support mdns uris +# https://github.com/apple/cups/pull/5793 +Patch28: cups-ipptool-mdns-uri.patch # selinux and audit enablement for CUPS - needs work and CUPS upstream wants # to have these features implemented their way in the future @@ -323,6 +326,7 @@ to CUPS daemon. This solution will substitute printer drivers and raw queues in # https://github.com/apple/cups/pull/5782 %patch26 -p1 -b .etimedout %patch27 -p1 -b .webui-uri +%patch28 -p1 -b .ipptool-mdns-uri #### UPSTREAMED PATCHES #### @@ -754,6 +758,7 @@ rm -f %{cups_serverbin}/backend/smb * Thu Jun 11 2020 Zdenek Dohnal - 1:2.3.3-6 - fix patch errors in failover patch - cgi script creates a bad uri in web ui +- ipptool doesn't support mdns uris * Tue Jun 02 2020 Zdenek Dohnal - 1:2.3.3-5 - remove os ci tests, we use baseos ci