]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Change behaviour of concat so that any null argument produces a null result.
authorTed Lemon <source@isc.org>
Sat, 31 Jul 1999 23:24:33 +0000 (23:24 +0000)
committerTed Lemon <source@isc.org>
Sat, 31 Jul 1999 23:24:33 +0000 (23:24 +0000)
common/dhcp-eval.5
common/tree.c

index 89fd9b332aa08eaa785806428e353c0a2ba365da..2ab9d9c5681fd6f2add36c61a3a553118a7e3b16 100644 (file)
@@ -243,9 +243,9 @@ specified as a data expression.
 .B concat (\fIdata-expr1\fB, ..., \fIdata-exprN\fB)\fR
 .RS 0.25i
 The expressions are evaluated, and the results of each evaluation are
-concatenated in the sequence that the subexpressions are listed.   Any
-subexpression that evaluates to null is treated as a zero-length string.
-If all the arguments to concat are null, the result is also null.
+concatenated in the sequence that the subexpressions are listed.   If
+any subexpression evaluates to null, the result of the concatenation
+is null.
 .RE
 .PP
 .B reverse (\fInumeric-expr1\fB, \fIdata-expr2\fB)\fR
index b3b31242b6e4c1fe4b15d2a08f91ff3215486988..b8cdc0ef1341a5fc156118c9db3399ef5b10c0bd 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static char copyright[] =
-"$Id: tree.c,v 1.44 1999/07/31 20:23:19 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
+"$Id: tree.c,v 1.45 1999/07/31 23:24:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.  All rights reserved.\n";
 #endif /* not lint */
 
 #include "dhcpd.h"
@@ -894,18 +894,18 @@ int evaluate_data_expression (result, packet, lease,
                        memcpy (&result -> data [data.len],
                                other.data, other.len + other.terminated);
                } else if (s0)
-                       data_string_copy (result, &data, "expr_concat");
+                       data_string_forget (&data, "expr_concat");
                else if (s1)
-                       data_string_copy (result, &other, "expr_concat");
+                       data_string_forget (&other, "expr_concat");
 #if defined (DEBUG_EXPRESSIONS)
                log_debug ("data: concat (%s, %s) = %s",
                      s0 ? print_hex_1 (data.len, data.data, 20) : "NULL",
                      s1 ? print_hex_2 (other.len, other.data, 20) : "NULL",
-                     ((s0 || s1)
+                     ((s0 && s1)
                       ? print_hex_3 (result -> len, result -> data, 30)
                       : "NULL"));
 #endif
-               return s0 || s1;
+               return s0 && s1;
 
              case expr_encode_int8:
                s0 = evaluate_numeric_expression (&len, packet, lease,