From 81beacfb83c4004329a504d1a6f091950f476580 Mon Sep 17 00:00:00 2001 From: Damien Neil Date: Sat, 2 Dec 2000 00:04:22 +0000 Subject: [PATCH] Added a case to handle log statements in write_statements(), avoiding server death when log statements appear in commit or expiry clauses. --- common/execute.c | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/common/execute.c b/common/execute.c index 07fb0435..0991b7a9 100644 --- a/common/execute.c +++ b/common/execute.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: execute.c,v 1.41 2000/11/28 22:50:38 mellon Exp $ Copyright (c) 1998-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: execute.c,v 1.42 2000/12/02 00:04:22 neild Exp $ Copyright (c) 1998-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -847,6 +847,40 @@ void write_statements (file, statements, indent) col = token_print_indent (file, col, indent + 6, " ", "", ";"); break; + + case log_statement: + indent_spaces (file, indent); + fprintf (file, "log "); + col = token_print_indent (file, col, indent + 4, + "", "", "("); + switch (r -> data.log.priority) { + case log_priority_fatal: + col = token_print_indent + (file, col, indent + 4, "", + " ", "fatal,"); + break; + case log_priority_error: + col = token_print_indent + (file, col, indent + 4, "", + " ", "error,"); + break; + case log_priority_debug: + col = token_print_indent + (file, col, indent + 4, "", + " ", "debug,"); + break; + case log_priority_info: + col = token_print_indent + (file, col, indent + 4, "", + " ", "info,"); + break; + } + col = write_expression (file, r -> data.log.expr, + indent + 4, indent + 4, 0); + col = token_print_indent (file, col, indent + 4, + "", "", ");"); + + break; default: log_fatal ("bogus statement type %d\n", r -> op);