summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.md2
-rw-r--r--man/ippeveprinter.13
-rw-r--r--tools/ippeveprinter.c15
3 files changed, 16 insertions, 4 deletions
diff --git a/CHANGES.md b/CHANGES.md
index f526061a0..d129605d3 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -20,6 +20,8 @@ Changes in CUPS v2.3.1
permissions are wrong (Issue #5658)
- Added paint can labels to Dymo driver (Issue #5662)
- The `ippeveprinter` program now supports authentication (Issue #5665)
+- The `ippeveprinter` program now advertises DNS-SD services on the correct
+ interfaces, and provides a way to turn them off (Issue #5666)
- The `--with-dbusdir` option was ignored by the configure script (Issue #5671)
- Sandboxed applications were not able to get the default printer (Issue #5676)
- Log file access controls were not preserved by `cupsctl` (Issue #5677)
diff --git a/man/ippeveprinter.1 b/man/ippeveprinter.1
index 6fc30d3ec..28e54acc4 100644
--- a/man/ippeveprinter.1
+++ b/man/ippeveprinter.1
@@ -182,6 +182,9 @@ command.
Specifies the port number to listen on.
The default is a user-specific number from 8000 to 8999.
.TP 5
+.B \-r off
+Turns off DNS-SD service advertisements entirely.
+.TP 5
\fB\-r \fIsubtype[,subtype]\fR
Specifies the DNS-SD subtype(s) to advertise.
Separate multiple subtypes with a comma.
diff --git a/tools/ippeveprinter.c b/tools/ippeveprinter.c
index a35c7321d..930331e0f 100644
--- a/tools/ippeveprinter.c
+++ b/tools/ippeveprinter.c
@@ -6743,6 +6743,10 @@ register_printer(
urf[252], /* List of supported URF values */
*ptr; /* Pointer into string */
+
+ if (!strcmp(subtypes, "off"))
+ return (1);
+
color_supported = ippFindAttribute(printer->attrs, "color-supported", IPP_TAG_BOOLEAN);
document_format_supported = ippFindAttribute(printer->attrs, "document-format-supported", IPP_TAG_MIMETYPE);
printer_location = ippFindAttribute(printer->attrs, "printer-location", IPP_TAG_TEXT);
@@ -6788,6 +6792,7 @@ register_printer(
#ifdef HAVE_DNSSD
DNSServiceErrorType error; /* Error from Bonjour */
char regtype[256]; /* Bonjour service type */
+ uint32_t interface; /* Interface index */
/*
@@ -6820,9 +6825,11 @@ register_printer(
* defend our service name but not actually support LPD...
*/
+ interface = !strcmp(printer->hostname, "localhost") ? kDNSServiceInterfaceIndexLocalOnly : kDNSServiceInterfaceIndexAny;
+
printer->printer_ref = DNSSDMaster;
- if ((error = DNSServiceRegister(&(printer->printer_ref), kDNSServiceFlagsShareConnection, 0 /* interfaceIndex */, printer->dnssd_name, "_printer._tcp", NULL /* domain */, NULL /* host */, 0 /* port */, 0 /* txtLen */, NULL /* txtRecord */, (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
+ if ((error = DNSServiceRegister(&(printer->printer_ref), kDNSServiceFlagsShareConnection, interface, printer->dnssd_name, "_printer._tcp", NULL /* domain */, NULL /* host */, 0 /* port */, 0 /* txtLen */, NULL /* txtRecord */, (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
{
_cupsLangPrintf(stderr, _("Unable to register \"%s.%s\": %d"), printer->dnssd_name, "_printer._tcp", error);
return (0);
@@ -6840,7 +6847,7 @@ register_printer(
else
strlcpy(regtype, "_ipp._tcp", sizeof(regtype));
- if ((error = DNSServiceRegister(&(printer->ipp_ref), kDNSServiceFlagsShareConnection, 0 /* interfaceIndex */, printer->dnssd_name, regtype, NULL /* domain */, NULL /* host */, htons(printer->port), TXTRecordGetLength(&ipp_txt), TXTRecordGetBytesPtr(&ipp_txt), (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
+ if ((error = DNSServiceRegister(&(printer->ipp_ref), kDNSServiceFlagsShareConnection, interface, printer->dnssd_name, regtype, NULL /* domain */, NULL /* host */, htons(printer->port), TXTRecordGetLength(&ipp_txt), TXTRecordGetBytesPtr(&ipp_txt), (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
{
_cupsLangPrintf(stderr, _("Unable to register \"%s.%s\": %d"), printer->dnssd_name, regtype, error);
return (0);
@@ -6859,7 +6866,7 @@ register_printer(
else
strlcpy(regtype, "_ipps._tcp", sizeof(regtype));
- if ((error = DNSServiceRegister(&(printer->ipps_ref), kDNSServiceFlagsShareConnection, 0 /* interfaceIndex */, printer->dnssd_name, regtype, NULL /* domain */, NULL /* host */, htons(printer->port), TXTRecordGetLength(&ipp_txt), TXTRecordGetBytesPtr(&ipp_txt), (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
+ if ((error = DNSServiceRegister(&(printer->ipps_ref), kDNSServiceFlagsShareConnection, interface, printer->dnssd_name, regtype, NULL /* domain */, NULL /* host */, htons(printer->port), TXTRecordGetLength(&ipp_txt), TXTRecordGetBytesPtr(&ipp_txt), (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
{
_cupsLangPrintf(stderr, _("Unable to register \"%s.%s\": %d"), printer->dnssd_name, regtype, error);
return (0);
@@ -6873,7 +6880,7 @@ register_printer(
printer->http_ref = DNSSDMaster;
- if ((error = DNSServiceRegister(&(printer->http_ref), kDNSServiceFlagsShareConnection, 0 /* interfaceIndex */, printer->dnssd_name, "_http._tcp,_printer", NULL /* domain */, NULL /* host */, htons(printer->port), 0 /* txtLen */, NULL /* txtRecord */, (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
+ if ((error = DNSServiceRegister(&(printer->http_ref), kDNSServiceFlagsShareConnection, interface, printer->dnssd_name, "_http._tcp,_printer", NULL /* domain */, NULL /* host */, htons(printer->port), 0 /* txtLen */, NULL /* txtRecord */, (DNSServiceRegisterReply)dnssd_callback, printer)) != kDNSServiceErr_NoError)
{
_cupsLangPrintf(stderr, _("Unable to register \"%s.%s\": %d"), printer->dnssd_name, "_http._tcp,_printer", error);
return (0);