mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 23:55:27 +00:00
797. [func] Issue a warning if the 'directory' option contains
a relative path. [RT #269]
This commit is contained in:
2
CHANGES
2
CHANGES
@@ -1,3 +1,5 @@
|
|||||||
|
797. [func] Issue a warning if the 'directory' option contains
|
||||||
|
a relative path. [RT #269]
|
||||||
|
|
||||||
796. [func] When a size limit is associated with a log file,
|
796. [func] When a size limit is associated with a log file,
|
||||||
only roll it when the size is reached, not every
|
only roll it when the size is reached, not every
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: server.c,v 1.313 2001/03/27 18:17:09 gson Exp $ */
|
/* $Id: server.c,v 1.314 2001/03/29 02:33:43 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -1396,11 +1396,18 @@ directory_callback(const char *clausename, cfg_obj_t *obj, void *arg) {
|
|||||||
* Change directory.
|
* Change directory.
|
||||||
*/
|
*/
|
||||||
directory = cfg_obj_asstring(obj);
|
directory = cfg_obj_asstring(obj);
|
||||||
|
|
||||||
|
if (!isc_file_isabsolute(directory) &&
|
||||||
|
!isc_file_iscurrentdir(directory))
|
||||||
|
cfg_obj_log(obj, ns_g_lctx, ISC_LOG_WARNING,
|
||||||
|
"directory '%s' contains a relative path",
|
||||||
|
directory);
|
||||||
|
|
||||||
result = isc_dir_chdir(directory);
|
result = isc_dir_chdir(directory);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
cfg_obj_log(obj, ns_g_lctx, ISC_LOG_ERROR,
|
cfg_obj_log(obj, ns_g_lctx, ISC_LOG_ERROR,
|
||||||
"change directory to '%s' failed: %s",
|
"change directory to '%s' failed: %s",
|
||||||
directory, isc_result_totext(result));
|
directory, isc_result_totext(result));
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: file.h,v 1.14 2001/01/09 21:56:54 bwelling Exp $ */
|
/* $Id: file.h,v 1.15 2001/03/29 02:33:47 bwelling Exp $ */
|
||||||
|
|
||||||
#ifndef ISC_FILE_H
|
#ifndef ISC_FILE_H
|
||||||
#define ISC_FILE_H 1
|
#define ISC_FILE_H 1
|
||||||
@@ -171,6 +171,12 @@ isc_file_isabsolute(const char *filename);
|
|||||||
* Return ISC_TRUE iff the given file name is absolute.
|
* Return ISC_TRUE iff the given file name is absolute.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
isc_file_iscurrentdir(const char *filename);
|
||||||
|
/*
|
||||||
|
* Return ISC_TRUE iff the given file name is the current directory (".").
|
||||||
|
*/
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
isc_file_template(const char *path, const char *templet, char *buf,
|
isc_file_template(const char *path, const char *templet, char *buf,
|
||||||
size_t buflen);
|
size_t buflen);
|
||||||
|
@@ -15,7 +15,7 @@
|
|||||||
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id: file.c,v 1.28 2001/01/09 21:58:17 bwelling Exp $ */
|
/* $Id: file.c,v 1.29 2001/03/29 02:33:48 bwelling Exp $ */
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
@@ -228,3 +228,8 @@ isc_boolean_t
|
|||||||
isc_file_isabsolute(const char *filename) {
|
isc_file_isabsolute(const char *filename) {
|
||||||
return (ISC_TF(filename[0] == '/'));
|
return (ISC_TF(filename[0] == '/'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
isc_file_iscurrentdir(const char *filename) {
|
||||||
|
return (ISC_TF(filename[0] == '.' && filename[1] == '\0'));
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user