* compare_clients() - Compare two client connections.
* data_ready() - Check whether data is available from a client.
* get_file() - Get a filename and state info.
- * install_conf_file() - Install a configuration file.
+ * install_cupsd_conf() - Install a configuration file.
* is_cgi() - Is the resource a CGI script/program?
* is_path_absolute() - Is a path absolute and free of relative elements
* (i.e. "..").
static int data_ready(cupsd_client_t *con);
static char *get_file(cupsd_client_t *con, struct stat *filestats,
char *filename, int len);
-static http_status_t install_conf_file(cupsd_client_t *con);
+static http_status_t install_cupsd_conf(cupsd_client_t *con);
static int is_cgi(cupsd_client_t *con, const char *filename,
struct stat *filestats, mime_type_t *type);
static int is_path_absolute(const char *path);
con->http.activity = time(NULL);
con->http.hostaddr = &(con->clientaddr);
con->http.wait_value = 10000;
+ con->http.mode = _HTTP_MODE_SERVER;
/*
* Accept the client and get the remote address...
* Validate the resource name...
*/
- if (strncmp(con->uri, "/admin/conf/", 12) ||
- strchr(con->uri + 12, '/') ||
- strlen(con->uri) == 12)
+ if (strcmp(con->uri, "/admin/conf/cupsd.conf"))
{
/*
- * PUT can only be done to configuration files under
- * /admin/conf...
+ * PUT can only be done to the cupsd.conf file...
*/
cupsdLogMessage(CUPSD_LOG_ERROR,
- "[Client %d] Request for subdirectory \"%s\".",
+ "[Client %d] Disallowed PUT request for \"%s\".",
con->http.fd, con->uri);
if (!cupsdSendError(con, HTTP_FORBIDDEN, CUPSD_AUTH_NONE))
* Install the configuration file...
*/
- status = install_conf_file(con);
+ status = install_cupsd_conf(con);
/*
* Return the status to the client...
/*
- * 'install_conf_file()' - Install a configuration file.
+ * 'install_cupsd_conf()' - Install a configuration file.
*/
static http_status_t /* O - Status */
-install_conf_file(cupsd_client_t *con) /* I - Connection */
+install_cupsd_conf(cupsd_client_t *con) /* I - Connection */
{
char filename[1024]; /* Configuration filename */
- mode_t mode; /* Permissions */
cups_file_t *in, /* Input file */
*out; /* Output file */
char buffer[16384]; /* Copy buffer */
* Open the new config file...
*/
- snprintf(filename, sizeof(filename), "%s%s", ServerRoot, con->uri + 11);
- if (!strcmp(con->uri, "/admin/conf/printers.conf"))
- mode = ConfigFilePerm & 0600;
- else
- mode = ConfigFilePerm;
-
- if ((out = cupsdCreateConfFile(filename, mode)) == NULL)
+ snprintf(filename, sizeof(filename), "%s/cupsd.conf", ServerRoot);
+ if ((out = cupsdCreateConfFile(filename, ConfigFilePerm)) == NULL)
{
cupsFileClose(in);
return (HTTP_SERVER_ERROR);
cupsdClearString(&con->filename);
/*
- * If the cupsd.conf file was updated, set the NeedReload flag...
+ * Set the NeedReload flag...
*/
- if (!strcmp(con->uri, "/admin/conf/cupsd.conf"))
- NeedReload = RELOAD_CUPSD;
- else
- NeedReload = RELOAD_ALL;
-
+ NeedReload = RELOAD_CUPSD;
ReloadTime = time(NULL);
/*