diff options
author | Shawn Routhier <sar@isc.org> | 2016-02-02 10:13:11 -0800 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2016-02-02 10:13:11 -0800 |
commit | 1d3fc4d0d8f8781c1c718d31ea33096a3f48e8ab (patch) | |
tree | 90f2bfa0a42c5bf2655bf389e84530b9f4c7b6aa | |
parent | 1bfdeaaee92505c2bf9bb3cc525369ec10c6bf3e (diff) | |
download | isc-dhcp-1d3fc4d0d8f8781c1c718d31ea33096a3f48e8ab.tar.gz |
[master] Handle long commands in execute better
Use token_print_indent_concat() to write the comamnd in an
execute statement to the lease file. This keeps the quotes
with the command. When using token_print_indent() and passing
the quotes as a prefix and suffix they could be discarded
if the command was overly long.
-rw-r--r-- | RELNOTES | 4 | ||||
-rw-r--r-- | common/execute.c | 23 |
2 files changed, 19 insertions, 8 deletions
@@ -195,6 +195,10 @@ by Eric Young (eay@cryptsoft.com). - Add more option definitions. [ISC-Bugs #40562] +- Correct outputting of long lines in the lease file when writing + a lease that includes long strings in an execute statement. + [ISC-Bugs #40994] + Changes since 4.3.3b1 - None diff --git a/common/execute.c b/common/execute.c index cd2ebbc1..da68201d 100644 --- a/common/execute.c +++ b/common/execute.c @@ -3,7 +3,7 @@ Support for executable statements. */ /* - * Copyright (c) 2009,2013-2015 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 2009,2013-2016 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 2004-2007 by Internet Systems Consortium, Inc. ("ISC") * Copyright (c) 1998-2003 by Internet Software Consortium * @@ -990,18 +990,25 @@ void write_statements (file, statements, indent) break; case execute_statement: + #ifdef ENABLE_EXECUTE - indent_spaces (file, indent); + indent_spaces(file, indent); col = token_print_indent(file, indent + 4, indent + 4, "", "", "execute"); col = token_print_indent(file, col, indent + 4, " ", "", "("); - col = token_print_indent(file, col, indent + 4, "\"", "\"", r->data.execute.command); - for (expr = r->data.execute.arglist; expr; expr = expr->data.arg.next) { - col = token_print_indent(file, col, indent + 4, "", " ", ","); - col = write_expression (file, expr->data.arg.val, col, indent + 4, 0); - } - (void) token_print_indent(file, col, indent + 4, "", "", ");"); + col = token_print_indent_concat(file, col, indent + 4, + "", "", "\"", + r->data.execute.command, + "\"", (char *)0); + for (expr = r->data.execute.arglist; expr; expr = expr->data.arg.next) { + col = token_print_indent(file, col, indent + 4, + "", " ", ","); + col = write_expression(file, expr->data.arg.val, + col, indent + 4, 0); + } + (void) token_print_indent(file, col, indent + 4, + "", "", ");"); #else /* !ENABLE_EXECUTE */ log_fatal("Impossible case at %s:%d (ENABLE_EXECUTE " "is not defined).", MDL); |