ipptool doesn't support mdns uris

This commit is contained in:
Zdenek Dohnal 2020-06-11 10:34:41 +02:00
parent 5e54701556
commit 8b7ff19931
2 changed files with 48 additions and 0 deletions

View File

@ -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 <cups/cups.h>
+#include <cups/cups-private.h>
#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])

View File

@ -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 <zdohnal@redhat.com> - 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 <zdohnal@redhat.com> - 1:2.3.3-5
- remove os ci tests, we use baseos ci