| 2085 | */ |
| 2086 | |
| 2087 | static int /* O - 1 on success, 0 on failure */ |
| 2088 | parse_aaa(cupsd_location_t *loc, /* I - Location */ |
| 2089 | char *line, /* I - Line from file */ |
| 2090 | char *value, /* I - Start of value data */ |
| 2091 | int linenum) /* I - Current line number */ |
| 2092 | { |
| 2093 | char *valptr; /* Pointer into value */ |
| 2094 | unsigned ip[4], /* IP address components */ |
| 2095 | mask[4]; /* IP netmask components */ |
| 2096 | |
| 2097 | |
| 2098 | if (!_cups_strcasecmp(line, "Encryption")) |
| 2099 | { |
| 2100 | /* |
| 2101 | * "Encryption xxx" - set required encryption level... |
| 2102 | */ |
| 2103 | |
| 2104 | if (!_cups_strcasecmp(value, "never")) |
| 2105 | loc->encryption = HTTP_ENCRYPT_NEVER; |
| 2106 | else if (!_cups_strcasecmp(value, "always")) |
| 2107 | { |
| 2108 | cupsdLogMessage(CUPSD_LOG_ERROR, |
| 2109 | "Encryption value \"%s\" on line %d of %s is invalid in this " |
| 2110 | "context. Using \"required\" instead.", value, linenum, ConfigurationFile); |
| 2111 | |
| 2112 | loc->encryption = HTTP_ENCRYPT_REQUIRED; |
| 2113 | } |
| 2114 | else if (!_cups_strcasecmp(value, "required")) |
| 2115 | loc->encryption = HTTP_ENCRYPT_REQUIRED; |
| 2116 | else if (!_cups_strcasecmp(value, "ifrequested")) |
| 2117 | loc->encryption = HTTP_ENCRYPT_IF_REQUESTED; |
| 2118 | else |
| 2119 | { |
| 2120 | cupsdLogMessage(CUPSD_LOG_ERROR, |
| 2121 | "Unknown Encryption value %s on line %d of %s.", value, linenum, ConfigurationFile); |
| 2122 | return (0); |
| 2123 | } |
| 2124 | } |
| 2125 | else if (!_cups_strcasecmp(line, "Order")) |
| 2126 | { |
| 2127 | /* |
| 2128 | * "Order Deny,Allow" or "Order Allow,Deny"... |
| 2129 | */ |
| 2130 | |
| 2131 | if (!_cups_strncasecmp(value, "deny", 4)) |
| 2132 | loc->order_type = CUPSD_AUTH_ALLOW; |
| 2133 | else if (!_cups_strncasecmp(value, "allow", 5)) |
| 2134 | loc->order_type = CUPSD_AUTH_DENY; |
| 2135 | else |
| 2136 | { |
| 2137 | cupsdLogMessage(CUPSD_LOG_ERROR, "Unknown Order value %s on line %d of %s.", |
| 2138 | value, linenum, ConfigurationFile); |
| 2139 | return (0); |
| 2140 | } |
| 2141 | } |
| 2142 | else if (!_cups_strcasecmp(line, "Allow") || !_cups_strcasecmp(line, "Deny")) |
| 2143 | { |
| 2144 | /* |
no test coverage detected