summaryrefslogtreecommitdiff
path: root/scheduler/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'scheduler/conf.c')
-rw-r--r--scheduler/conf.c312
1 files changed, 179 insertions, 133 deletions
diff --git a/scheduler/conf.c b/scheduler/conf.c
index e640a2101..0161762fe 100644
--- a/scheduler/conf.c
+++ b/scheduler/conf.c
@@ -454,6 +454,9 @@ cupsdReadConfiguration(void)
if (!strcmp(CUPS_DEFAULT_PRINTCAP, "/etc/printers.conf"))
PrintcapFormat = PRINTCAP_SOLARIS;
+ else if (!strcmp(CUPS_DEFAULT_PRINTCAP,
+ "/Library/Preferences/org.cups.printers.plist"))
+ PrintcapFormat = PRINTCAP_PLIST;
else
PrintcapFormat = PRINTCAP_BSD;
@@ -1165,7 +1168,6 @@ cupsdReadConfiguration(void)
cupsdDeleteAllSubscriptions();
cupsdFreeAllJobs();
- cupsdDeleteAllClasses();
cupsdDeleteAllPrinters();
DefaultPrinter = NULL;
@@ -1690,92 +1692,113 @@ parse_aaa(cupsd_location_t *loc, /* I - Location */
* Deny [From] host/ip...
*/
- if (!strncasecmp(value, "from", 4))
+ while (*value)
{
- /*
- * Strip leading "from"...
- */
+ if (!strncasecmp(value, "from", 4))
+ {
+ /*
+ * Strip leading "from"...
+ */
- value += 4;
+ value += 4;
- while (isspace(*value & 255))
- value ++;
- }
+ while (isspace(*value & 255))
+ value ++;
- /*
- * Figure out what form the allow/deny address takes:
- *
- * All
- * None
- * *.domain.com
- * .domain.com
- * host.domain.com
- * nnn.*
- * nnn.nnn.*
- * nnn.nnn.nnn.*
- * nnn.nnn.nnn.nnn
- * nnn.nnn.nnn.nnn/mm
- * nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
- */
+ if (!*value)
+ break;
+ }
- if (!strcasecmp(value, "all"))
- {
/*
- * All hosts...
+ * Find the end of the value...
*/
- if (!strcasecmp(line, "Allow"))
- cupsdAllowIP(loc, zeros, zeros);
- else
- cupsdDenyIP(loc, zeros, zeros);
- }
- else if (!strcasecmp(value, "none"))
- {
+ for (valptr = value; *valptr && !isspace(*valptr & 255); valptr ++);
+
+ while (isspace(*valptr & 255))
+ *valptr++ = '\0';
+
/*
- * No hosts...
+ * Figure out what form the allow/deny address takes:
+ *
+ * All
+ * None
+ * *.domain.com
+ * .domain.com
+ * host.domain.com
+ * nnn.*
+ * nnn.nnn.*
+ * nnn.nnn.nnn.*
+ * nnn.nnn.nnn.nnn
+ * nnn.nnn.nnn.nnn/mm
+ * nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
*/
- if (!strcasecmp(line, "Allow"))
- cupsdAllowIP(loc, ones, zeros);
- else
- cupsdDenyIP(loc, ones, zeros);
- }
+ if (!strcasecmp(value, "all"))
+ {
+ /*
+ * All hosts...
+ */
+
+ if (!strcasecmp(line, "Allow"))
+ cupsdAllowIP(loc, zeros, zeros);
+ else
+ cupsdDenyIP(loc, zeros, zeros);
+ }
+ else if (!strcasecmp(value, "none"))
+ {
+ /*
+ * No hosts...
+ */
+
+ if (!strcasecmp(line, "Allow"))
+ cupsdAllowIP(loc, ones, zeros);
+ else
+ cupsdDenyIP(loc, ones, zeros);
+ }
#ifdef AF_INET6
- else if (value[0] == '*' || value[0] == '.' ||
- (!isdigit(value[0] & 255) && value[0] != '['))
+ else if (value[0] == '*' || value[0] == '.' ||
+ (!isdigit(value[0] & 255) && value[0] != '['))
#else
- else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
+ else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
#endif /* AF_INET6 */
- {
- /*
- * Host or domain name...
- */
+ {
+ /*
+ * Host or domain name...
+ */
- if (value[0] == '*')
- value ++;
+ if (value[0] == '*')
+ value ++;
- if (!strcasecmp(line, "Allow"))
- cupsdAllowHost(loc, value);
+ if (!strcasecmp(line, "Allow"))
+ cupsdAllowHost(loc, value);
+ else
+ cupsdDenyHost(loc, value);
+ }
else
- cupsdDenyHost(loc, value);
- }
- else
- {
- /*
- * One of many IP address forms...
- */
-
- if (!get_addr_and_mask(value, ip, mask))
{
- cupsdLogMessage(CUPSD_LOG_ERROR, "Bad netmask value %s on line %d.",
- value, linenum);
- return (0);
+ /*
+ * One of many IP address forms...
+ */
+
+ if (!get_addr_and_mask(value, ip, mask))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Bad netmask value %s on line %d.",
+ value, linenum);
+ return (0);
+ }
+
+ if (!strcasecmp(line, "Allow"))
+ cupsdAllowIP(loc, ip, mask);
+ else
+ cupsdDenyIP(loc, ip, mask);
}
- if (!strcasecmp(line, "Allow"))
- cupsdAllowIP(loc, ip, mask);
- else
- cupsdDenyIP(loc, ip, mask);
+ /*
+ * Advance to next value...
+ */
+
+ value = valptr;
}
}
else if (!strcasecmp(line, "AuthType"))
@@ -2579,92 +2602,113 @@ read_configuration(cups_file_t *fp) /* I - File to read from */
"Unable to initialize browse access control list!");
else
{
- if (!strncasecmp(value, "from ", 5))
+ while (*value)
{
- /*
- * Strip leading "from"...
- */
+ if (!strncasecmp(value, "from", 4))
+ {
+ /*
+ * Strip leading "from"...
+ */
- value += 5;
+ value += 4;
- while (isspace(*value))
- value ++;
- }
+ while (isspace(*value & 255))
+ value ++;
- /*
- * Figure out what form the allow/deny address takes:
- *
- * All
- * None
- * *.domain.com
- * .domain.com
- * host.domain.com
- * nnn.*
- * nnn.nnn.*
- * nnn.nnn.nnn.*
- * nnn.nnn.nnn.nnn
- * nnn.nnn.nnn.nnn/mm
- * nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
- */
+ if (!*value)
+ break;
+ }
- if (!strcasecmp(value, "all"))
- {
/*
- * All hosts...
+ * Find the end of the value...
*/
- if (!strcasecmp(line, "BrowseAllow"))
- cupsdAllowIP(location, zeros, zeros);
- else
- cupsdDenyIP(location, zeros, zeros);
- }
- else if (!strcasecmp(value, "none"))
- {
+ for (valueptr = value; *valueptr && !isspace(*valueptr & 255); valueptr ++);
+
+ while (isspace(*valueptr & 255))
+ *valueptr++ = '\0';
+
/*
- * No hosts...
+ * Figure out what form the allow/deny address takes:
+ *
+ * All
+ * None
+ * *.domain.com
+ * .domain.com
+ * host.domain.com
+ * nnn.*
+ * nnn.nnn.*
+ * nnn.nnn.nnn.*
+ * nnn.nnn.nnn.nnn
+ * nnn.nnn.nnn.nnn/mm
+ * nnn.nnn.nnn.nnn/mmm.mmm.mmm.mmm
*/
- if (!strcasecmp(line, "BrowseAllow"))
- cupsdAllowIP(location, ones, zeros);
- else
- cupsdDenyIP(location, ones, zeros);
- }
+ if (!strcasecmp(value, "all"))
+ {
+ /*
+ * All hosts...
+ */
+
+ if (!strcasecmp(line, "BrowseAllow"))
+ cupsdAllowIP(location, zeros, zeros);
+ else
+ cupsdDenyIP(location, zeros, zeros);
+ }
+ else if (!strcasecmp(value, "none"))
+ {
+ /*
+ * No hosts...
+ */
+
+ if (!strcasecmp(line, "BrowseAllow"))
+ cupsdAllowIP(location, ones, zeros);
+ else
+ cupsdDenyIP(location, ones, zeros);
+ }
#ifdef AF_INET6
- else if (value[0] == '*' || value[0] == '.' ||
- (!isdigit(value[0] & 255) && value[0] != '['))
+ else if (value[0] == '*' || value[0] == '.' ||
+ (!isdigit(value[0] & 255) && value[0] != '['))
#else
- else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
+ else if (value[0] == '*' || value[0] == '.' || !isdigit(value[0] & 255))
#endif /* AF_INET6 */
- {
- /*
- * Host or domain name...
- */
+ {
+ /*
+ * Host or domain name...
+ */
- if (value[0] == '*')
- value ++;
+ if (value[0] == '*')
+ value ++;
- if (!strcasecmp(line, "BrowseAllow"))
- cupsdAllowHost(location, value);
+ if (!strcasecmp(line, "BrowseAllow"))
+ cupsdAllowHost(location, value);
+ else
+ cupsdDenyHost(location, value);
+ }
else
- cupsdDenyHost(location, value);
- }
- else
- {
- /*
- * One of many IP address forms...
- */
-
- if (!get_addr_and_mask(value, ip, mask))
{
- cupsdLogMessage(CUPSD_LOG_ERROR, "Bad netmask value %s on line %d.",
- value, linenum);
- break;
+ /*
+ * One of many IP address forms...
+ */
+
+ if (!get_addr_and_mask(value, ip, mask))
+ {
+ cupsdLogMessage(CUPSD_LOG_ERROR, "Bad netmask value %s on line %d.",
+ value, linenum);
+ break;
+ }
+
+ if (!strcasecmp(line, "BrowseAllow"))
+ cupsdAllowIP(location, ip, mask);
+ else
+ cupsdDenyIP(location, ip, mask);
}
- if (!strcasecmp(line, "BrowseAllow"))
- cupsdAllowIP(location, ip, mask);
- else
- cupsdDenyIP(location, ip, mask);
+ /*
+ * Advance to next value...
+ */
+
+ value = valueptr;
}
}
}
@@ -3116,6 +3160,8 @@ read_configuration(cups_file_t *fp) /* I - File to read from */
if (!strcasecmp(value, "bsd"))
PrintcapFormat = PRINTCAP_BSD;
+ else if (!strcasecmp(value, "plist"))
+ PrintcapFormat = PRINTCAP_PLIST;
else if (!strcasecmp(value, "solaris"))
PrintcapFormat = PRINTCAP_SOLARIS;
else