backport cups-ipptool-mdns-uri.patch from upstream

This commit is contained in:
Zdenek Dohnal 2020-11-02 13:09:49 +01:00
parent d1b1c28d68
commit 68523cbe08
2 changed files with 19 additions and 20 deletions

View File

@ -1,43 +1,39 @@
diff --git a/cups/ipp-vars.c b/cups/ipp-vars.c
index 395b0eb..60aa991 100644
index 395b0eb..d863287 100644
--- a/cups/ipp-vars.c
+++ b/cups/ipp-vars.c
@@ -13,6 +13,7 @@
@@ -12,7 +12,7 @@
* Include necessary headers...
*/
#include <cups/cups.h>
+#include <cups/cups-private.h>
-#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 */
@@ -220,10 +220,22 @@ _ippVarsSet(_ipp_vars_t *v, /* I - IPP variables */
{
if (!strcmp(name, "uri"))
{
char uri[1024]; /* New printer URI */
- char uri[1024]; /* New printer URI */
- http_uri_status_t uri_status; /* URI status */
+ 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"))
+ if (strstr(value, "._tcp"))
+ {
+ /*
+ * Resolve URI...
+ */
+
+ if (!_httpResolveURI(value_uri, resolved, sizeof(resolved), _HTTP_RESOLVE_DEFAULT, NULL, NULL))
+ {
+ if (!_httpResolveURI(value, resolved, sizeof(resolved), _HTTP_RESOLVE_DEFAULT, NULL, NULL))
+ return (0);
+
+ value = resolved;
+ }
+
+ 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)
+ if (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)
return (0);
if (v->username[0])

View File

@ -15,7 +15,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.3.3
Release: 15%{?dist}
Release: 16%{?dist}
License: ASL 2.0
Url: http://www.cups.org/
Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz
@ -765,6 +765,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man7/ippevepcl.7.gz
%changelog
* Mon Nov 02 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.3.3-16
- backport cups-ipptool-mdns-uri.patch from upstream
* Thu Sep 03 2020 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.3.3-14
- revert previous commit - resolved doesn't work with avahi due missing link
in NetworkManager