+3058. [bug] Cause named to terminate at startup or rndc reconfig/
+ reload to fail, if a log file specified in the conf
+ file isn't a plain file. [RT #22771]
+
3057. [bug] "rndc secroots" would abort after the first error
and so could miss some views. [RT #23488]
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: logconf.c,v 1.42 2007/06/19 23:46:59 tbox Exp $ */
+/* $Id: logconf.c,v 1.42.816.1 2011/03/04 14:10:12 smann Exp $ */
/*! \file */
FILE *fp;
/*
- * Test that the file can be opened, since isc_log_open()
- * can't effectively report failures when called in
- * isc_log_doit().
- */
- result = isc_stdio_open(dest.file.name, "a", &fp);
- if (result != ISC_R_SUCCESS)
- isc_log_write(ns_g_lctx, CFG_LOGCATEGORY_CONFIG,
- NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
- "logging channel '%s' file '%s': %s",
- channelname, dest.file.name,
- isc_result_totext(result));
- else
- (void)isc_stdio_close(fp);
-
- /*
- * Allow named to continue by returning success.
- */
- result = ISC_R_SUCCESS;
+ * Test to make sure that file is a plain file.
+ * Fix defect #22771
+ */
+ result = isc_file_isplainfile(dest.file.name);
+ if (result == ISC_R_SUCCESS ||
+ result == ISC_R_FILENOTFOUND) {
+ /*
+ * Test that the file can be opened, since
+ * isc_log_open() can't effectively report
+ * failures when called in
+ * isc_log_doit().
+ */
+ result = isc_stdio_open(dest.file.name, "a", &fp);
+ if (result != ISC_R_SUCCESS) {
+ syslog(LOG_ERR,
+ "isc_stdio_open '%s' failed: %s",
+ dest.file.name,
+ isc_result_totext(result));
+ fprintf(stderr,
+ "isc_stdio_open '%s' failed: %s",
+ dest.file.name,
+ isc_result_totext(result));
+ } else
+ (void)isc_stdio_close(fp);
+ } else {
+ syslog(LOG_ERR, "isc_file_isplainfile '%s' failed: %s",
+ dest.file.name, isc_result_totext(result));
+ fprintf(stderr, "isc_file_isplainfile '%s' failed: %s",
+ dest.file.name, isc_result_totext(result));
+ }
}
return (result);
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: conf.sh.in,v 1.59.8.3 2011/03/02 04:47:11 marka Exp $
+# $Id: conf.sh.in,v 1.59.8.4 2011/03/04 14:10:13 smann Exp $
#
# Common configuration data for system tests, to be sourced into
# v6synth
SUBDIRS="acl allow_query addzone autosign cacheclean checkconf checknames
checkzone database dlv dlvauto @DLZ_SYSTEM_TEST@ dlzexternal dns64
- dnssec forward glue gost ixfr limits lwresd masterfile masterformat
- metadata notify nsupdate pending pkcs11 resolver rpz rrsetorder
- sortlist smartsign staticstub stub tkey tsig tsiggss
+ dnssec forward glue gost ixfr limits logfileconfig lwresd masterfile
+ masterformat metadata notify nsupdate pending pkcs11 resolver rpz
+ rrsetorder sortlist smartsign staticstub stub tkey tsig tsiggss
unknown upforwd views xfer xferquota zonechecks"
# PERL will be an empty string if no perl interpreter was found.
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
# PERFORMANCE OF THIS SOFTWARE.
-# $Id: start.pl,v 1.16 2010/09/15 12:07:55 marka Exp $
+# $Id: start.pl,v 1.16.54.1 2011/03/04 14:10:13 smann Exp $
# Framework for starting test servers.
# Based on the type of server specified, check for port availability, remove
# test - name of the test directory
# server - name of the server directory
# options - alternate options for the server
+# NOTE: options must be specified with '-- "<option list>"',
+# for instance: start.pl . ns1 -- "-c n.conf -d 43"
my $usage = "usage: $0 [--noclean] test-directory [server-directory [server-options]]";
my $noclean;
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: file.h,v 1.39 2011/01/11 23:47:14 tbox Exp $ */
+/* $Id: file.h,v 1.39.10.1 2011/03/04 14:10:13 smann Exp $ */
#ifndef ISC_FILE_H
#define ISC_FILE_H 1
* \brief Return #ISC_TRUE if the given file name is absolute.
*/
+isc_result_t
+isc_file_isplainfile(const char *name);
+/*!<
+ * \brief Check that the file is a plain file
+ *
+ * Returns:
+ *\li #ISC_R_SUCCESS
+ * Success. The file is a plain file.
+ *\li #ISC_R_INVALIDFILE
+ * The path specified was not usable by the operating system.
+ *\li #ISC_R_FILENOTFOUND
+ * The file does not exist. This return code comes from
+ * errno=ENOENT when stat returns -1. This code is mentioned
+ * here, because in logconf.c, it is the one rcode that is
+ * permitted in addition to ISC_R_SUCCESS. This is done since
+ * the next call in logconf.c is to isc_stdio_open(), which
+ * will create the file if it can.
+ *\li #other ISC_R_* errors translated from errno
+ * These occur when stat returns -1 and an errno.
+ */
+
isc_boolean_t
isc_file_iscurrentdir(const char *filename);
/*!<
* SUCH DAMAGE.
*/
-/* $Id: file.c,v 1.57 2011/01/11 23:47:14 tbox Exp $ */
+/* $Id: file.c,v 1.57.10.1 2011/03/04 14:10:13 smann Exp $ */
/*! \file */
return (ISC_TF(file_stats(pathname, &stats) == ISC_R_SUCCESS));
}
+isc_result_t
+isc_file_isplainfile(const char *filename) {
+ /*
+ * This function returns success if filename is a plain file.
+ */
+ struct stat filestat;
+ memset(&filestat,0,sizeof(struct stat));
+
+ if ((stat(filename, &filestat)) == -1)
+ return(isc__errno2result(errno));
+
+ if(! S_ISREG(filestat.st_mode))
+ return(ISC_R_INVALIDFILE);
+
+ return(ISC_R_SUCCESS);
+}
+
isc_boolean_t
isc_file_isabsolute(const char *filename) {
REQUIRE(filename != NULL);
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: stdio.c,v 1.8 2007/06/19 23:47:18 tbox Exp $ */
+/* $Id: stdio.c,v 1.8.814.1 2011/03/04 14:10:13 smann Exp $ */
#include <config.h>
#include <unistd.h>
#include <isc/stdio.h>
+#include <isc/stat.h>
#include "errno2result.h"
* PERFORMANCE OF THIS SOFTWARE.
*/
-/* $Id: file.c,v 1.39 2011/01/13 06:36:04 marka Exp $ */
+/* $Id: file.c,v 1.39.8.1 2011/03/04 14:10:13 smann Exp $ */
#include <config.h>
return (ISC_TF(file_stats(pathname, &stats) == ISC_R_SUCCESS));
}
+isc_result_t
+isc_file_isplainfile(const char *filename) {
+ /*
+ * This function returns success if filename is a plain file.
+ */
+ struct stat filestat;
+ memset(&filestat,0,sizeof(struct stat));
+
+ if ((stat(filename, &filestat)) == -1)
+ return(isc__errno2result(errno));
+
+ if(! S_ISREG(filestat.st_mode))
+ return(ISC_R_INVALIDFILE);
+
+ return(ISC_R_SUCCESS);
+}
+
isc_boolean_t
isc_file_isabsolute(const char *filename) {
REQUIRE(filename != NULL);