]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix DNS-SD host name for shared printers on macOS.
authorMichael Sweet <michael.r.sweet@gmail.com>
Wed, 10 Jan 2018 15:49:48 +0000 (10:49 -0500)
committerMichael Sweet <michael.r.sweet@gmail.com>
Wed, 10 Jan 2018 15:49:48 +0000 (10:49 -0500)
CHANGES.md
scheduler/dirsvc.c

index 47730d67890483ac1f837199752aa3f3b4f1a3af..4eee28fed718824f12817c998e92bc26e1583e7b 100644 (file)
@@ -1,4 +1,4 @@
-CHANGES - 2.3b2 - 2018-01-09
+CHANGES - 2.3b2 - 2018-01-10
 ============================
 
 
@@ -10,6 +10,8 @@ Changes in CUPS v2.3b2
 - The `cupsGetDests` and `cupsEnumDests` functions no longer filter out local
   print services like IPP USB devices (Issue #5206)
 - The `ppdInstallableConflict` tested too many constraints (Issue #5213)
+- The scheduler did not add ".local" to the default DNS-SD host name when
+  needed.
 
 
 Changes in CUPS v2.3b1
index 518418a32e677fe2bff40bfe2786f25996c1671b..d01170fc714e4b5bf313b888752baff04522543c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Directory services routines for the CUPS scheduler.
  *
- * Copyright 2007-2017 by Apple Inc.
+ * Copyright 2007-2018 by Apple Inc.
  * Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  * Licensed under Apache License v2.0.  See the file "LICENSE" for more information.
@@ -1463,9 +1463,14 @@ dnssdUpdateDNSSDName(int from_callback)  /* I - Called from callback? */
        if (CFStringGetCString(nameRef, nameBuffer, sizeof(nameBuffer),
                               kCFStringEncodingUTF8))
        {
-         cupsdLogMessage(CUPSD_LOG_DEBUG,
-                         "Dynamic store host name is \"%s\".", nameBuffer);
-         cupsdSetString(&DNSSDHostName, nameBuffer);
+         cupsdLogMessage(CUPSD_LOG_DEBUG, "Dynamic store host name is \"%s\".", nameBuffer);
+
+         if (strchr(nameBuffer, '.'))
+           cupsdSetString(&DNSSDHostName, nameBuffer);
+         else
+           cupsdSetStringf(&DNSSDHostName, "%s.local", nameBuffer);
+
+         cupsdLogMessage(CUPSD_LOG_INFO, "Defaulting to \"DNSSDHostName %s\".", DNSSDHostName);
        }
 
        CFRelease(nameRef);
@@ -1478,9 +1483,10 @@ dnssdUpdateDNSSDName(int from_callback)  /* I - Called from callback? */
       * Use the ServerName instead...
       */
 
-      cupsdLogMessage(CUPSD_LOG_DEBUG,
-                      "Using ServerName \"%s\" as host name.", ServerName);
+      cupsdLogMessage(CUPSD_LOG_DEBUG, "Using ServerName \"%s\" as host name.", ServerName);
       cupsdSetString(&DNSSDHostName, ServerName);
+
+      cupsdLogMessage(CUPSD_LOG_INFO, "Defaulting to \"DNSSDHostName %s\".", DNSSDHostName);
     }
 
    /*
@@ -1527,6 +1533,8 @@ dnssdUpdateDNSSDName(int from_callback)   /* I - Called from callback? */
        cupsdSetString(&DNSSDHostName, ServerName);
       else
        cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
+
+      cupsdLogMessage(CUPSD_LOG_INFO, "Defaulting to \"DNSSDHostName %s\".", DNSSDHostName);
     }
   }
   else
@@ -1540,6 +1548,8 @@ dnssdUpdateDNSSDName(int from_callback)   /* I - Called from callback? */
        cupsdSetString(&DNSSDHostName, ServerName);
       else
        cupsdSetStringf(&DNSSDHostName, "%s.local", ServerName);
+
+      cupsdLogMessage(CUPSD_LOG_INFO, "Defaulting to \"DNSSDHostName %s\".", DNSSDHostName);
     }
   }