]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add support for DNSSDHostName configuration directive (Issue #5071)
authorMichael R Sweet <michaelrsweet@gmail.com>
Fri, 3 Nov 2017 14:15:56 +0000 (10:15 -0400)
committerMichael R Sweet <michaelrsweet@gmail.com>
Fri, 3 Nov 2017 14:15:56 +0000 (10:15 -0400)
man/cupsd.conf.man.in
scheduler/conf.c
scheduler/dirsvc.c
xcode/CUPS.xcodeproj/project.pbxproj

index ab89e156a7b761b88a7902137011d7337f5598c7..28eed35e134aa10f3cb64863d96eba3b53d20b08 100644 (file)
@@ -10,7 +10,7 @@
 .\" which should have been included with this file.  If this file is
 .\" file is missing or damaged, see the license at "http://www.cups.org/".
 .\"
-.TH cupsd.conf 5 "CUPS" "19 October 2017" "Apple Inc."
+.TH cupsd.conf 5 "CUPS" "3 November 2017" "Apple Inc."
 .SH NAME
 cupsd.conf \- server configuration file for cups
 .SH DESCRIPTION
@@ -52,6 +52,12 @@ The default access log level is "actions".
 .br
 Specifies whether to purge job history data automatically when it is no longer required for quotas.
 The default is "No".
+.\"#BrowseDNSSDSubTypes
+.TP 5
+.BI BrowseDNSSDSubTypes _subtype[,...]
+Specifies a list of Bonjour sub-types to advertise for each shared printer.
+For example, "BrowseDNSSDSubTypes _cups,_print" will tell network clients that both CUPS sharing and IPP Everywhere are supported.
+The default is "_cups" which is necessary for printer sharing to work between systems using CUPS.
 .\"#BrowseLocalProtocols
 .TP 5
 \fBBrowseLocalProtocols all\fR
@@ -127,6 +133,11 @@ The default is "Yes".
 Specifies the delay for updating of configuration and state files.
 A value of 0 causes the update to happen as soon as possible, typically within a few milliseconds.
 The default value is "30".
+.\"#DNSSDHostName
+.TP 5
+.BI DNSSDHostName hostname.example.com
+Specifies the fully-qualified domain name for the server that is used for Bonjour sharing.
+The default is typically the server's ".local" hostname.
 .\"#ErrorPolicy
 .TP 5
 \fBErrorPolicy abort-job\fR
index bc52d2add18543bb02ac61ae2b6a969021fe4f75..4093d9af12334aa34004691e8d5869fcc9ae89ea 100644 (file)
@@ -83,6 +83,9 @@ static const cupsd_var_t      cupsd_vars[] =
   { "DefaultPolicy",           &DefaultPolicy,         CUPSD_VARTYPE_STRING },
   { "DefaultShared",           &DefaultShared,         CUPSD_VARTYPE_BOOLEAN },
   { "DirtyCleanInterval",      &DirtyCleanInterval,    CUPSD_VARTYPE_TIME },
+#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
+  { "DNSSDHostName",           &DNSSDSubTypes,         CUPSD_VARTYPE_STRING },
+#endif /* HAVE_DNSSD || HAVE_AVAHI */
   { "ErrorPolicy",             &ErrorPolicy,           CUPSD_VARTYPE_STRING },
   { "FilterLimit",             &FilterLimit,           CUPSD_VARTYPE_INTEGER },
   { "FilterNice",              &FilterNice,            CUPSD_VARTYPE_INTEGER },
@@ -746,6 +749,7 @@ cupsdReadConfiguration(void)
 
 #if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
   cupsdSetString(&DNSSDSubTypes, "_cups,_print");
+  cupsdClearString(&DNSSDHostName);
 #endif /* HAVE_DNSSD || HAVE_AVAHI */
 
   cupsdSetString(&LPDConfigFile, CUPS_DEFAULT_LPD_CONFIG_FILE);
index dba2b7f598774bb0a28ed44b83c88e5b16acee22..c6f6be44312da6c91a2d5c607b845f4b0566fd0c 100644 (file)
@@ -1456,23 +1456,24 @@ dnssdUpdateDNSSDName(int from_callback) /* I - Called from callback? */
       cupsdSetString(&DNSSDComputerName, ServerName);
     }
 
-   /*
-    * Get the local hostname from the dynamic store...
-    */
-
-    cupsdClearString(&DNSSDHostName);
-
-    if ((nameRef = SCDynamicStoreCopyLocalHostName(sc)) != NULL)
+    if (!DNSSDHostName)
     {
-      if (CFStringGetCString(nameRef, nameBuffer, sizeof(nameBuffer),
-                            kCFStringEncodingUTF8))
+     /*
+      * Get the local hostname from the dynamic store...
+      */
+
+      if ((nameRef = SCDynamicStoreCopyLocalHostName(sc)) != NULL)
       {
-        cupsdLogMessage(CUPSD_LOG_DEBUG,
-                       "Dynamic store host name is \"%s\".", nameBuffer);
-       cupsdSetString(&DNSSDHostName, nameBuffer);
-      }
+       if (CFStringGetCString(nameRef, nameBuffer, sizeof(nameBuffer),
+                              kCFStringEncodingUTF8))
+       {
+         cupsdLogMessage(CUPSD_LOG_DEBUG,
+                         "Dynamic store host name is \"%s\".", nameBuffer);
+         cupsdSetString(&DNSSDHostName, nameBuffer);
+       }
 
-      CFRelease(nameRef);
+       CFRelease(nameRef);
+      }
     }
 
     if (!DNSSDHostName)
@@ -1517,26 +1518,33 @@ dnssdUpdateDNSSDName(int from_callback) /* I - Called from callback? */
   if (DNSSDClient)
   {
     const char *host_name = avahi_client_get_host_name(DNSSDClient);
-    const char *host_fqdn = avahi_client_get_host_name_fqdn(DNSSDClient);
 
     cupsdSetString(&DNSSDComputerName, host_name ? host_name : ServerName);
 
-    if (host_fqdn)
-      cupsdSetString(&DNSSDHostName, host_fqdn);
-    else if (strchr(ServerName, '.'))
-      cupsdSetString(&DNSSDHostName, ServerName);
-    else
-      cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
+    if (!DNSSDHostName)
+    {
+      const char *host_fqdn = avahi_client_get_host_name_fqdn(DNSSDClient);
+
+      if (host_fqdn)
+       cupsdSetString(&DNSSDHostName, host_fqdn);
+      else if (strchr(ServerName, '.'))
+       cupsdSetString(&DNSSDHostName, ServerName);
+      else
+       cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
+    }
   }
   else
 #  endif /* HAVE_AVAHI */
   {
     cupsdSetString(&DNSSDComputerName, ServerName);
 
-    if (strchr(ServerName, '.'))
-      cupsdSetString(&DNSSDHostName, ServerName);
-    else
-      cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
+    if (!DNSSDHostName)
+    {
+      if (strchr(ServerName, '.'))
+       cupsdSetString(&DNSSDHostName, ServerName);
+      else
+       cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
+    }
   }
 
  /*
index 9a8c27fd5134bd71fd87bbab8fcd82d8528de01e..b057da2c92e591f3af68e012e259c4d95aabd50c 100644 (file)
                728FB7EC1536161C005426E1 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
                728FB7EF1536167A005426E1 /* libiconv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libiconv.dylib; path = /usr/lib/libiconv.dylib; sourceTree = "<absolute>"; };
                728FB7F01536167A005426E1 /* libresolv.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libresolv.dylib; path = /usr/lib/libresolv.dylib; sourceTree = "<absolute>"; };
-               729D4B561A2CB48700692B21 /* CHANGES-2.0.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "CHANGES-2.0.txt"; path = "../CHANGES-2.0.txt"; sourceTree = "<group>"; };
                72A4332F155844CF002E172D /* libcups_static.a */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libcups_static.a; sourceTree = BUILT_PRODUCTS_DIR; };
                72A8B3D61C188BDE00A1A547 /* ppd-util.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = "ppd-util.c"; path = "../cups/ppd-util.c"; sourceTree = "<group>"; };
                72C16CB8137B195D007E4BF4 /* file.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = file.c; path = ../scheduler/file.c; sourceTree = SOURCE_ROOT; };
                72E65BD818DC818400097E89 /* org.cups.cupsd.socket.in */ = {isa = PBXFileReference; lastKnownFileType = text; name = org.cups.cupsd.socket.in; path = ../scheduler/org.cups.cupsd.socket.in; sourceTree = SOURCE_ROOT; };
                72E65BD918DC850A00097E89 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../Makefile; sourceTree = "<group>"; };
                72E65BDC18DC852700097E89 /* Makefile */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.make; name = Makefile; path = ../scheduler/Makefile; sourceTree = SOURCE_ROOT; };
-               72E65BDD18DCA35700097E89 /* CHANGES-1.7.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = "CHANGES-1.7.txt"; path = "../CHANGES-1.7.txt"; sourceTree = "<group>"; };
                72E65BDE18DCA35700097E89 /* CHANGES.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CHANGES.md; path = ../CHANGES.md; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = "<none>"; };
                72E65BDF18DCA35700097E89 /* CREDITS.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = CREDITS.md; path = ../CREDITS.md; sourceTree = "<group>"; };
                72E65BE018DCA35700097E89 /* INSTALL.md */ = {isa = PBXFileReference; lastKnownFileType = net.daringfireball.markdown; name = INSTALL.md; path = ../INSTALL.md; sourceTree = "<group>"; };
                                72E65BC818DC7A6B00097E89 /* api-ppd.shtml */,
                                72E65BCB18DC7A9800097E89 /* api-raster.header */,
                                72E65BCC18DC7A9800097E89 /* api-raster.shtml */,
-                               72E65BDD18DCA35700097E89 /* CHANGES-1.7.txt */,
-                               729D4B561A2CB48700692B21 /* CHANGES-2.0.txt */,
                                72E65BDE18DCA35700097E89 /* CHANGES.md */,
                                72E65BDF18DCA35700097E89 /* CREDITS.md */,
                                274561471F545B2E000378E4 /* cupspm.md */,