]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/conf.c
Merge changes from CUPS 1.6svn-r9939.
[thirdparty/cups.git] / scheduler / conf.c
index b85c79ce663b05311d17ca0ed62b7ee5919b2c17..2d30822b9531f71d9d248fb2f1902ce81559ac93 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Configuration routines for the CUPS scheduler.
  *
- *   Copyright 2007-2010 by Apple Inc.
+ *   Copyright 2007-2011 by Apple Inc.
  *   Copyright 1997-2007 by Easy Software Products, all rights reserved.
  *
  *   These coded instructions, statements, and computer programs are the
@@ -21,6 +21,7 @@
  *   cupsdReadConfiguration() - Read the cupsd.conf file.
  *   get_address()            - Get an address + port number from a line.
  *   get_addr_and_mask()      - Get an IP address and netmask.
+ *   mime_error_cb()          - Log a MIME error.
  *   parse_aaa()              - Parse authentication, authorization, and access
  *                              control lines.
  *   parse_fatal_errors()     - Parse FatalErrors values in a string.
@@ -84,6 +85,9 @@ static const cupsd_var_t      variables[] =
 {
   { "AccessLog",               &AccessLog,             CUPSD_VARTYPE_STRING },
   { "AutoPurgeJobs",           &JobAutoPurge,          CUPSD_VARTYPE_BOOLEAN },
+#ifdef HAVE_DNSSD
+  { "BrowseDNSSDRegType",      &DNSSDRegType,          CUPSD_VARTYPE_STRING },
+#endif /* HAVE_DNSSD */
   { "BrowseInterval",          &BrowseInterval,        CUPSD_VARTYPE_INTEGER },
 #ifdef HAVE_LDAP
   { "BrowseLDAPBindDN",                &BrowseLDAPBindDN,      CUPSD_VARTYPE_STRING },
@@ -145,7 +149,6 @@ static const cupsd_var_t    variables[] =
   { "MaxJobsPerUser",          &MaxJobsPerUser,        CUPSD_VARTYPE_INTEGER },
   { "MaxLeaseDuration",                &MaxLeaseDuration,      CUPSD_VARTYPE_INTEGER },
   { "MaxLogSize",              &MaxLogSize,            CUPSD_VARTYPE_INTEGER },
-  { "MaxPrinterHistory",       &MaxPrinterHistory,     CUPSD_VARTYPE_INTEGER },
   { "MaxRequestSize",          &MaxRequestSize,        CUPSD_VARTYPE_INTEGER },
   { "MaxSubscriptions",                &MaxSubscriptions,      CUPSD_VARTYPE_INTEGER },
   { "MaxSubscriptionsPerJob",  &MaxSubscriptionsPerJob,        CUPSD_VARTYPE_INTEGER },
@@ -180,7 +183,8 @@ static const cupsd_var_t    variables[] =
 #endif /* HAVE_AUTHORIZATION_H */
   { "TempDir",                 &TempDir,               CUPSD_VARTYPE_PATHNAME },
   { "Timeout",                 &Timeout,               CUPSD_VARTYPE_INTEGER },
-  { "UseNetworkDefault",       &UseNetworkDefault,     CUPSD_VARTYPE_BOOLEAN }
+  { "UseNetworkDefault",       &UseNetworkDefault,     CUPSD_VARTYPE_BOOLEAN },
+  { "WebInterface",            &WebInterface,          CUPSD_VARTYPE_BOOLEAN }
 };
 #define NUM_VARS       (sizeof(variables) / sizeof(variables[0]))
 
@@ -202,6 +206,7 @@ static const unsigned       zeros[4] =
 static http_addrlist_t *get_address(const char *value, int defport);
 static int             get_addr_and_mask(const char *value, unsigned *ip,
                                          unsigned *mask);
+static void            mime_error_cb(void *ctx, const char *message);
 static int             parse_aaa(cupsd_location_t *loc, char *line,
                                  char *value, int linenum);
 static int             parse_fatal_errors(const char *s);
@@ -315,16 +320,16 @@ cupsdCheckPermissions(
 
   if (!dir_created && !is_dir && !S_ISREG(fileinfo.st_mode))
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR, "\"%s\" is not a regular file!", filename);
+    cupsdLogMessage(CUPSD_LOG_ERROR, "\"%s\" is not a regular file.", filename);
     return (-1);
   }
 
   if (!dir_created && is_dir && !S_ISDIR(fileinfo.st_mode))
   {
     if (create_dir >= 0)
-      cupsdLogMessage(CUPSD_LOG_ERROR, "\"%s\" is not a directory!", filename);
+      cupsdLogMessage(CUPSD_LOG_ERROR, "\"%s\" is not a directory.", filename);
     else
-      syslog(LOG_ERR, "\"%s\" is not a directory!", filename);
+      syslog(LOG_ERR, "\"%s\" is not a directory.", filename);
 
     return (-1);
   }
@@ -491,16 +496,17 @@ cupsdReadConfiguration(void)
   cupsdSetString(&DataDir, CUPS_DATADIR);
   cupsdSetString(&DocumentRoot, CUPS_DOCROOT);
   cupsdSetString(&AccessLog, CUPS_LOGDIR "/access_log");
-  cupsdSetString(&ErrorLog, CUPS_LOGDIR "/error_log");
+  cupsdClearString(&ErrorLog);
   cupsdSetString(&PageLog, CUPS_LOGDIR "/page_log");
   cupsdSetString(&PageLogFormat,
-                 "%p %j %u %T %P %C %{job-billing} "
+                 "%p %u %j %T %P %C %{job-billing} "
                 "%{job-originating-host-name} %{job-name} %{media} %{sides}");
   cupsdSetString(&Printcap, CUPS_DEFAULT_PRINTCAP);
   cupsdSetString(&PrintcapGUI, "/usr/bin/glpoptions");
   cupsdSetString(&FontPath, CUPS_FONTPATH);
   cupsdSetString(&RemoteRoot, "remroot");
-  cupsdSetString(&ServerHeader, "CUPS/1.4");
+  cupsdSetStringf(&ServerHeader, "CUPS/%d.%d", CUPS_VERSION_MAJOR,
+                  CUPS_VERSION_MINOR);
   cupsdSetString(&StateDir, CUPS_STATEDIR);
 
   if (!strcmp(CUPS_DEFAULT_PRINTCAP, "/etc/printers.conf"))
@@ -538,7 +544,7 @@ cupsdReadConfiguration(void)
 
   cupsdClearString(&DefaultPaperSize);
 
-  cupsdSetString(&RIPCache, "8m");
+  cupsdSetString(&RIPCache, "128m");
 
   cupsdSetString(&TempDir, NULL);
 
@@ -625,13 +631,13 @@ cupsdReadConfiguration(void)
   MaxClients               = 100;
   MaxClientsPerHost        = 0;
   MaxLogSize               = 1024 * 1024;
-  MaxPrinterHistory        = 0;
   MaxRequestSize           = 0;
   MultipleOperationTimeout = DEFAULT_TIMEOUT;
   ReloadTimeout                   = DEFAULT_KEEPALIVE;
   RootCertDuration         = 300;
   Timeout                  = DEFAULT_TIMEOUT;
   NumSystemGroups          = 0;
+  WebInterface             = CUPS_DEFAULT_WEBIF;
 
   BrowseInterval           = DEFAULT_INTERVAL;
   BrowsePort               = ippPort();
@@ -643,6 +649,10 @@ cupsdReadConfiguration(void)
   Browsing                 = CUPS_DEFAULT_BROWSING;
   DefaultShared            = CUPS_DEFAULT_DEFAULT_SHARED;
 
+#ifdef HAVE_DNSSD
+  cupsdSetString(&DNSSDRegType, "_ipp._tcp,_cups");
+#endif /* HAVE_DNSSD */
+
   cupsdSetString(&LPDConfigFile, CUPS_DEFAULT_LPD_CONFIG_FILE);
   cupsdSetString(&SMBConfigFile, CUPS_DEFAULT_SMB_CONFIG_FILE);
 
@@ -688,6 +698,12 @@ cupsdReadConfiguration(void)
   LaunchdTimeout = DEFAULT_TIMEOUT + 10;
 #endif /* HAVE_LAUNCHD */
 
+ /*
+  * Setup environment variables...
+  */
+
+  cupsdInitEnv();
+
  /*
   * Read the configuration file...
   */
@@ -702,6 +718,9 @@ cupsdReadConfiguration(void)
   if (!status)
     return (0);
 
+  if (!ErrorLog)
+    cupsdSetString(&ErrorLog, CUPS_LOGDIR "/error_log");
+
   RunUser = getuid();
 
   cupsdLogMessage(CUPSD_LOG_INFO, "Remote access is %s.",
@@ -744,7 +763,7 @@ cupsdReadConfiguration(void)
 
       if ((host = gethostbyname(temp)) != NULL)
       {
-        if (strcasecmp(temp, host->h_name))
+        if (_cups_strcasecmp(temp, host->h_name))
         {
          cupsdSetString(&ServerName, host->h_name);
          cupsdAddAlias(ServerAlias, host->h_name);
@@ -755,7 +774,7 @@ cupsdReadConfiguration(void)
         if (host->h_aliases)
        {
           for (i = 0; host->h_aliases[i]; i ++)
-           if (strcasecmp(temp, host->h_aliases[i]))
+           if (_cups_strcasecmp(temp, host->h_aliases[i]))
            {
              cupsdAddAlias(ServerAlias, host->h_aliases[i]);
              cupsdLogMessage(CUPSD_LOG_DEBUG, "Added auto ServerAlias %s",
@@ -830,6 +849,19 @@ cupsdReadConfiguration(void)
     openlog("cupsd", LOG_PID | LOG_NOWAIT | LOG_NDELAY, LOG_LPR);
 #endif /* HAVE_VSYSLOG */
 
+ /*
+  * Make sure each of the log files exists and gets rotated as necessary...
+  */
+
+  if (strcmp(AccessLog, "syslog"))
+    cupsdCheckLogFile(&AccessFile, AccessLog);
+
+  if (strcmp(ErrorLog, "syslog"))
+    cupsdCheckLogFile(&ErrorFile, ErrorLog);
+
+  if (strcmp(PageLog, "syslog"))
+    cupsdCheckLogFile(&PageFile, PageLog);
+
  /*
   * Log the configuration file that was used...
   */
@@ -856,7 +888,7 @@ cupsdReadConfiguration(void)
       */
 
       cupsdLogMessage(CUPSD_LOG_NOTICE,
-                      "Group and SystemGroup cannot use the same groups!");
+                      "Group and SystemGroup cannot use the same groups.");
       cupsdLogMessage(CUPSD_LOG_INFO, "Resetting Group to \"nobody\"...");
 
       group = getgrnam("nobody");
@@ -889,7 +921,7 @@ cupsdReadConfiguration(void)
 
     cupsdLogMessage(CUPSD_LOG_EMERG,
                     "No valid Listen or Port lines were found in the "
-                   "configuration file!");
+                   "configuration file.");
 
    /*
     * Commit suicide...
@@ -994,13 +1026,13 @@ cupsdReadConfiguration(void)
         cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to access TMPDIR (%s): %s",
                        tmpdir, strerror(errno));
       else if (!S_ISDIR(tmpinfo.st_mode))
-        cupsdLogMessage(CUPSD_LOG_ERROR, "TMPDIR (%s) is not a directory!",
+        cupsdLogMessage(CUPSD_LOG_ERROR, "TMPDIR (%s) is not a directory.",
                        tmpdir);
       else if ((tmpinfo.st_uid != User || !(tmpinfo.st_mode & S_IWUSR)) &&
                (tmpinfo.st_gid != Group || !(tmpinfo.st_mode & S_IWGRP)) &&
               !(tmpinfo.st_mode & S_IWOTH))
         cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "TMPDIR (%s) has the wrong permissions!", tmpdir);
+                       "TMPDIR (%s) has the wrong permissions.", tmpdir);
       else
         cupsdSetString(&TempDir, tmpdir);
     }
@@ -1031,10 +1063,10 @@ cupsdReadConfiguration(void)
   }
 
  /*
-  * Setup environment variables...
+  * Update environment variables...
   */
 
-  cupsdInitEnv();
+  cupsdUpdateEnv();
 
  /*
   * Update default paper size setting as needed...
@@ -1050,13 +1082,13 @@ cupsdReadConfiguration(void)
     else
 #endif /* HAVE_LIBPAPER */
     if (!DefaultLanguage ||
-        !strcasecmp(DefaultLanguage, "C") ||
-        !strcasecmp(DefaultLanguage, "POSIX") ||
-       !strcasecmp(DefaultLanguage, "en") ||
-       !strncasecmp(DefaultLanguage, "en.", 3) ||
-       !strncasecmp(DefaultLanguage, "en_US", 5) ||
-       !strncasecmp(DefaultLanguage, "en_CA", 5) ||
-       !strncasecmp(DefaultLanguage, "fr_CA", 5))
+        !_cups_strcasecmp(DefaultLanguage, "C") ||
+        !_cups_strcasecmp(DefaultLanguage, "POSIX") ||
+       !_cups_strcasecmp(DefaultLanguage, "en") ||
+       !_cups_strncasecmp(DefaultLanguage, "en.", 3) ||
+       !_cups_strncasecmp(DefaultLanguage, "en_US", 5) ||
+       !_cups_strncasecmp(DefaultLanguage, "en_CA", 5) ||
+       !_cups_strncasecmp(DefaultLanguage, "fr_CA", 5))
     {
      /*
       * These are the only locales that will default to "letter" size...
@@ -1072,7 +1104,7 @@ cupsdReadConfiguration(void)
   * Update classification setting as needed...
   */
 
-  if (Classification && !strcasecmp(Classification, "none"))
+  if (Classification && !_cups_strcasecmp(Classification, "none"))
     cupsdClearString(&Classification);
 
   if (Classification)
@@ -1124,7 +1156,7 @@ cupsdReadConfiguration(void)
 
   if (BrowseTimeout < (2 * BrowseInterval) || BrowseTimeout <= 0)
   {
-    cupsdLogMessage(CUPSD_LOG_ALERT, "Invalid BrowseTimeout value %d!",
+    cupsdLogMessage(CUPSD_LOG_ALERT, "Invalid BrowseTimeout value %d.",
                     BrowseTimeout);
 
     if (BrowseInterval)
@@ -1132,7 +1164,7 @@ cupsdReadConfiguration(void)
     else
       BrowseTimeout = DEFAULT_TIMEOUT;
 
-    cupsdLogMessage(CUPSD_LOG_ALERT, "Reset BrowseTimeout to %d!",
+    cupsdLogMessage(CUPSD_LOG_ALERT, "Reset BrowseTimeout to %d.",
                     BrowseTimeout);
   }
 
@@ -1151,14 +1183,14 @@ cupsdReadConfiguration(void)
 
 
     if (DefaultPolicy)
-      cupsdLogMessage(CUPSD_LOG_ERROR, "Default policy \"%s\" not found!",
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Default policy \"%s\" not found.",
                       DefaultPolicy);
 
     cupsdSetString(&DefaultPolicy, "default");
 
     if ((DefaultPolicyPtr = cupsdFindPolicy("default")) != NULL)
       cupsdLogMessage(CUPSD_LOG_INFO,
-                      "Using policy \"default\" as the default!");
+                      "Using policy \"default\" as the default.");
     else
     {
       cupsdLogMessage(CUPSD_LOG_INFO,
@@ -1353,7 +1385,10 @@ cupsdReadConfiguration(void)
     snprintf(temp, sizeof(temp), "%s/filter", ServerBin);
     snprintf(mimedir, sizeof(mimedir), "%s/mime", DataDir);
 
-    MimeDatabase = mimeLoadTypes(NULL, mimedir);
+    MimeDatabase = mimeNew();
+    mimeSetErrorCallback(MimeDatabase, mime_error_cb, NULL);
+
+    MimeDatabase = mimeLoadTypes(MimeDatabase, mimedir);
     MimeDatabase = mimeLoadTypes(MimeDatabase, ServerRoot);
     MimeDatabase = mimeLoadFilters(MimeDatabase, mimedir, temp);
     MimeDatabase = mimeLoadFilters(MimeDatabase, ServerRoot, temp);
@@ -1361,7 +1396,7 @@ cupsdReadConfiguration(void)
     if (!MimeDatabase)
     {
       cupsdLogMessage(CUPSD_LOG_EMERG,
-                      "Unable to load MIME database from \"%s\" or \"%s\"!",
+                      "Unable to load MIME database from \"%s\" or \"%s\".",
                      mimedir, ServerRoot);
       if (FatalErrors & CUPSD_FATAL_CONFIG)
         return (0);
@@ -1384,7 +1419,7 @@ cupsdReadConfiguration(void)
     if ((MimeTypes = calloc(NumMimeTypes, sizeof(const char *))) == NULL)
     {
       cupsdLogMessage(CUPSD_LOG_ERROR,
-                      "Unable to allocate memory for %d MIME types!",
+                      "Unable to allocate memory for %d MIME types.",
                      NumMimeTypes);
       NumMimeTypes = 0;
     }
@@ -1514,7 +1549,7 @@ get_address(const char  *value,           /* I - Value string */
 
   if (!*value)
   {
-    cupsdLogMessage(CUPSD_LOG_ERROR, "Bad (empty) address!");
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Bad (empty) address.");
     return (NULL);
   }
 
@@ -1563,7 +1598,7 @@ get_address(const char  *value,           /* I - Value string */
   */
 
   if ((addrlist = httpAddrGetList(hostname, AF_UNSPEC, portname)) == NULL)
-    cupsdLogMessage(CUPSD_LOG_ERROR, "Hostname lookup for \"%s\" failed!",
+    cupsdLogMessage(CUPSD_LOG_ERROR, "Hostname lookup for \"%s\" failed.",
                     hostname ? hostname : "(nil)");
 
   return (addrlist);
@@ -1608,7 +1643,7 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
   if (*value == '[')
   {
    /*
-    * Parse hexadecimal IPv6 address...
+    * Parse hexadecimal IPv6/IPv4 address...
     */
 
     family  = AF_INET6;
@@ -1623,13 +1658,56 @@ get_addr_and_mask(const char *value,    /* I - String from config file */
             ptr2;
             ptr2 = strchr(ptr2 + 1, ':'), j ++);
 
-        i = 7 - j;
-       ptr ++;
+        i = 6 - j;
+       ptr += 2;
+      }
+      else if (isdigit(*ptr & 255) && strchr(ptr + 1, '.') && i >= 6)
+      {
+       /*
+        * Read IPv4 dotted quad...
+        */
+
+       unsigned val[4] = { 0, 0, 0, 0 };
+                                       /* IPv4 address values */
+
+       ipcount = sscanf(ptr, "%u.%u.%u.%u", val + 0, val + 1, val + 2,
+                        val + 3);
+
+       /*
+       * Range check the IP numbers...
+       */
+
+       for (i = 0; i < ipcount; i ++)
+         if (val[i] > 255)
+           return (0);
+
+       /*
+       * Merge everything into a 32-bit IPv4 address in ip[3]...
+       */
+
+       ip[3] = (((((val[0] << 8) | val[1]) << 8) | val[2]) << 8) | val[3];
+
+       if (ipcount < 4)
+         mask[3] = (0xffffffff << (32 - 8 * ipcount)) & 0xffffffff;
+
+       /*
+        * If the leading words are all 0's then this is an IPv4 address...
+        */
+
+        if (!val[0] && !val[1] && !val[2])
+         family  = AF_INET;
+
+        while (isdigit(*ptr & 255) || *ptr == '.')
+          ptr ++;
+       break;
       }
       else if (isxdigit(*ptr & 255))
       {
         ipval = strtoul(ptr, (char **)&ptr, 16);
 
+       if (*ptr == ':' && ptr[1] != ':')
+         ptr ++;
+
        if (ipval > 0xffff)
          return (0);
 
@@ -1640,9 +1718,6 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
       }
       else
         return (0);
-
-      while (*ptr == ':')
-        ptr ++;
     }
 
     if (*ptr != ']')
@@ -1660,7 +1735,7 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
     * Parse dotted-decimal IPv4 address...
     */
 
-    unsigned val[4];                   /* IPv4 address values */
+    unsigned val[4] = { 0, 0, 0, 0 };  /* IPv4 address values */
 
 
     family  = AF_INET;
@@ -1674,14 +1749,6 @@ get_addr_and_mask(const char *value,     /* I - String from config file */
       if (val[i] > 255)
         return (0);
 
-   /*
-    * Make sure the trailing values are zeroed, as some C libraries like
-    * glibc apparently like to fill the unused arguments with garbage...
-    */
-
-    for (i = ipcount; i < 4; i ++)
-      val[i] = 0;
-
    /*
     * Merge everything into a 32-bit IPv4 address in ip[3]...
     */
@@ -1709,7 +1776,8 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
       if (family != AF_INET)
         return (0);
 
-      if (sscanf(maskval, "%u.%u.%u.%u", mask + 0, mask + 1, mask + 2, mask + 3) != 4)
+      if (sscanf(maskval, "%u.%u.%u.%u", mask + 0, mask + 1, mask + 2,
+                 mask + 3) != 4)
         return (0);
 
       mask[3] |= ((((mask[0] << 8) | mask[1]) << 8) | mask[2]) << 8;
@@ -1795,6 +1863,20 @@ get_addr_and_mask(const char *value,     /* I - String from config file */
 }
 
 
+/*
+ * 'mime_error_cb()' - Log a MIME error.
+ */
+
+static void
+mime_error_cb(void       *ctx,         /* I - Context pointer (unused) */
+              const char *message)     /* I - Message */
+{
+  (void)ctx;
+
+  cupsdLogMessage(CUPSD_LOG_ERROR, "%s", message);
+}
+
+
 /*
  * 'parse_aaa()' - Parse authentication, authorization, and access control lines.
  */
@@ -1810,15 +1892,15 @@ parse_aaa(cupsd_location_t *loc,        /* I - Location */
                mask[4];                /* IP netmask components */
 
 
-  if (!strcasecmp(line, "Encryption"))
+  if (!_cups_strcasecmp(line, "Encryption"))
   {
    /*
     * "Encryption xxx" - set required encryption level...
     */
 
-    if (!strcasecmp(value, "never"))
+    if (!_cups_strcasecmp(value, "never"))
       loc->encryption = HTTP_ENCRYPT_NEVER;
-    else if (!strcasecmp(value, "always"))
+    else if (!_cups_strcasecmp(value, "always"))
     {
       cupsdLogMessage(CUPSD_LOG_ERROR,
                       "Encryption value \"%s\" on line %d is invalid in this "
@@ -1826,9 +1908,9 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
 
       loc->encryption = HTTP_ENCRYPT_REQUIRED;
     }
-    else if (!strcasecmp(value, "required"))
+    else if (!_cups_strcasecmp(value, "required"))
       loc->encryption = HTTP_ENCRYPT_REQUIRED;
-    else if (!strcasecmp(value, "ifrequested"))
+    else if (!_cups_strcasecmp(value, "ifrequested"))
       loc->encryption = HTTP_ENCRYPT_IF_REQUESTED;
     else
     {
@@ -1837,15 +1919,15 @@ parse_aaa(cupsd_location_t *loc,        /* I - Location */
       return (0);
     }
   }
-  else if (!strcasecmp(line, "Order"))
+  else if (!_cups_strcasecmp(line, "Order"))
   {
    /*
     * "Order Deny,Allow" or "Order Allow,Deny"...
     */
 
-    if (!strncasecmp(value, "deny", 4))
+    if (!_cups_strncasecmp(value, "deny", 4))
       loc->order_type = CUPSD_AUTH_ALLOW;
-    else if (!strncasecmp(value, "allow", 5))
+    else if (!_cups_strncasecmp(value, "allow", 5))
       loc->order_type = CUPSD_AUTH_DENY;
     else
     {
@@ -1854,7 +1936,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
       return (0);
     }
   }
-  else if (!strcasecmp(line, "Allow") || !strcasecmp(line, "Deny"))
+  else if (!_cups_strcasecmp(line, "Allow") || !_cups_strcasecmp(line, "Deny"))
   {
    /*
     * Allow [From] host/ip...
@@ -1863,7 +1945,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
 
     while (*value)
     {
-      if (!strncasecmp(value, "from", 4))
+      if (!_cups_strncasecmp(value, "from", 4))
       {
        /*
        * Strip leading "from"...
@@ -1871,7 +1953,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
 
        value += 4;
 
-       while (isspace(*value & 255))
+       while (_cups_isspace(*value))
          value ++;
 
         if (!*value)
@@ -1882,9 +1964,9 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
       * Find the end of the value...
       */
 
-      for (valptr = value; *valptr && !isspace(*valptr & 255); valptr ++);
+      for (valptr = value; *valptr && !_cups_isspace(*valptr); valptr ++);
 
-      while (isspace(*valptr & 255))
+      while (_cups_isspace(*valptr))
         *valptr++ = '\0';
 
      /*
@@ -1903,24 +1985,24 @@ parse_aaa(cupsd_location_t *loc,        /* I - Location */
       *    nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
       */
 
-      if (!strcasecmp(value, "all"))
+      if (!_cups_strcasecmp(value, "all"))
       {
        /*
        * All hosts...
        */
 
-       if (!strcasecmp(line, "Allow"))
+       if (!_cups_strcasecmp(line, "Allow"))
          cupsdAddIPMask(&(loc->allow), zeros, zeros);
        else
          cupsdAddIPMask(&(loc->deny), zeros, zeros);
       }
-      else if (!strcasecmp(value, "none"))
+      else if (!_cups_strcasecmp(value, "none"))
       {
        /*
        * No hosts...
        */
 
-       if (!strcasecmp(line, "Allow"))
+       if (!_cups_strcasecmp(line, "Allow"))
          cupsdAddIPMask(&(loc->allow), ones, zeros);
        else
          cupsdAddIPMask(&(loc->deny), ones, zeros);
@@ -1939,7 +2021,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
        if (value[0] == '*')
          value ++;
 
-       if (!strcasecmp(line, "Allow"))
+       if (!_cups_strcasecmp(line, "Allow"))
          cupsdAddNameMask(&(loc->allow), value);
        else
          cupsdAddNameMask(&(loc->deny), value);
@@ -1957,7 +2039,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
          return (0);
        }
 
-       if (!strcasecmp(line, "Allow"))
+       if (!_cups_strcasecmp(line, "Allow"))
          cupsdAddIPMask(&(loc->allow), ip, mask);
        else
          cupsdAddIPMask(&(loc->deny), ip, mask);
@@ -1970,39 +2052,39 @@ parse_aaa(cupsd_location_t *loc,        /* I - Location */
       value = valptr;
     }
   }
-  else if (!strcasecmp(line, "AuthType"))
+  else if (!_cups_strcasecmp(line, "AuthType"))
   {
    /*
     * AuthType {none,basic,digest,basicdigest,negotiate,default}
     */
 
-    if (!strcasecmp(value, "none"))
+    if (!_cups_strcasecmp(value, "none"))
     {
       loc->type  = CUPSD_AUTH_NONE;
       loc->level = CUPSD_AUTH_ANON;
     }
-    else if (!strcasecmp(value, "basic"))
+    else if (!_cups_strcasecmp(value, "basic"))
     {
       loc->type = CUPSD_AUTH_BASIC;
 
       if (loc->level == CUPSD_AUTH_ANON)
        loc->level = CUPSD_AUTH_USER;
     }
-    else if (!strcasecmp(value, "digest"))
+    else if (!_cups_strcasecmp(value, "digest"))
     {
       loc->type = CUPSD_AUTH_DIGEST;
 
       if (loc->level == CUPSD_AUTH_ANON)
        loc->level = CUPSD_AUTH_USER;
     }
-    else if (!strcasecmp(value, "basicdigest"))
+    else if (!_cups_strcasecmp(value, "basicdigest"))
     {
       loc->type = CUPSD_AUTH_BASICDIGEST;
 
       if (loc->level == CUPSD_AUTH_ANON)
        loc->level = CUPSD_AUTH_USER;
     }
-    else if (!strcasecmp(value, "default"))
+    else if (!_cups_strcasecmp(value, "default"))
     {
       loc->type = CUPSD_AUTH_DEFAULT;
 
@@ -2010,7 +2092,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
        loc->level = CUPSD_AUTH_USER;
     }
 #ifdef HAVE_GSSAPI
-    else if (!strcasecmp(value, "negotiate"))
+    else if (!_cups_strcasecmp(value, "negotiate"))
     {
       loc->type = CUPSD_AUTH_NEGOTIATE;
 
@@ -2026,13 +2108,13 @@ parse_aaa(cupsd_location_t *loc,        /* I - Location */
       return (0);
     }
   }
-  else if (!strcasecmp(line, "AuthClass"))
+  else if (!_cups_strcasecmp(line, "AuthClass"))
   {
    /*
     * AuthClass anonymous, user, system, group
     */
 
-    if (!strcasecmp(value, "anonymous"))
+    if (!_cups_strcasecmp(value, "anonymous"))
     {
       loc->type  = CUPSD_AUTH_NONE;
       loc->level = CUPSD_AUTH_ANON;
@@ -2042,7 +2124,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
                      "it from line %d.",
                      value, linenum);
     }
-    else if (!strcasecmp(value, "user"))
+    else if (!_cups_strcasecmp(value, "user"))
     {
       loc->level = CUPSD_AUTH_USER;
 
@@ -2051,7 +2133,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
                      "\"Require valid-user\" on line %d.",
                      value, linenum);
     }
-    else if (!strcasecmp(value, "group"))
+    else if (!_cups_strcasecmp(value, "group"))
     {
       loc->level = CUPSD_AUTH_GROUP;
 
@@ -2060,7 +2142,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
                      "\"Require user @groupname\" on line %d.",
                      value, linenum);
     }
-    else if (!strcasecmp(value, "system"))
+    else if (!_cups_strcasecmp(value, "system"))
     {
       loc->level = CUPSD_AUTH_GROUP;
 
@@ -2079,7 +2161,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
       return (0);
     }
   }
-  else if (!strcasecmp(line, "AuthGroupName"))
+  else if (!_cups_strcasecmp(line, "AuthGroupName"))
   {
     cupsdAddName(loc, value);
 
@@ -2088,7 +2170,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
                    "using \"Require user @%s\" on line %d.",
                    value, value, linenum);
   }
-  else if (!strcasecmp(line, "Require"))
+  else if (!_cups_strcasecmp(line, "Require"))
   {
    /*
     * Apache synonym for AuthClass and AuthGroupName...
@@ -2100,15 +2182,15 @@ parse_aaa(cupsd_location_t *loc,        /* I - Location */
     *     Require user names
     */
 
-    for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
+    for (valptr = value; !_cups_isspace(*valptr) && *valptr; valptr ++);
 
     if (*valptr)
       *valptr++ = '\0';
 
-    if (!strcasecmp(value, "valid-user") ||
-        !strcasecmp(value, "user"))
+    if (!_cups_strcasecmp(value, "valid-user") ||
+        !_cups_strcasecmp(value, "user"))
       loc->level = CUPSD_AUTH_USER;
-    else if (!strcasecmp(value, "group"))
+    else if (!_cups_strcasecmp(value, "group"))
       loc->level = CUPSD_AUTH_GROUP;
     else
     {
@@ -2123,7 +2205,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
 
     for (value = valptr; *value;)
     {
-      while (isspace(*value & 255))
+      while (_cups_isspace(*value))
        value ++;
 
 #ifdef HAVE_AUTHORIZATION_H
@@ -2156,7 +2238,7 @@ parse_aaa(cupsd_location_t *loc,  /* I - Location */
        * Grab literal name.
        */
 
-        for (valptr = value; !isspace(*valptr & 255) && *valptr; valptr ++);
+        for (valptr = value; !_cups_isspace(*valptr) && *valptr; valptr ++);
       }
 
       if (*valptr)
@@ -2164,14 +2246,14 @@ parse_aaa(cupsd_location_t *loc,        /* I - Location */
 
       cupsdAddName(loc, value);
 
-      for (value = valptr; isspace(*value & 255); value ++);
+      for (value = valptr; _cups_isspace(*value); value ++);
     }
   }
-  else if (!strcasecmp(line, "Satisfy"))
+  else if (!_cups_strcasecmp(line, "Satisfy"))
   {
-    if (!strcasecmp(value, "all"))
+    if (!_cups_strcasecmp(value, "all"))
       loc->satisfy = CUPSD_AUTH_SATISFY_ALL;
-    else if (!strcasecmp(value, "any"))
+    else if (!_cups_strcasecmp(value, "any"))
       loc->satisfy = CUPSD_AUTH_SATISFY_ANY;
     else
     {
@@ -2222,7 +2304,7 @@ parse_fatal_errors(const char *s) /* I - FatalErrors string */
     */
 
     for (valend = valstart; *valend; valend ++)
-      if (isspace(*valend & 255) || *valend == ',')
+      if (_cups_isspace(*valend) || *valend == ',')
        break;
 
     if (*valend)
@@ -2232,34 +2314,34 @@ parse_fatal_errors(const char *s)       /* I - FatalErrors string */
     * Add the error to the bitmask...
     */
 
-    if (!strcasecmp(valstart, "all"))
+    if (!_cups_strcasecmp(valstart, "all"))
       fatal = CUPSD_FATAL_ALL;
-    else if (!strcasecmp(valstart, "browse"))
+    else if (!_cups_strcasecmp(valstart, "browse"))
       fatal |= CUPSD_FATAL_BROWSE;
-    else if (!strcasecmp(valstart, "-browse"))
+    else if (!_cups_strcasecmp(valstart, "-browse"))
       fatal &= ~CUPSD_FATAL_BROWSE;
-    else if (!strcasecmp(valstart, "config"))
+    else if (!_cups_strcasecmp(valstart, "config"))
       fatal |= CUPSD_FATAL_CONFIG;
-    else if (!strcasecmp(valstart, "-config"))
+    else if (!_cups_strcasecmp(valstart, "-config"))
       fatal &= ~CUPSD_FATAL_CONFIG;
-    else if (!strcasecmp(valstart, "listen"))
+    else if (!_cups_strcasecmp(valstart, "listen"))
       fatal |= CUPSD_FATAL_LISTEN;
-    else if (!strcasecmp(valstart, "-listen"))
+    else if (!_cups_strcasecmp(valstart, "-listen"))
       fatal &= ~CUPSD_FATAL_LISTEN;
-    else if (!strcasecmp(valstart, "log"))
+    else if (!_cups_strcasecmp(valstart, "log"))
       fatal |= CUPSD_FATAL_LOG;
-    else if (!strcasecmp(valstart, "-log"))
+    else if (!_cups_strcasecmp(valstart, "-log"))
       fatal &= ~CUPSD_FATAL_LOG;
-    else if (!strcasecmp(valstart, "permissions"))
+    else if (!_cups_strcasecmp(valstart, "permissions"))
       fatal |= CUPSD_FATAL_PERMISSIONS;
-    else if (!strcasecmp(valstart, "-permissions"))
+    else if (!_cups_strcasecmp(valstart, "-permissions"))
       fatal &= ~CUPSD_FATAL_PERMISSIONS;
-    else if (strcasecmp(valstart, "none"))
+    else if (_cups_strcasecmp(valstart, "none"))
       cupsdLogMessage(CUPSD_LOG_ERROR,
-                      "Unknown FatalErrors kind \"%s\" ignored!", valstart);
+                      "Unknown FatalErrors kind \"%s\" ignored.", valstart);
 
     for (valstart = valend; *valstart; valstart ++)
-      if (!isspace(*valstart & 255) || *valstart != ',')
+      if (!_cups_isspace(*valstart) || *valstart != ',')
        break;
   }
 
@@ -2312,7 +2394,7 @@ parse_groups(const char *s)               /* I - Space-delimited groups */
       */
 
       for (valend = valstart; *valend; valend ++)
-       if (isspace(*valend) || *valend == ',')
+       if (_cups_isspace(*valend) || *valend == ',')
          break;
     }
 
@@ -2334,7 +2416,7 @@ parse_groups(const char *s)               /* I - Space-delimited groups */
 
     valstart = valend;
 
-    while (*valstart == ',' || isspace(*valstart))
+    while (*valstart == ',' || _cups_isspace(*valstart))
       valstart ++;
   }
 
@@ -2377,7 +2459,7 @@ parse_protocols(const char *s)            /* I - Space-delimited protocols */
     */
 
     for (valend = valstart; *valend; valend ++)
-      if (isspace(*valend & 255) || *valend == ',')
+      if (_cups_isspace(*valend) || *valend == ',')
        break;
 
     if (*valend)
@@ -2387,28 +2469,28 @@ parse_protocols(const char *s)          /* I - Space-delimited protocols */
     * Add the protocol to the bitmask...
     */
 
-    if (!strcasecmp(valstart, "cups"))
+    if (!_cups_strcasecmp(valstart, "cups"))
       protocols |= BROWSE_CUPS;
-    else if (!strcasecmp(valstart, "slp"))
+    else if (!_cups_strcasecmp(valstart, "slp"))
       protocols |= BROWSE_SLP;
-    else if (!strcasecmp(valstart, "ldap"))
+    else if (!_cups_strcasecmp(valstart, "ldap"))
       protocols |= BROWSE_LDAP;
-    else if (!strcasecmp(valstart, "dnssd") ||
-             !strcasecmp(valstart, "dns-sd") ||
-             !strcasecmp(valstart, "bonjour"))
+    else if (!_cups_strcasecmp(valstart, "dnssd") ||
+             !_cups_strcasecmp(valstart, "dns-sd") ||
+             !_cups_strcasecmp(valstart, "bonjour"))
       protocols |= BROWSE_DNSSD;
-    else if (!strcasecmp(valstart, "lpd"))
+    else if (!_cups_strcasecmp(valstart, "lpd"))
       protocols |= BROWSE_LPD;
-    else if (!strcasecmp(valstart, "smb"))
+    else if (!_cups_strcasecmp(valstart, "smb"))
       protocols |= BROWSE_SMB;
-    else if (!strcasecmp(valstart, "all"))
+    else if (!_cups_strcasecmp(valstart, "all"))
       protocols |= BROWSE_ALL;
-    else if (strcasecmp(valstart, "none"))
+    else if (_cups_strcasecmp(valstart, "none"))
       cupsdLogMessage(CUPSD_LOG_ERROR,
-                      "Unknown browse protocol \"%s\" ignored!", valstart);
+                      "Unknown browse protocol \"%s\" ignored.", valstart);
 
     for (valstart = valend; *valstart; valstart ++)
-      if (!isspace(*valstart & 255) || *valstart != ',')
+      if (!_cups_isspace(*valstart) || *valstart != ',')
        break;
   }
 
@@ -2458,7 +2540,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
     * Decode the directive...
     */
 
-    if (!strcasecmp(line, "Include") && value)
+    if (!_cups_strcasecmp(line, "Include") && value)
     {
      /*
       * Include filename
@@ -2479,7 +2561,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        cupsFileClose(incfile);
       }
     }
-    else if (!strcasecmp(line, "<Location") && value)
+    else if (!_cups_strcasecmp(line, "<Location") && value)
     {
      /*
       * <Location path>
@@ -2489,7 +2571,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       if (linenum == 0)
        return (0);
     }
-    else if (!strcasecmp(line, "<Policy") && value)
+    else if (!_cups_strcasecmp(line, "<Policy") && value)
     {
      /*
       * <Policy name>
@@ -2499,27 +2581,27 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
       if (linenum == 0)
        return (0);
     }
-    else if (!strcasecmp(line, "FatalErrors"))
+    else if (!_cups_strcasecmp(line, "FatalErrors"))
       FatalErrors = parse_fatal_errors(value);
-    else if (!strcasecmp(line, "FaxRetryInterval") && value)
+    else if (!_cups_strcasecmp(line, "FaxRetryInterval") && value)
     {
       JobRetryInterval = atoi(value);
       cupsdLogMessage(CUPSD_LOG_WARN,
                      "FaxRetryInterval is deprecated; use "
                      "JobRetryInterval on line %d.", linenum);
     }
-    else if (!strcasecmp(line, "FaxRetryLimit") && value)
+    else if (!_cups_strcasecmp(line, "FaxRetryLimit") && value)
     {
       JobRetryLimit = atoi(value);
       cupsdLogMessage(CUPSD_LOG_WARN,
                      "FaxRetryLimit is deprecated; use "
                      "JobRetryLimit on line %d.", linenum);
     }
-    else if (!strcasecmp(line, "Port") || !strcasecmp(line, "Listen")
+    else if ((!_cups_strcasecmp(line, "Port") || !_cups_strcasecmp(line, "Listen")
 #ifdef HAVE_SSL
-             || !strcasecmp(line, "SSLPort") || !strcasecmp(line, "SSLListen")
+             || !_cups_strcasecmp(line, "SSLPort") || !_cups_strcasecmp(line, "SSLListen")
 #endif /* HAVE_SSL */
-            )
+            ) && value)
     {
      /*
       * Add listening address(es) to the list...
@@ -2562,7 +2644,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        {
          httpAddrString(&lis->address, temp, sizeof(temp));
          cupsdLogMessage(CUPSD_LOG_WARN,
-                         "Duplicate listen address \"%s\" ignored!", temp);
+                         "Duplicate listen address \"%s\" ignored.", temp);
           continue;
        }
 
@@ -2599,35 +2681,23 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
        lis->fd = -1;
 
 #ifdef HAVE_SSL
-        if (!strcasecmp(line, "SSLPort") || !strcasecmp(line, "SSLListen"))
+        if (!_cups_strcasecmp(line, "SSLPort") || !_cups_strcasecmp(line, "SSLListen"))
           lis->encryption = HTTP_ENCRYPT_ALWAYS;
 #endif /* HAVE_SSL */
 
        httpAddrString(&lis->address, temp, sizeof(temp));
 
-#ifdef AF_INET6
-        if (lis->address.addr.sa_family == AF_INET6)
-          cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv6)", temp,
-                          ntohs(lis->address.ipv6.sin6_port));
-       else
-#endif /* AF_INET6 */
 #ifdef AF_LOCAL
         if (lis->address.addr.sa_family == AF_LOCAL)
           cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s (Domain)", temp);
        else
 #endif /* AF_LOCAL */
-       cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv4)", temp,
-                        ntohs(lis->address.ipv4.sin_port));
+       cupsdLogMessage(CUPSD_LOG_INFO, "Listening to %s:%d (IPv%d)", temp,
+                        _httpAddrPort(&(lis->address)),
+                       _httpAddrFamily(&(lis->address)) == AF_INET ? 4 : 6);
 
         if (!httpAddrLocalhost(&(lis->address)))
-       {
-#ifdef AF_INET6
-         if (lis->address.addr.sa_family == AF_INET6)
-           RemotePort = ntohs(lis->address.ipv6.sin6_port);
-         else
-#endif /* AF_INET6 */
-         RemotePort = ntohs(lis->address.ipv4.sin_port);
-       }
+         RemotePort = _httpAddrPort(&(lis->address));
       }
 
      /*
@@ -2636,7 +2706,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       httpAddrFreeList(addrlist);
     }
-    else if (!strcasecmp(line, "BrowseAddress") && value)
+    else if (!_cups_strcasecmp(line, "BrowseAddress") && value)
     {
      /*
       * Add a browse address to the list...
@@ -2663,7 +2733,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       memset(dira, 0, sizeof(cupsd_dirsvc_addr_t));
 
-      if (!strcasecmp(value, "@LOCAL"))
+      if (!_cups_strcasecmp(value, "@LOCAL"))
       {
        /*
        * Send browse data to all local interfaces...
@@ -2672,7 +2742,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        strcpy(dira->iface, "*");
        NumBrowsers ++;
       }
-      else if (!strncasecmp(value, "@IF(", 4))
+      else if (!_cups_strncasecmp(value, "@IF(", 4))
       {
        /*
        * Send browse data to the named interface...
@@ -2693,7 +2763,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
         */
 
        for (addr = addrlist; addr; addr = addr->next)
-         if (addr->addr.addr.sa_family == AF_INET)
+         if (_httpAddrFamily(&(addr->addr)) == AF_INET)
            break;
 
        if (addr)
@@ -2703,7 +2773,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
          cupsdLogMessage(CUPSD_LOG_INFO,
                          "Sending browsing info to %s:%d (IPv4)",
-                         temp, ntohs(dira->to.ipv4.sin_port));
+                         temp, _httpAddrPort(&(dira->to)));
 
          NumBrowsers ++;
        }
@@ -2717,7 +2787,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
         cupsdLogMessage(CUPSD_LOG_ERROR, "Bad BrowseAddress %s at line %d.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "BrowseOrder") && value)
+    else if (!_cups_strcasecmp(line, "BrowseOrder") && value)
     {
      /*
       * "BrowseOrder Deny,Allow" or "BrowseOrder Allow,Deny"...
@@ -2729,19 +2799,19 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 
       if (location == NULL)
         cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Unable to initialize browse access control list!");
-      else if (!strncasecmp(value, "deny", 4))
+                       "Unable to initialize browse access control list.");
+      else if (!_cups_strncasecmp(value, "deny", 4))
         location->order_type = CUPSD_AUTH_ALLOW;
-      else if (!strncasecmp(value, "allow", 5))
+      else if (!_cups_strncasecmp(value, "allow", 5))
         location->order_type = CUPSD_AUTH_DENY;
       else
         cupsdLogMessage(CUPSD_LOG_ERROR,
                        "Unknown BrowseOrder value %s on line %d.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "BrowseProtocols") ||
-             !strcasecmp(line, "BrowseLocalProtocols") ||
-             !strcasecmp(line, "BrowseRemoteProtocols"))
+    else if (!_cups_strcasecmp(line, "BrowseProtocols") ||
+             !_cups_strcasecmp(line, "BrowseLocalProtocols") ||
+             !_cups_strcasecmp(line, "BrowseRemoteProtocols"))
     {
      /*
       * "BrowseProtocols name [... name]"
@@ -2759,13 +2829,13 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
         break;
       }
 
-      if (strcasecmp(line, "BrowseLocalProtocols"))
+      if (_cups_strcasecmp(line, "BrowseLocalProtocols"))
         BrowseRemoteProtocols = protocols;
-      if (strcasecmp(line, "BrowseRemoteProtocols"))
+      if (_cups_strcasecmp(line, "BrowseRemoteProtocols"))
         BrowseLocalProtocols = protocols;
     }
-    else if ((!strcasecmp(line, "BrowseAllow") ||
-              !strcasecmp(line, "BrowseDeny")) && value)
+    else if ((!_cups_strcasecmp(line, "BrowseAllow") ||
+              !_cups_strcasecmp(line, "BrowseDeny")) && value)
     {
      /*
       * BrowseAllow [From] host/ip...
@@ -2779,10 +2849,10 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 
       if (location == NULL)
         cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Unable to initialize browse access control list!");
+                       "Unable to initialize browse access control list.");
       else
       {
-       if (!strncasecmp(value, "from", 4))
+       if (!_cups_strncasecmp(value, "from", 4))
        {
         /*
          * Skip leading "from"...
@@ -2797,7 +2867,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
          * Skip leading whitespace...
          */
 
-         while (isspace(*value & 255))
+         while (_cups_isspace(*value))
            value ++;
 
          if (!*value)
@@ -2808,10 +2878,10 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
          */
 
          for (valueptr = value;
-              *valueptr && !isspace(*valueptr & 255);
+              *valueptr && !_cups_isspace(*valueptr);
               valueptr ++);
 
-         while (isspace(*valueptr & 255))
+         while (_cups_isspace(*valueptr))
            *valueptr++ = '\0';
 
         /*
@@ -2830,24 +2900,24 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
          *    nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
          */
 
-         if (!strcasecmp(value, "all"))
+         if (!_cups_strcasecmp(value, "all"))
          {
           /*
            * All hosts...
            */
 
-           if (!strcasecmp(line, "BrowseAllow"))
+           if (!_cups_strcasecmp(line, "BrowseAllow"))
              cupsdAddIPMask(&(location->allow), zeros, zeros);
            else
              cupsdAddIPMask(&(location->deny), zeros, zeros);
          }
-         else if (!strcasecmp(value, "none"))
+         else if (!_cups_strcasecmp(value, "none"))
          {
           /*
            * No hosts...
            */
 
-           if (!strcasecmp(line, "BrowseAllow"))
+           if (!_cups_strcasecmp(line, "BrowseAllow"))
              cupsdAddIPMask(&(location->allow), ones, zeros);
            else
              cupsdAddIPMask(&(location->deny), ones, zeros);
@@ -2864,7 +2934,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
            * Host or domain name...
            */
 
-           if (!strcasecmp(line, "BrowseAllow"))
+           if (!_cups_strcasecmp(line, "BrowseAllow"))
              cupsdAddNameMask(&(location->allow), value);
            else
              cupsdAddNameMask(&(location->deny), value);
@@ -2882,7 +2952,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
              break;
            }
 
-           if (!strcasecmp(line, "BrowseAllow"))
+           if (!_cups_strcasecmp(line, "BrowseAllow"))
              cupsdAddIPMask(&(location->allow), ip, mask);
            else
              cupsdAddIPMask(&(location->deny), ip, mask);
@@ -2896,7 +2966,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
        }
       }
     }
-    else if (!strcasecmp(line, "BrowseRelay") && value)
+    else if (!_cups_strcasecmp(line, "BrowseRelay") && value)
     {
      /*
       * BrowseRelay [from] source [to] destination
@@ -2920,7 +2990,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
       memset(relay, 0, sizeof(cupsd_dirsvc_relay_t));
 
-      if (!strncasecmp(value, "from ", 5))
+      if (!_cups_strncasecmp(value, "from ", 5))
       {
        /*
        * Skip leading "from"...
@@ -2932,7 +3002,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
         * Skip leading whitespace...
        */
 
-       while (isspace(*value))
+       while (_cups_isspace(*value))
          value ++;
       }
 
@@ -2941,10 +3011,10 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
       */
 
       for (valueptr = value;
-          *valueptr && !isspace(*valueptr & 255);
+          *valueptr && !_cups_isspace(*valueptr);
           valueptr ++);
 
-      while (isspace(*valueptr & 255))
+      while (_cups_isspace(*valueptr))
        *valueptr++ = '\0';
 
      /*
@@ -3006,7 +3076,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       * Get "to" address and port...
       */
 
-      if (!strncasecmp(valueptr, "to ", 3))
+      if (!_cups_strncasecmp(valueptr, "to ", 3))
       {
        /*
         * Strip leading "to"...
@@ -3014,7 +3084,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
        valueptr += 3;
 
-       while (isspace(*valueptr))
+       while (_cups_isspace(*valueptr))
          valueptr ++;
       }
 
@@ -3035,7 +3105,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
          httpAddrString(&(relay->to), temp, sizeof(temp));
 
          cupsdLogMessage(CUPSD_LOG_INFO, "Relaying from %s to %s:%d (IPv4)",
-                         value, temp, ntohs(relay->to.ipv4.sin_port));
+                         value, temp, _httpAddrPort(&(relay->to)));
 
          NumRelays ++;
        }
@@ -3059,7 +3129,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
                        valueptr, linenum);
       }
     }
-    else if (!strcasecmp(line, "BrowsePoll") && value)
+    else if (!_cups_strcasecmp(line, "BrowsePoll") && value)
     {
      /*
       * BrowsePoll address[:port]
@@ -3084,7 +3154,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
          portnum = ntohs(service->s_port);
        else
        {
-         cupsdLogMessage(CUPSD_LOG_ERROR, "Lookup of service \"%s\" failed!",
+         cupsdLogMessage(CUPSD_LOG_ERROR, "Lookup of service \"%s\" failed.",
                          portname);
           continue;
        }
@@ -3121,22 +3191,22 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
       cupsdLogMessage(CUPSD_LOG_INFO, "Polling %s:%d", pollp->hostname,
                      pollp->port);
     }
-    else if (!strcasecmp(line, "DefaultAuthType") && value)
+    else if (!_cups_strcasecmp(line, "DefaultAuthType") && value)
     {
      /*
       * DefaultAuthType {basic,digest,basicdigest,negotiate}
       */
 
-      if (!strcasecmp(value, "none"))
+      if (!_cups_strcasecmp(value, "none"))
        DefaultAuthType = CUPSD_AUTH_NONE;
-      else if (!strcasecmp(value, "basic"))
+      else if (!_cups_strcasecmp(value, "basic"))
        DefaultAuthType = CUPSD_AUTH_BASIC;
-      else if (!strcasecmp(value, "digest"))
+      else if (!_cups_strcasecmp(value, "digest"))
        DefaultAuthType = CUPSD_AUTH_DIGEST;
-      else if (!strcasecmp(value, "basicdigest"))
+      else if (!_cups_strcasecmp(value, "basicdigest"))
        DefaultAuthType = CUPSD_AUTH_BASICDIGEST;
 #ifdef HAVE_GSSAPI
-      else if (!strcasecmp(value, "negotiate"))
+      else if (!_cups_strcasecmp(value, "negotiate"))
         DefaultAuthType = CUPSD_AUTH_NEGOTIATE;
 #endif /* HAVE_GSSAPI */
       else
@@ -3149,17 +3219,17 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
       }
     }
 #ifdef HAVE_SSL
-    else if (!strcasecmp(line, "DefaultEncryption"))
+    else if (!_cups_strcasecmp(line, "DefaultEncryption"))
     {
      /*
       * DefaultEncryption {Never,IfRequested,Required}
       */
 
-      if (!value || !strcasecmp(value, "never"))
+      if (!value || !_cups_strcasecmp(value, "never"))
        DefaultEncryption = HTTP_ENCRYPT_NEVER;
-      else if (!strcasecmp(value, "required"))
+      else if (!_cups_strcasecmp(value, "required"))
        DefaultEncryption = HTTP_ENCRYPT_REQUIRED;
-      else if (!strcasecmp(value, "ifrequested"))
+      else if (!_cups_strcasecmp(value, "ifrequested"))
        DefaultEncryption = HTTP_ENCRYPT_IF_REQUESTED;
       else
       {
@@ -3171,7 +3241,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       }
     }
 #endif /* HAVE_SSL */
-    else if (!strcasecmp(line, "User") && value)
+    else if (!_cups_strcasecmp(line, "User") && value)
     {
      /*
       * User ID to run as...
@@ -3210,11 +3280,11 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
        }
        else
          cupsdLogMessage(CUPSD_LOG_ERROR,
-                         "Unknown User \"%s\" on line %d, ignoring!",
+                         "Unknown User \"%s\" on line %d, ignoring.",
                          value, linenum);
       }
     }
-    else if (!strcasecmp(line, "Group") && value)
+    else if (!_cups_strcasecmp(line, "Group") && value)
     {
      /*
       * Group ID to run as...
@@ -3231,11 +3301,11 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
          Group = group->gr_gid;
        else
          cupsdLogMessage(CUPSD_LOG_ERROR,
-                         "Unknown Group \"%s\" on line %d, ignoring!",
+                         "Unknown Group \"%s\" on line %d, ignoring.",
                          value, linenum);
       }
     }
-    else if (!strcasecmp(line, "SystemGroup") && value)
+    else if (!_cups_strcasecmp(line, "SystemGroup") && value)
     {
      /*
       * SystemGroup (admin) group(s)...
@@ -3243,104 +3313,104 @@ read_configuration(cups_file_t *fp)   /* I - File to read from */
 
       if (!parse_groups(value))
        cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Unknown SystemGroup \"%s\" on line %d, ignoring!",
+                       "Unknown SystemGroup \"%s\" on line %d, ignoring.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "HostNameLookups") && value)
+    else if (!_cups_strcasecmp(line, "HostNameLookups") && value)
     {
      /*
       * Do hostname lookups?
       */
 
-      if (!strcasecmp(value, "off") || !strcasecmp(value, "no") ||
-          !strcasecmp(value, "false"))
+      if (!_cups_strcasecmp(value, "off") || !_cups_strcasecmp(value, "no") ||
+          !_cups_strcasecmp(value, "false"))
         HostNameLookups = 0;
-      else if (!strcasecmp(value, "on") || !strcasecmp(value, "yes") ||
-          !strcasecmp(value, "true"))
+      else if (!_cups_strcasecmp(value, "on") || !_cups_strcasecmp(value, "yes") ||
+          !_cups_strcasecmp(value, "true"))
         HostNameLookups = 1;
-      else if (!strcasecmp(value, "double"))
+      else if (!_cups_strcasecmp(value, "double"))
         HostNameLookups = 2;
       else
        cupsdLogMessage(CUPSD_LOG_WARN, "Unknown HostNameLookups %s on line %d.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "AccessLogLevel") && value)
+    else if (!_cups_strcasecmp(line, "AccessLogLevel") && value)
     {
      /*
       * Amount of logging to do to access log...
       */
 
-      if (!strcasecmp(value, "all"))
+      if (!_cups_strcasecmp(value, "all"))
         AccessLogLevel = CUPSD_ACCESSLOG_ALL;
-      else if (!strcasecmp(value, "actions"))
+      else if (!_cups_strcasecmp(value, "actions"))
         AccessLogLevel = CUPSD_ACCESSLOG_ACTIONS;
-      else if (!strcasecmp(value, "config"))
+      else if (!_cups_strcasecmp(value, "config"))
         AccessLogLevel = CUPSD_ACCESSLOG_CONFIG;
       else
         cupsdLogMessage(CUPSD_LOG_WARN, "Unknown AccessLogLevel %s on line %d.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "LogLevel") && value)
+    else if (!_cups_strcasecmp(line, "LogLevel") && value)
     {
      /*
       * Amount of logging to do to error log...
       */
 
-      if (!strcasecmp(value, "debug2"))
+      if (!_cups_strcasecmp(value, "debug2"))
         LogLevel = CUPSD_LOG_DEBUG2;
-      else if (!strcasecmp(value, "debug"))
+      else if (!_cups_strcasecmp(value, "debug"))
         LogLevel = CUPSD_LOG_DEBUG;
-      else if (!strcasecmp(value, "info"))
+      else if (!_cups_strcasecmp(value, "info"))
         LogLevel = CUPSD_LOG_INFO;
-      else if (!strcasecmp(value, "notice"))
+      else if (!_cups_strcasecmp(value, "notice"))
         LogLevel = CUPSD_LOG_NOTICE;
-      else if (!strcasecmp(value, "warn"))
+      else if (!_cups_strcasecmp(value, "warn"))
         LogLevel = CUPSD_LOG_WARN;
-      else if (!strcasecmp(value, "error"))
+      else if (!_cups_strcasecmp(value, "error"))
         LogLevel = CUPSD_LOG_ERROR;
-      else if (!strcasecmp(value, "crit"))
+      else if (!_cups_strcasecmp(value, "crit"))
         LogLevel = CUPSD_LOG_CRIT;
-      else if (!strcasecmp(value, "alert"))
+      else if (!_cups_strcasecmp(value, "alert"))
         LogLevel = CUPSD_LOG_ALERT;
-      else if (!strcasecmp(value, "emerg"))
+      else if (!_cups_strcasecmp(value, "emerg"))
         LogLevel = CUPSD_LOG_EMERG;
-      else if (!strcasecmp(value, "none"))
+      else if (!_cups_strcasecmp(value, "none"))
         LogLevel = CUPSD_LOG_NONE;
       else
         cupsdLogMessage(CUPSD_LOG_WARN, "Unknown LogLevel %s on line %d.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "LogTimeFormat") && value)
+    else if (!_cups_strcasecmp(line, "LogTimeFormat") && value)
     {
      /*
       * Amount of logging to do to error log...
       */
 
-      if (!strcasecmp(value, "standard"))
+      if (!_cups_strcasecmp(value, "standard"))
         LogTimeFormat = CUPSD_TIME_STANDARD;
-      else if (!strcasecmp(value, "usecs"))
+      else if (!_cups_strcasecmp(value, "usecs"))
         LogTimeFormat = CUPSD_TIME_USECS;
       else
         cupsdLogMessage(CUPSD_LOG_WARN, "Unknown LogTimeFormat %s on line %d.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "PrintcapFormat") && value)
+    else if (!_cups_strcasecmp(line, "PrintcapFormat") && value)
     {
      /*
       * Format of printcap file?
       */
 
-      if (!strcasecmp(value, "bsd"))
+      if (!_cups_strcasecmp(value, "bsd"))
         PrintcapFormat = PRINTCAP_BSD;
-      else if (!strcasecmp(value, "plist"))
+      else if (!_cups_strcasecmp(value, "plist"))
         PrintcapFormat = PRINTCAP_PLIST;
-      else if (!strcasecmp(value, "solaris"))
+      else if (!_cups_strcasecmp(value, "solaris"))
         PrintcapFormat = PRINTCAP_SOLARIS;
       else
        cupsdLogMessage(CUPSD_LOG_WARN, "Unknown PrintcapFormat %s on line %d.",
                        value, linenum);
     }
-    else if (!strcasecmp(line, "ServerTokens") && value)
+    else if (!_cups_strcasecmp(line, "ServerTokens") && value)
     {
      /*
       * Set the string used for the Server header...
@@ -3351,26 +3421,27 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
 
       uname(&plat);
 
-      if (!strcasecmp(value, "ProductOnly"))
+      if (!_cups_strcasecmp(value, "ProductOnly"))
        cupsdSetString(&ServerHeader, "CUPS");
-      else if (!strcasecmp(value, "Major"))
-       cupsdSetString(&ServerHeader, "CUPS/1");
-      else if (!strcasecmp(value, "Minor"))
-       cupsdSetString(&ServerHeader, "CUPS/1.4");
-      else if (!strcasecmp(value, "Minimal"))
+      else if (!_cups_strcasecmp(value, "Major"))
+       cupsdSetStringf(&ServerHeader, "CUPS/%d", CUPS_VERSION_MAJOR);
+      else if (!_cups_strcasecmp(value, "Minor"))
+       cupsdSetStringf(&ServerHeader, "CUPS/%d.%d", CUPS_VERSION_MAJOR,
+                       CUPS_VERSION_MINOR);
+      else if (!_cups_strcasecmp(value, "Minimal"))
        cupsdSetString(&ServerHeader, CUPS_MINIMAL);
-      else if (!strcasecmp(value, "OS"))
+      else if (!_cups_strcasecmp(value, "OS"))
        cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s)", plat.sysname);
-      else if (!strcasecmp(value, "Full"))
-       cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s) IPP/1.1",
+      else if (!_cups_strcasecmp(value, "Full"))
+       cupsdSetStringf(&ServerHeader, CUPS_MINIMAL " (%s) IPP/2.1",
                        plat.sysname);
-      else if (!strcasecmp(value, "None"))
+      else if (!_cups_strcasecmp(value, "None"))
        cupsdClearString(&ServerHeader);
       else
        cupsdLogMessage(CUPSD_LOG_WARN, "Unknown ServerTokens %s on line %d.",
                         value, linenum);
     }
-    else if (!strcasecmp(line, "PassEnv") && value)
+    else if (!_cups_strcasecmp(line, "PassEnv") && value)
     {
      /*
       * PassEnv variable [... variable]
@@ -3379,7 +3450,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       for (; *value;)
       {
         for (valuelen = 0; value[valuelen]; valuelen ++)
-         if (isspace(value[valuelen]) || value[valuelen] == ',')
+         if (_cups_isspace(value[valuelen]) || value[valuelen] == ',')
            break;
 
         if (value[valuelen])
@@ -3391,18 +3462,39 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
         cupsdSetEnv(value, NULL);
 
         for (value += valuelen; *value; value ++)
-         if (!isspace(*value) || *value != ',')
+         if (!_cups_isspace(*value) || *value != ',')
            break;
       }
     }
-    else if (!strcasecmp(line, "ServerAlias") && value)
+    else if (!_cups_strcasecmp(line, "ServerAlias") && value)
     {
+     /*
+      * ServerAlias name [... name]
+      */
+
       if (!ServerAlias)
         ServerAlias = cupsArrayNew(NULL, NULL);
 
-      cupsdAddAlias(ServerAlias, value);
+      for (; *value;)
+      {
+        for (valuelen = 0; value[valuelen]; valuelen ++)
+         if (_cups_isspace(value[valuelen]) || value[valuelen] == ',')
+           break;
+
+        if (value[valuelen])
+        {
+         value[valuelen] = '\0';
+         valuelen ++;
+       }
+
+       cupsdAddAlias(ServerAlias, value);
+
+        for (value += valuelen; *value; value ++)
+         if (!_cups_isspace(*value) || *value != ',')
+           break;
+      }
     }
-    else if (!strcasecmp(line, "SetEnv") && value)
+    else if (!_cups_strcasecmp(line, "SetEnv") && value)
     {
      /*
       * SetEnv variable value
@@ -3427,15 +3519,15 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
                        linenum);
     }
 #ifdef HAVE_SSL
-    else if (!strcasecmp(line, "SSLOptions"))
+    else if (!_cups_strcasecmp(line, "SSLOptions"))
     {
      /*
       * SSLOptions options
       */
 
-      if (!value || !strcasecmp(value, "none"))
+      if (!value || !_cups_strcasecmp(value, "none"))
         SSLOptions = CUPSD_SSL_NONE;
-      else if (!strcasecmp(value, "noemptyfragments"))
+      else if (!_cups_strcasecmp(value, "noemptyfragments"))
         SSLOptions = CUPSD_SSL_NOEMPTY;
       else
         cupsdLogMessage(CUPSD_LOG_ERROR,
@@ -3450,7 +3542,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
       */
 
       for (i = NUM_VARS, var = variables; i > 0; i --, var ++)
-        if (!strcasecmp(line, var->name))
+        if (!_cups_strcasecmp(line, var->name))
          break;
 
       if (i == 0)
@@ -3473,7 +3565,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
         case CUPSD_VARTYPE_INTEGER :
            if (!value)
              cupsdLogMessage(CUPSD_LOG_ERROR,
-                             "Missing integer value for %s on line %d!",
+                             "Missing integer value for %s on line %d.",
                              line, linenum);
            else
            {
@@ -3497,7 +3589,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
 
               if (n < 0)
                cupsdLogMessage(CUPSD_LOG_ERROR,
-                               "Bad negative integer value for %s on line %d!",
+                               "Bad negative integer value for %s on line %d.",
                                line, linenum);
              else
                *((int *)var->ptr) = n;
@@ -3507,19 +3599,19 @@ read_configuration(cups_file_t *fp)     /* I - File to read from */
        case CUPSD_VARTYPE_BOOLEAN :
            if (!value)
              cupsdLogMessage(CUPSD_LOG_ERROR,
-                             "Missing boolean value for %s on line %d!",
+                             "Missing boolean value for %s on line %d.",
                              line, linenum);
-            else if (!strcasecmp(value, "true") ||
-                    !strcasecmp(value, "on") ||
-                    !strcasecmp(value, "enabled") ||
-                    !strcasecmp(value, "yes") ||
+            else if (!_cups_strcasecmp(value, "true") ||
+                    !_cups_strcasecmp(value, "on") ||
+                    !_cups_strcasecmp(value, "enabled") ||
+                    !_cups_strcasecmp(value, "yes") ||
                     atoi(value) != 0)
               *((int *)var->ptr) = TRUE;
-           else if (!strcasecmp(value, "false") ||
-                    !strcasecmp(value, "off") ||
-                    !strcasecmp(value, "disabled") ||
-                    !strcasecmp(value, "no") ||
-                    !strcasecmp(value, "0"))
+           else if (!_cups_strcasecmp(value, "false") ||
+                    !_cups_strcasecmp(value, "off") ||
+                    !_cups_strcasecmp(value, "disabled") ||
+                    !_cups_strcasecmp(value, "no") ||
+                    !_cups_strcasecmp(value, "0"))
               *((int *)var->ptr) = FALSE;
            else
               cupsdLogMessage(CUPSD_LOG_ERROR,
@@ -3531,7 +3623,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
             if (!value)
            {
              cupsdLogMessage(CUPSD_LOG_ERROR,
-                             "Missing pathname value for %s on line %d!",
+                             "Missing pathname value for %s on line %d.",
                              line, linenum);
               break;
            }
@@ -3545,7 +3637,7 @@ read_configuration(cups_file_t *fp)       /* I - File to read from */
            {
              cupsdLogMessage(CUPSD_LOG_ERROR,
                              "File or directory for \"%s %s\" on line %d "
-                             "does not exist!", line, value, linenum);
+                             "does not exist.", line, value, linenum);
               break;
            }
 
@@ -3577,13 +3669,19 @@ read_location(cups_file_t *fp,          /* I - Configuration file */
                        *valptr;        /* Pointer into value */
 
 
-  if ((parent = cupsdNewLocation(location)) == NULL)
+  if ((parent = cupsdFindLocation(location)) != NULL)
+    cupsdLogMessage(CUPSD_LOG_WARN, "Duplicate <Location %s> on line %d.",
+                    location, linenum);
+  else if ((parent = cupsdNewLocation(location)) == NULL)
     return (0);
+  else
+  {
+    cupsdAddLocation(parent);
 
-  cupsdAddLocation(parent);
+    parent->limit = CUPSD_AUTH_LIMIT_ALL;
+  }
 
-  parent->limit = CUPSD_AUTH_LIMIT_ALL;
-  loc           = parent;
+  loc = parent;
 
   while (cupsFileGetConf(fp, line, sizeof(line), &value, &linenum))
   {
@@ -3591,10 +3689,10 @@ read_location(cups_file_t *fp,          /* I - Configuration file */
     * Decode the directive...
     */
 
-    if (!strcasecmp(line, "</Location>"))
+    if (!_cups_strcasecmp(line, "</Location>"))
       return (linenum);
-    else if (!strcasecmp(line, "<Limit") ||
-             !strcasecmp(line, "<LimitExcept"))
+    else if (!_cups_strcasecmp(line, "<Limit") ||
+             !_cups_strcasecmp(line, "<LimitExcept"))
     {
       if (!value)
       {
@@ -3633,20 +3731,26 @@ read_location(cups_file_t *fp,          /* I - Configuration file */
        else if (!strcmp(value, "TRACE"))
          loc->limit |= CUPSD_AUTH_LIMIT_TRACE;
        else
-         cupsdLogMessage(CUPSD_LOG_WARN, "Unknown request type %s on line %d!",
+         cupsdLogMessage(CUPSD_LOG_WARN, "Unknown request type %s on line %d.",
                          value, linenum);
 
         for (value = valptr; isspace(*value & 255); value ++);
       }
 
-      if (!strcasecmp(line, "<LimitExcept"))
+      if (!_cups_strcasecmp(line, "<LimitExcept"))
         loc->limit = CUPSD_AUTH_LIMIT_ALL ^ loc->limit;
 
       parent->limit &= ~loc->limit;
     }
-    else if (!strcasecmp(line, "</Limit>") ||
-             !strcasecmp(line, "</LimitExcept>"))
+    else if (!_cups_strcasecmp(line, "</Limit>") ||
+             !_cups_strcasecmp(line, "</LimitExcept>"))
       loc = parent;
+    else if (!value)
+    {
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Missing value on line %d.", linenum);
+      if (FatalErrors & CUPSD_FATAL_CONFIG)
+       return (0);
+    }
     else if (!parse_aaa(loc, line, value, linenum))
     {
       cupsdLogMessage(CUPSD_LOG_ERROR,
@@ -3658,7 +3762,7 @@ read_location(cups_file_t *fp,            /* I - Configuration file */
   }
 
   cupsdLogMessage(CUPSD_LOG_ERROR,
-                  "Unexpected end-of-file at line %d while reading location!",
+                  "Unexpected end-of-file at line %d while reading location.",
                   linenum);
 
   return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
@@ -3689,7 +3793,10 @@ read_policy(cups_file_t *fp,             /* I - Configuration file */
   * Create the policy...
   */
 
-  if ((pol = cupsdAddPolicy(policy)) == NULL)
+  if ((pol = cupsdFindPolicy(policy)) != NULL)
+    cupsdLogMessage(CUPSD_LOG_WARN, "Duplicate <Policy %s> on line %d.",
+                    policy, linenum);
+  else if ((pol = cupsdAddPolicy(policy)) == NULL)
     return (0);
 
  /*
@@ -3705,18 +3812,18 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
     * Decode the directive...
     */
 
-    if (!strcasecmp(line, "</Policy>"))
+    if (!_cups_strcasecmp(line, "</Policy>"))
     {
       if (op)
         cupsdLogMessage(CUPSD_LOG_WARN,
-                       "Missing </Limit> before </Policy> on line %d!",
+                       "Missing </Limit> before </Policy> on line %d.",
                        linenum);
 
       set_policy_defaults(pol);
 
       return (linenum);
     }
-    else if (!strcasecmp(line, "<Limit") && !op)
+    else if (!_cups_strcasecmp(line, "<Limit") && !op)
     {
       if (!value)
       {
@@ -3742,18 +3849,18 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
 
         if (num_ops < (int)(sizeof(ops) / sizeof(ops[0])))
        {
-         if (!strcasecmp(value, "All"))
+         if (!_cups_strcasecmp(value, "All"))
            ops[num_ops] = IPP_ANY_OPERATION;
          else if ((ops[num_ops] = ippOpValue(value)) == IPP_BAD_OPERATION)
            cupsdLogMessage(CUPSD_LOG_ERROR,
-                           "Bad IPP operation name \"%s\" on line %d!",
+                           "Bad IPP operation name \"%s\" on line %d.",
                            value, linenum);
           else
            num_ops ++;
        }
        else
          cupsdLogMessage(CUPSD_LOG_ERROR,
-                         "Too many operations listed on line %d!",
+                         "Too many operations listed on line %d.",
                          linenum);
 
         for (value = valptr; isspace(*value & 255); value ++);
@@ -3775,7 +3882,7 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
 
       op = cupsdAddPolicyOp(pol, NULL, ops[0]);
     }
-    else if (!strcasecmp(line, "</Limit>") && op)
+    else if (!_cups_strcasecmp(line, "</Limit>") && op)
     {
      /*
       * Finish the current operation limit...
@@ -3793,10 +3900,16 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
 
       op = NULL;
     }
-    else if (!strcasecmp(line, "JobPrivateAccess") ||
-            !strcasecmp(line, "JobPrivateValues") ||
-            !strcasecmp(line, "SubscriptionPrivateAccess") ||
-            !strcasecmp(line, "SubscriptionPrivateValues"))
+    else if (!value)
+    {
+      cupsdLogMessage(CUPSD_LOG_ERROR, "Missing value on line %d.", linenum);
+      if (FatalErrors & CUPSD_FATAL_CONFIG)
+       return (0);
+    }
+    else if (!_cups_strcasecmp(line, "JobPrivateAccess") ||
+            !_cups_strcasecmp(line, "JobPrivateValues") ||
+            !_cups_strcasecmp(line, "SubscriptionPrivateAccess") ||
+            !_cups_strcasecmp(line, "SubscriptionPrivateValues"))
     {
       if (op)
       {
@@ -3827,13 +3940,13 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
          * Save it appropriately...
          */
 
-         if (!strcasecmp(line, "JobPrivateAccess"))
+         if (!_cups_strcasecmp(line, "JobPrivateAccess"))
          {
           /*
            * JobPrivateAccess {all|default|user/group list|@@ACL}
            */
 
-            if (!strcasecmp(value, "default"))
+            if (!_cups_strcasecmp(value, "default"))
            {
              cupsdAddString(&(pol->job_access), "@OWNER");
              cupsdAddString(&(pol->job_access), "@SYSTEM");
@@ -3841,13 +3954,13 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
            else
              cupsdAddString(&(pol->job_access), value);
          }
-         else if (!strcasecmp(line, "JobPrivateValues"))
+         else if (!_cups_strcasecmp(line, "JobPrivateValues"))
          {
           /*
            * JobPrivateValues {all|none|default|attribute list}
            */
 
-           if (!strcasecmp(value, "default"))
+           if (!_cups_strcasecmp(value, "default"))
            {
              cupsdAddString(&(pol->job_attrs), "job-name");
              cupsdAddString(&(pol->job_attrs), "job-originating-host-name");
@@ -3856,13 +3969,13 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
            else
              cupsdAddString(&(pol->job_attrs), value);
          }
-         else if (!strcasecmp(line, "SubscriptionPrivateAccess"))
+         else if (!_cups_strcasecmp(line, "SubscriptionPrivateAccess"))
          {
           /*
            * SubscriptionPrivateAccess {all|default|user/group list|@@ACL}
            */
 
-            if (!strcasecmp(value, "default"))
+            if (!_cups_strcasecmp(value, "default"))
            {
              cupsdAddString(&(pol->sub_access), "@OWNER");
              cupsdAddString(&(pol->sub_access), "@SYSTEM");
@@ -3870,13 +3983,13 @@ read_policy(cups_file_t *fp,            /* I - Configuration file */
            else
              cupsdAddString(&(pol->sub_access), value);
          }
-         else /* if (!strcasecmp(line, "SubscriptionPrivateValues")) */
+         else /* if (!_cups_strcasecmp(line, "SubscriptionPrivateValues")) */
          {
           /*
            * SubscriptionPrivateValues {all|none|default|attribute list}
            */
 
-           if (!strcasecmp(value, "default"))
+           if (!_cups_strcasecmp(value, "default"))
            {
              cupsdAddString(&(pol->sub_attrs), "notify-events");
              cupsdAddString(&(pol->sub_attrs), "notify-pull-method");
@@ -3906,14 +4019,9 @@ read_policy(cups_file_t *fp,             /* I - Configuration file */
     }
     else if (!parse_aaa(op, line, value, linenum))
     {
-      if (op)
-       cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Unknown Policy Limit directive %s on line %d.",
-                       line, linenum);
-      else
-       cupsdLogMessage(CUPSD_LOG_ERROR,
-                       "Unknown Policy directive %s on line %d.",
-                       line, linenum);
+      cupsdLogMessage(CUPSD_LOG_ERROR,
+                     "Unknown Policy Limit directive %s on line %d.",
+                     line, linenum);
 
       if (FatalErrors & CUPSD_FATAL_CONFIG)
        return (0);
@@ -3921,8 +4029,8 @@ read_policy(cups_file_t *fp,              /* I - Configuration file */
   }
 
   cupsdLogMessage(CUPSD_LOG_ERROR,
-                  "Unexpected end-of-file at line %d while reading policy \"%s\"!",
-                  linenum, policy);
+                  "Unexpected end-of-file at line %d while reading policy "
+                  "\"%s\".", linenum, policy);
 
   return ((FatalErrors & CUPSD_FATAL_CONFIG) ? 0 : linenum);
 }