From: mike Date: Wed, 12 Dec 2012 18:02:06 +0000 (+0000) Subject: More changes for STR #4223: X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f1e99346abf00ef0fc5253759d87aea2a3d0874;p=thirdparty%2Fcups.git More changes for STR #4223: - Fix cupsctl man page - Generate and install cups-files.conf online help. - Fix "-t" operation that shows correct filename. - Use syslog for startup errors. - Fix installation of cupsd.conf - need to use ConfigurationFile and not ServerRoot/cupsd.conf. - Check permissions of ConfigurationFile and CupsFilesFile - should be ConfigFilePerm. git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@10751 7a7537e8-13f0-0310-91df-b6672ffda945 --- diff --git a/CHANGES-1.6.txt b/CHANGES-1.6.txt index f3d2427c7b..0b4018760b 100644 --- a/CHANGES-1.6.txt +++ b/CHANGES-1.6.txt @@ -7,6 +7,8 @@ CHANGES IN CUPS V1.6.2 - Security: All file, directory, user, and group settings are now stored in a separate cups-files.conf configuration file that cannot be set through the CUPS web interface or APIs (STR #4223) + - cupsGetPPD3 could return a local PPD instead of the correct remote + PPD. - The scheduler incorrectly advertised auth-info-required for local queues needing local authentication (STR #4205) - CUPS 1.6 clients using the ServerName directive in client.conf did not diff --git a/configure.in b/configure.in index 62b92ea859..fd0e079db5 100644 --- a/configure.in +++ b/configure.in @@ -68,6 +68,7 @@ AC_OUTPUT(Makedefs cups-config data/testprint desktop/cups.desktop + doc/help/ref-cups-files-conf.html doc/help/ref-cupsd-conf.html doc/help/standard.html doc/index.html diff --git a/doc/Makefile b/doc/Makefile index 8357e80b79..939ea14330 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -105,6 +105,7 @@ HELPFILES = \ help/ref-classes-conf.html \ help/ref-client-conf.html \ help/ref-cupsd-conf.html \ + help/ref-cups-files-conf.html \ help/ref-error_log.html \ help/ref-mailto-conf.html \ help/ref-page_log.html \ diff --git a/man/cupsctl.man b/man/cupsctl.man index a9e3ac14b0..570afea902 100644 --- a/man/cupsctl.man +++ b/man/cupsctl.man @@ -12,7 +12,7 @@ .\" which should have been included with this file. If this file is .\" file is missing or damaged, see the license at "http://www.cups.org/". .\" -.TH cupsctl 8 "CUPS" "16 July 2012" "Apple Inc." +.TH cupsctl 8 "CUPS" "12 December 2012" "Apple Inc." .SH NAME cupsctl \- configure cupsd.conf options .SH SYNOPSIS @@ -84,11 +84,6 @@ Disable printer sharing: .nf cupsctl --no-shared-printers .fi -.LP -Enable printing using the file: pseudo-device: -.nf - cupsctl FileDevice=Yes -.fi .SH KNOWN ISSUES You cannot set the Listen or Port directives using \fIcupsctl\fR. .SH SEE ALSO diff --git a/scheduler/client.c b/scheduler/client.c index 06c90647aa..bb03d1cef3 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -3336,14 +3336,14 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ * Open the new config file... */ - snprintf(filename, sizeof(filename), "%s/cupsd.conf", ServerRoot); - if ((out = cupsdCreateConfFile(filename, ConfigFilePerm)) == NULL) + if ((out = cupsdCreateConfFile(ConfigurationFile, ConfigFilePerm)) == NULL) { cupsFileClose(in); return (HTTP_SERVER_ERROR); } - cupsdLogMessage(CUPSD_LOG_INFO, "Installing config file \"%s\"...", filename); + cupsdLogMessage(CUPSD_LOG_INFO, "Installing config file \"%s\"...", + ConfigurationFile); /* * Copy from the request to the new config file... @@ -3354,12 +3354,12 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ { cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to copy to config file \"%s\": %s", - filename, strerror(errno)); + ConfigurationFile, strerror(errno)); cupsFileClose(in); cupsFileClose(out); - snprintf(filename, sizeof(filename), "%s%s.N", ServerRoot, con->uri + 11); + snprintf(filename, sizeof(filename), "%s.N", ConfigurationFile); cupsdRemoveFile(filename); return (HTTP_SERVER_ERROR); @@ -3371,7 +3371,7 @@ install_cupsd_conf(cupsd_client_t *con) /* I - Connection */ cupsFileClose(in); - if (cupsdCloseCreatedConfFile(out, filename)) + if (cupsdCloseCreatedConfFile(out, ConfigurationFile)) return (HTTP_SERVER_ERROR); /* diff --git a/scheduler/conf.c b/scheduler/conf.c index 8e169e1728..1d741d041f 100644 --- a/scheduler/conf.c +++ b/scheduler/conf.c @@ -797,14 +797,22 @@ cupsdReadConfiguration(void) cupsFileClose(fp); if (!status) + { + if (TestConfigFile) + printf("\"%s\" contains errors.\n", CupsFilesFile); + else + syslog(LOG_LPR, "Unable to read \"%s\" due to errors.", + CupsFilesFile); + return (0); + } } else if (errno == ENOENT) cupsdLogMessage(CUPSD_LOG_INFO, "No %s, using defaults.", CupsFilesFile); else { - cupsdLogMessage(CUPSD_LOG_CRIT, "Unable to open %s: %s", CupsFilesFile, - strerror(errno)); + syslog(LOG_LPR, "Unable to open \"%s\": %s", CupsFilesFile, + strerror(errno)); return (0); } @@ -817,8 +825,8 @@ cupsdReadConfiguration(void) if ((fp = cupsFileOpen(ConfigurationFile, "r")) == NULL) { - cupsdLogMessage(CUPSD_LOG_CRIT, "Unable to open %s: %s", ConfigurationFile, - strerror(errno)); + syslog(LOG_LPR, "Unable to open \"%s\": %s", ConfigurationFile, + strerror(errno)); return (0); } @@ -827,7 +835,15 @@ cupsdReadConfiguration(void) cupsFileClose(fp); if (!status) + { + if (TestConfigFile) + printf("\"%s\" contains errors.\n", ConfigurationFile); + else + syslog(LOG_LPR, "Unable to read \"%s\" due to errors.", + ConfigurationFile); + return (0); + } RunUser = getuid(); @@ -1108,7 +1124,9 @@ cupsdReadConfiguration(void) Group, 1, 1) < 0 || cupsdCheckPermissions(ServerRoot, "ssl", 0700, RunUser, Group, 1, 0) < 0 || - cupsdCheckPermissions(ServerRoot, "cupsd.conf", ConfigFilePerm, RunUser, + cupsdCheckPermissions(ConfigurationFile, NULL, ConfigFilePerm, RunUser, + Group, 0, 0) < 0 || + cupsdCheckPermissions(CupsFilesFile, NULL, ConfigFilePerm, RunUser, Group, 0, 0) < 0 || cupsdCheckPermissions(ServerRoot, "classes.conf", 0600, RunUser, Group, 0, 0) < 0 || diff --git a/scheduler/log.c b/scheduler/log.c index 93265afd50..0d49357364 100644 --- a/scheduler/log.c +++ b/scheduler/log.c @@ -41,6 +41,22 @@ static int log_linesize = 0; /* Size of line for output file */ static char *log_line = NULL; /* Line for output file */ +#ifdef HAVE_VSYSLOG +static const int syslevels[] = /* SYSLOG levels... */ + { + 0, + LOG_EMERG, + LOG_ALERT, + LOG_CRIT, + LOG_ERR, + LOG_WARNING, + LOG_NOTICE, + LOG_INFO, + LOG_DEBUG, + LOG_DEBUG + }; +#endif /* HAVE_VSYSLOG */ + /* * Local functions... @@ -543,8 +559,12 @@ cupsdLogMessage(int level, /* I - Log level */ if ((TestConfigFile || !ErrorLog) && level <= CUPSD_LOG_WARN) { va_start(ap, message); +#ifdef HAVE_VSYSLOG + vsyslog(LOG_LPR | syslevels[level], message, ap); +#else vfprintf(stderr, message, ap); putc('\n', stderr); +#endif /* HAVE_VSYSLOG */ va_end(ap); return (1); @@ -984,21 +1004,6 @@ cupsdWriteErrorLog(int level, /* I - Log level */ 'D', 'd' }; -#ifdef HAVE_VSYSLOG - static const int syslevels[] = /* SYSLOG levels... */ - { - 0, - LOG_EMERG, - LOG_ALERT, - LOG_CRIT, - LOG_ERR, - LOG_WARNING, - LOG_NOTICE, - LOG_INFO, - LOG_DEBUG, - LOG_DEBUG - }; -#endif /* HAVE_VSYSLOG */ #ifdef HAVE_VSYSLOG diff --git a/scheduler/main.c b/scheduler/main.c index ae53964322..625bbc0233 100644 --- a/scheduler/main.c +++ b/scheduler/main.c @@ -535,17 +535,11 @@ main(int argc, /* I - Number of command-line args */ */ if (!cupsdReadConfiguration()) - { - if (TestConfigFile) - printf("%s contains errors\n", ConfigurationFile); - else - syslog(LOG_LPR, "Unable to read configuration file \'%s\' - exiting!", - ConfigurationFile); return (1); - } else if (TestConfigFile) { - printf("%s is OK\n", ConfigurationFile); + printf("\"%s\" is OK.\n", CupsFilesFile); + printf("\"%s\" is OK.\n", ConfigurationFile); return (0); }