diff options
Diffstat (limited to 'common/tree.c')
-rw-r--r-- | common/tree.c | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/common/tree.c b/common/tree.c index 0c5fb64d..b302a363 100644 --- a/common/tree.c +++ b/common/tree.c @@ -3,39 +3,30 @@ Routines for manipulating parse trees... */ /* - * Copyright (c) 1995-2001 Internet Software Consortium. - * All rights reserved. + * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") + * Copyright (c) 1995-2003 by Internet Software Consortium * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of The Internet Software Consortium nor the names - * of its contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. + * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT + * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * THIS SOFTWARE IS PROVIDED BY THE INTERNET SOFTWARE CONSORTIUM AND - * CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE INTERNET SOFTWARE CONSORTIUM OR - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF - * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. + * Internet Systems Consortium, Inc. + * 950 Charter Street + * Redwood City, CA 94063 + * <info@isc.org> + * http://www.isc.org/ * - * This software has been written for the Internet Software Consortium + * This software has been written for Internet Systems Consortium * by Ted Lemon in cooperation with Vixie Enterprises and Nominum, Inc. - * To learn more about the Internet Software Consortium, see + * To learn more about Internet Systems Consortium, see * ``http://www.isc.org/''. To learn more about Vixie Enterprises, * see ``http://www.vix.com''. To learn more about Nominum, Inc., see * ``http://www.nominum.com''. @@ -43,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: tree.c,v 1.102 2001/06/27 00:30:00 mellon Exp $ Copyright (c) 1995-2001 The Internet Software Consortium. All rights reserved.\n"; +"$Id: tree.c,v 1.103 2005/03/17 20:15:01 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -101,6 +92,7 @@ int make_const_option_cache (oc, buffer, data, len, option, file, line) } (*oc) -> data.len = len; + (*oc) -> data.buffer = bp; (*oc) -> data.data = &bp -> data [0]; (*oc) -> data.terminated = 0; if (data) @@ -595,7 +587,7 @@ int binding_value_dereference (struct binding_value **v, /* Decrement the reference count. If it's nonzero, we're done. */ --(bv -> refcnt); - rc_register (file, line, v, bv, bv -> refcnt, 1); + rc_register (file, line, v, bv, bv -> refcnt, 1, RC_MISC); if (bv -> refcnt > 0) return 1; if (bv -> refcnt < 0) { @@ -710,8 +702,10 @@ int evaluate_dns_expression (result, packet, lease, client_state, in_options, in_options, cfg_options, scope, expr -> data.ns_add.rrdata, MDL); } - } else + } else { r2 = 0; + tname = NULL; + } if (r0 && r1 && (r2 || expr -> op != expr_ns_add)) { *result = minires_mkupdrec (((expr -> op == expr_ns_add || expr -> op == expr_ns_delete) @@ -743,10 +737,13 @@ int evaluate_dns_expression (result, packet, lease, client_state, in_options, goto dpngood; (*result) -> r_data = (*result) -> r_data_ephem; + /*%Audit% 16 bytes max. %2004.06.17,Safe%*/ sprintf ((char *)(*result) -> r_data_ephem, - "%d.%d.%d.%d", - data.data [0], data.data [1], - data.data [2], data.data [3]); + "%u.%u.%u.%u", + data.data [0] & 0xff, + data.data [1] & 0xff, + data.data [2] & 0xff, + data.data [3] & 0xff); (*result) -> r_size = strlen ((const char *) (*result) -> r_data); @@ -1718,6 +1715,7 @@ int evaluate_data_expression (result, packet, lease, client_state, if (len != 8 && len != 16 && len != 32) { log_info ("binary_to_ascii: %s %ld!", "invalid width", len); + status = 0; goto b2a_out; } len /= 8; @@ -2740,7 +2738,7 @@ void expression_dereference (eptr, file, line) /* Decrement the reference count. If it's nonzero, we're done. */ --(expr -> refcnt); - rc_register (file, line, eptr, expr, expr -> refcnt, 1); + rc_register (file, line, eptr, expr, expr -> refcnt, 1, RC_MISC); if (expr -> refcnt > 0) return; if (expr -> refcnt < 0) { @@ -3106,18 +3104,20 @@ static int op_val (op) case expr_equal: case expr_not_equal: - return 3; + return 4; + case expr_or: case expr_and: - case expr_multiply: - case expr_divide: - case expr_remainder: - return 1; + return 3; - case expr_or: case expr_add: case expr_subtract: return 2; + + case expr_multiply: + case expr_divide: + case expr_remainder: + return 1; } return 100; } @@ -3756,7 +3756,7 @@ int binding_scope_dereference (ptr, file, line) *ptr = (struct binding_scope *)0; --binding_scope -> refcnt; rc_register (file, line, ptr, - binding_scope, binding_scope -> refcnt, 1); + binding_scope, binding_scope -> refcnt, 1, RC_MISC); if (binding_scope -> refcnt > 0) return 1; @@ -3806,7 +3806,7 @@ int fundef_dereference (ptr, file, line) } bp -> refcnt--; - rc_register (file, line, ptr, bp, bp -> refcnt, 1); + rc_register (file, line, ptr, bp, bp -> refcnt, 1, RC_MISC); if (bp -> refcnt < 0) { log_error ("%s(%d): negative refcnt!", file, line); #if defined (DEBUG_RC_HISTORY) |