diff --git a/bin/named/server.c b/bin/named/server.c index 5789a713a2..e73886ee1f 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: server.c,v 1.349 2001/10/08 07:46:06 marka Exp $ */ +/* $Id: server.c,v 1.350 2001/10/16 20:04:36 gson Exp $ */ #include @@ -2138,7 +2138,10 @@ load_configuration(const char *filename, ns_server_t *server, obj = NULL; if (ns_config_get(maps, "pid-file", &obj) == ISC_R_SUCCESS) - ns_os_writepidfile(cfg_obj_asstring(obj)); + if (cfg_obj_isvoid(obj)) + ns_os_writepidfile(NULL); + else + ns_os_writepidfile(cfg_obj_asstring(obj)); else if (ns_g_lwresdonly) ns_os_writepidfile(lwresd_g_defaultpidfile); else diff --git a/bin/named/unix/os.c b/bin/named/unix/os.c index 9a2697539b..8c4565eb7c 100644 --- a/bin/named/unix/os.c +++ b/bin/named/unix/os.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: os.c,v 1.53 2001/10/13 20:13:53 halley Exp $ */ +/* $Id: os.c,v 1.54 2001/10/16 20:04:38 gson Exp $ */ #include #include @@ -479,8 +479,9 @@ ns_os_writepidfile(const char *filename) { cleanup_pidfile(); - if (strcmp(filename, "none") == 0) + if (filename == NULL) return; + len = strlen(filename); pidfile = malloc(len + 1); if (pidfile == NULL) { diff --git a/doc/arm/Bv9ARM-book.xml b/doc/arm/Bv9ARM-book.xml index 171364fe6b..f52970ccbc 100644 --- a/doc/arm/Bv9ARM-book.xml +++ b/doc/arm/Bv9ARM-book.xml @@ -2,7 +2,7 @@ - + BIND 9 Administrator Reference Manual @@ -2913,9 +2913,11 @@ the default is named.memstats. The pathname of the file the server writes its process ID in. If not specified, the default is /var/run/named.pid. The pid-file is used by programs that want to send signals to the running -nameserver. If the the pid-file is the keyword -"none" then no file will be written and any -existing one will be removed. +nameserver. Specifying pid-file none; disables the +use of a PID file — no file will be written and any +existing one will be removed. Note that none +is a keyword, not a file name, and therefore is not enclosed in +double quotes. statistics-file diff --git a/lib/isccfg/parser.c b/lib/isccfg/parser.c index 8a3919a543..e921f8b81e 100644 --- a/lib/isccfg/parser.c +++ b/lib/isccfg/parser.c @@ -15,7 +15,7 @@ * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: parser.c,v 1.79 2001/10/12 22:00:31 gson Exp $ */ +/* $Id: parser.c,v 1.80 2001/10/16 20:04:41 gson Exp $ */ #include @@ -271,6 +271,9 @@ static isc_result_t create_string(cfg_parser_t *pctx, const char *contents, const cfg_type_t *type, cfg_obj_t **ret); +static isc_result_t +parse_qstring(cfg_parser_t *pctx, const cfg_type_t *type, cfg_obj_t **ret); + static void free_string(cfg_parser_t *pctx, cfg_obj_t *obj); @@ -775,6 +778,41 @@ static cfg_type_t cfg_type_transferformat = { &transferformat_enums }; +/* + * The special keyword "none", as used in the pid-file option. + */ + +static void +print_none(cfg_printer_t *pctx, cfg_obj_t *obj) { + UNUSED(obj); + print(pctx, "none", 4); +} + +static cfg_type_t cfg_type_none = { + "none", NULL, print_none, &cfg_rep_void, NULL +}; + +/* + * A quoted string or the special keyword "none". Used in the pid-file option. + */ +static isc_result_t +parse_qstringornone(cfg_parser_t *pctx, const cfg_type_t *type, + cfg_obj_t **ret) +{ + isc_result_t result; + CHECK(cfg_gettoken(pctx, QSTRING)); + if (pctx->token.type == isc_tokentype_string && + strcasecmp(pctx->token.value.as_pointer, "none") == 0) + return (create_cfgobj(pctx, &cfg_type_none, ret)); + cfg_ungettoken(pctx); + return (parse_qstring(pctx, type, ret)); + cleanup: + return (result); +} + +static cfg_type_t cfg_type_qstringornone = { + "qstringornone", parse_qstringornone, NULL, NULL, NULL }; + /* * Clauses that can be found within the top level of the named.conf * file only. @@ -828,7 +866,7 @@ options_clauses[] = { { "memstatistics-file", &cfg_type_qstring, 0 }, { "multiple-cnames", &cfg_type_boolean, CFG_CLAUSEFLAG_OBSOLETE }, { "named-xfer", &cfg_type_qstring, CFG_CLAUSEFLAG_OBSOLETE }, - { "pid-file", &cfg_type_qstring, 0 }, + { "pid-file", &cfg_type_qstringornone, 0 }, { "port", &cfg_type_uint32, 0 }, { "random-device", &cfg_type_qstring, 0 }, { "recursive-clients", &cfg_type_uint32, 0 },