Commit 40817ed9 authored by David Lawrence's avatar David Lawrence
Browse files

378. [func] named and lwresd will log the command line arguments

			they were started with in the "starting ..." message.
[RT #165]
parent 128da6ab
378. [func] named and lwresd will log the command line arguments
they were started with in the "starting ..." message.
377. [bug] When additional data lookups were refused due to
"allow-query", the databases were still being
......@@ -512,7 +514,7 @@
240. [func] databases now come in three flavours: zone, cache
and stub.
239. [feature] If ISC_MEM_DEBUG is enabled, the variable
239. [func] If ISC_MEM_DEBUG is enabled, the variable
isc_mem_debugging controls whether messages
are printed or not.
......
......@@ -15,10 +15,11 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: main.c,v 1.76 2000/08/01 01:11:51 tale Exp $ */
/* $Id: main.c,v 1.77 2000/08/09 03:44:42 tale Exp $ */
#include <config.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
......@@ -52,6 +53,7 @@
static isc_boolean_t want_stats = ISC_FALSE;
static isc_boolean_t lwresd_only = ISC_FALSE;
static const char * program_name = "named";
static char saved_command_line[512];
void
ns_main_earlyfatal(const char *format, ...) {
......@@ -96,8 +98,8 @@ assertion_failed(const char *file, int line, isc_assertiontype_t type,
"%s:%d: %s(%s) failed", file, line,
isc_assertion_typetotext(type), cond);
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
NS_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"exiting (due assertion failure)");
NS_LOGMODULE_MAIN, ISC_LOG_CRITICAL,
"exiting (due assertion failure)");
} else {
fprintf(stderr, "%s:%d: %s(%s) failed\n",
file, line, isc_assertion_typetotext(type), cond);
......@@ -185,6 +187,49 @@ usage(void) {
" [-p port] [-s] [-t chrootdir] [-u username]\n");
}
static void
save_command_line(int argc, char *argv[]) {
int i;
char *src;
char *dst;
char *eob;
const char truncated[] = "...";
isc_boolean_t quoted = ISC_FALSE;
dst = saved_command_line;
eob = saved_command_line + sizeof(saved_command_line);
for (i = 1; i < argc && dst < eob; i++) {
*dst++ = ' ';
src = argv[i];
while (*src != '\0' && dst < eob) {
/*
* This won't perfectly produce a shell-independent
* pastable command line in all circumstances, but
* comes close, and for practical purposes will
* nearly always be fine.
*/
if (quoted || isalnum(*src & 0xff) ||
*src == '-' || *src == '_' ||
*src == '.' || *src == '/') {
*dst++ = *src++;
quoted = ISC_FALSE;
} else {
*dst++ = '\\';
quoted = ISC_TRUE;
}
}
}
INSIST(sizeof(saved_command_line) >= sizeof(truncated));
if (dst == eob)
strcpy(eob - sizeof(truncated), truncated);
else
*dst = '\0';
}
static void
parse_lwresd_command_line(int argc, char *argv[]) {
int ch;
......@@ -265,6 +310,12 @@ parse_command_line(int argc, char *argv[]) {
unsigned int port;
char *s;
/*
* XXXDCL perhaps the saved command line should be put in the
* named.pid file, as sendmail does with sendmail.pid.
*/
save_command_line(argc, argv);
s = strrchr(argv[0], '/');
if (s == NULL)
s = argv[0];
......@@ -440,7 +491,8 @@ setup(void) {
ns_os_daemonize();
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_MAIN,
ISC_LOG_NOTICE, "starting BIND %s", ns_g_version);
ISC_LOG_NOTICE, "starting BIND %s%s", ns_g_version,
saved_command_line);
result = create_managers();
if (result != ISC_R_SUCCESS)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment