]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
[v4_1_esv] Handle long commands in execute better
authorShawn Routhier <sar@isc.org>
Tue, 2 Feb 2016 18:18:20 +0000 (10:18 -0800)
committerShawn Routhier <sar@isc.org>
Tue, 2 Feb 2016 18:18:20 +0000 (10:18 -0800)
    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.

RELNOTES
common/execute.c

index 192d37c4cace0bd01d21297dddc519ee0e8c59f9..777e46cb646e6a5723e6cd2cb7a7894dfe68bd51 100644 (file)
--- a/RELNOTES
+++ b/RELNOTES
@@ -160,6 +160,10 @@ by Eric Young (eay@cryptsoft.com).
   modified to work as infinite.
   [ISC-Bugs #40773]
 
+- 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.1-ESV-R12b1
 
 - None
index aa67ad447f1b69ace1e740eab5dedd46a295ff07..de6a0b6bb472a58675b8ab11b37887f1439f04be 100644 (file)
@@ -3,7 +3,7 @@
    Support for executable statements. */
 
 /*
- * Copyright (c) 2009,2013,2014 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
  *
@@ -970,18 +970,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);