summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.conf1
-rw-r--r--RELNOTES13
-rw-r--r--client/clparse.c10
-rw-r--r--client/dhclient.c5
-rw-r--r--common/bpf.c3
-rw-r--r--common/conflex.c6
-rw-r--r--common/dlpi.c4
-rw-r--r--common/execute.c8
-rw-r--r--common/lpf.c4
-rw-r--r--common/nit.c4
-rw-r--r--common/options.c4
-rw-r--r--common/packet.c52
-rw-r--r--common/tree.c7
-rw-r--r--common/upf.c4
-rw-r--r--includes/dhcpd.h2
-rw-r--r--omapip/alloc.c13
-rw-r--r--omapip/connection.c4
-rw-r--r--omapip/convert.c6
-rw-r--r--omapip/dispatch.c52
-rw-r--r--omapip/message.c3
-rw-r--r--relay/dhcrelay.c4
-rw-r--r--server/confpars.c18
-rw-r--r--server/ddns.c12
-rw-r--r--server/dhcp.c27
-rw-r--r--server/failover.c43
-rw-r--r--server/omapi.c6
26 files changed, 199 insertions, 116 deletions
diff --git a/Makefile.conf b/Makefile.conf
index 650e9b66..6d90e4ff 100644
--- a/Makefile.conf
+++ b/Makefile.conf
@@ -203,6 +203,7 @@ MINORVERSION=MinorVersion
## FreeBSD
##--freebsd--
#CF = cf/freebsd.h
+#COPTS = -O -Wall -Wno-unused -Werror $(CC_OPTIONS)
#SCRIPT=freebsd
##--freebsd--
diff --git a/RELNOTES b/RELNOTES
index 85808f18..2a1f2979 100644
--- a/RELNOTES
+++ b/RELNOTES
@@ -45,9 +45,16 @@ and for prodding me into improving it.
Changes since 3.0.2rc2
-- A bug introduced in 3.0.2b1 in the DHCP Option Overloading support
- bugfix was repaired. This bug only surfaces in the case where neither
- the FILE nor SNAME fields are available for overloading.
+- Two varaibles introduced in 3.0.2b1 were used without being initialized
+ in the case where neither the FILE nor SNAME fields were available for
+ overloading. This was repaired.
+
+- Many other instances of variables being used without being initialized
+ were repaired.
+
+- An uninitialized variable in omapi_io_destroy() led to the discovery
+ that this function may result in orphaned pointers (and hence, a memory
+ leak).
Changes since 3.0.2rc1
diff --git a/client/clparse.c b/client/clparse.c
index e17b970e..e5079a1a 100644
--- a/client/clparse.c
+++ b/client/clparse.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: clparse.c,v 1.62.2.6 2004/06/10 17:59:11 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.62.2.7 2004/11/24 17:39:14 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -611,7 +611,7 @@ void parse_option_list (cfile, list)
int ix;
int token;
const char *val;
- pair p = (pair)0, q, r;
+ pair p = (pair)0, q = (pair)0, r;
struct option *option;
ix = 0;
@@ -771,9 +771,7 @@ int interface_or_dummy (struct interface_info **pi, const char *name)
/* If we didn't find an interface, make a dummy interface as
a placeholder. */
if (!ip) {
- isc_result_t status;
- status = interface_allocate (&ip, MDL);
- if (status != ISC_R_SUCCESS)
+ if ((status = interface_allocate (&ip, MDL)) != ISC_R_SUCCESS)
log_fatal ("Can't record interface %s: %s",
name, isc_result_totext (status));
strcpy (ip -> name, name);
@@ -786,6 +784,8 @@ int interface_or_dummy (struct interface_info **pi, const char *name)
}
if (pi)
status = interface_reference (pi, ip, MDL);
+ else
+ status = ISC_R_FAILURE;
interface_dereference (&ip, MDL);
if (status != ISC_R_SUCCESS)
return 0;
diff --git a/client/dhclient.c b/client/dhclient.c
index c849616f..709c507c 100644
--- a/client/dhclient.c
+++ b/client/dhclient.c
@@ -32,7 +32,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.129.2.22 2004/09/29 23:01:46 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.129.2.23 2004/11/24 17:39:14 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -3153,7 +3153,8 @@ isc_result_t client_dns_update (struct client_state *client, int addp, int ttl)
rcode = ddns_remove_a (&ddns_fwd_name,
client -> active -> address,
&ddns_dhcid);
- }
+ } else
+ rcode = ISC_R_FAILURE;
data_string_forget (&ddns_fwd_name, MDL);
data_string_forget (&ddns_dhcid, MDL);
diff --git a/common/bpf.c b/common/bpf.c
index 9c321533..2066268b 100644
--- a/common/bpf.c
+++ b/common/bpf.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: bpf.c,v 1.48.2.6 2004/06/17 20:54:38 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: bpf.c,v 1.48.2.7 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -478,7 +478,6 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
interface -> rbuf,
interface -> rbuf_offset,
from,
- (unsigned char *)0,
hdr.bh_caplen);
/* If the IP or UDP checksum was bad, skip the packet... */
diff --git a/common/conflex.c b/common/conflex.c
index cdacdf1a..7c809f94 100644
--- a/common/conflex.c
+++ b/common/conflex.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: conflex.c,v 1.92.2.8 2004/09/21 19:25:38 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: conflex.c,v 1.92.2.9 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -303,8 +303,8 @@ static enum dhcp_token read_string (cfile)
int i;
int bs = 0;
int c;
- int value;
- int hex;
+ int value = 0;
+ int hex = 0;
for (i = 0; i < sizeof cfile -> tokbuf; i++) {
again:
diff --git a/common/dlpi.c b/common/dlpi.c
index 08e9764b..83fc4068 100644
--- a/common/dlpi.c
+++ b/common/dlpi.c
@@ -79,7 +79,7 @@
#ifndef lint
static char copyright[] =
-"$Id: dlpi.c,v 1.28.2.2 2004/06/10 17:59:17 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dlpi.c,v 1.28.2.3 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -679,7 +679,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
length -= offset;
#endif
offset = decode_udp_ip_header (interface, dbuf, bufix,
- from, (unsigned char *)0, length);
+ from, length);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0) {
diff --git a/common/execute.c b/common/execute.c
index 72d549ed..39653309 100644
--- a/common/execute.c
+++ b/common/execute.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: execute.c,v 1.44.2.11 2004/09/10 21:02:31 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: execute.c,v 1.44.2.12 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -370,7 +370,9 @@ int execute_statements (result, packet, lease, client_state,
goto blb;
}
}
- }
+ } else
+ binding = NULL;
+
if (ns && binding) {
status = (evaluate_expression
(&binding -> value, packet, lease,
@@ -850,7 +852,7 @@ void write_statements (file, statements, indent)
case log_statement:
indent_spaces (file, indent);
fprintf (file, "log ");
- col = token_print_indent (file, col, indent + 4,
+ col = token_print_indent (file, indent + 4, indent + 4,
"", "", "(");
switch (r -> data.log.priority) {
case log_priority_fatal:
diff --git a/common/lpf.c b/common/lpf.c
index 87ba8fea..54c11388 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -28,7 +28,7 @@
#ifndef lint
static char copyright[] =
-"$Id: lpf.c,v 1.29.2.2 2004/06/10 17:59:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: lpf.c,v 1.29.2.3 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -360,7 +360,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix, from,
- (unsigned char *)0, (unsigned)length);
+ (unsigned)length);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff --git a/common/nit.c b/common/nit.c
index ea1f5dcf..bd8472fe 100644
--- a/common/nit.c
+++ b/common/nit.c
@@ -35,7 +35,7 @@
#ifndef lint
static char copyright[] =
-"$Id: nit.c,v 1.34.2.2 2004/06/10 17:59:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: nit.c,v 1.34.2.3 2004/11/24 17:39:15 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -370,7 +370,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, (unsigned char *)0, length);
+ from, length);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff --git a/common/options.c b/common/options.c
index a5f5bf8f..af0cbc89 100644
--- a/common/options.c
+++ b/common/options.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: options.c,v 1.85.2.24 2004/11/12 22:08:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: options.c,v 1.85.2.25 2004/11/24 17:39:16 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
@@ -944,7 +944,7 @@ int store_options (ocount, buffer, buflen, packet, lease, client_state,
int second_bufsize, third_bufsize;
int firstix, loop_count, rightshift;
int j;
- unsigned len;
+ unsigned len = 0;
unsigned char *ovbuf;
if (ocount)
diff --git a/common/packet.c b/common/packet.c
index 4038aecc..936703ee 100644
--- a/common/packet.c
+++ b/common/packet.c
@@ -33,7 +33,7 @@
#ifndef lint
static char copyright[] =
-"$Id: packet.c,v 1.40.2.3 2004/06/10 17:59:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: packet.c,v 1.40.2.4 2004/11/24 17:39:16 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -210,14 +210,14 @@ ssize_t decode_hw_header (interface, buf, bufix, from)
/* UDP header and IP header decoded together for convenience. */
-ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
+ssize_t decode_udp_ip_header (interface, buf, bufix, from, buflen)
struct interface_info *interface;
unsigned char *buf;
unsigned bufix;
struct sockaddr_in *from;
- unsigned char *data;
unsigned buflen;
{
+ unsigned char *data;
struct ip *ip;
struct udphdr *udp;
u_int32_t ip_len = (buf [bufix] & 0xf) << 2;
@@ -281,31 +281,29 @@ ssize_t decode_udp_ip_header (interface, buf, bufix, from, data, buflen)
header and the data. If the UDP checksum field is zero, we're
not supposed to do a checksum. */
- if (!data) {
- data = buf + bufix + ip_len + sizeof *udp;
- len = ulen - sizeof *udp;
- ++udp_packets_length_checked;
- if (len + data > buf + bufix + buflen) {
- ++udp_packets_length_overflow;
- if (udp_packets_length_checked > 4 &&
- (udp_packets_length_checked /
- udp_packets_length_overflow) < 2) {
- log_info ("%d udp packets in %d too long - dropped",
- udp_packets_length_overflow,
- udp_packets_length_checked);
- udp_packets_length_overflow =
- udp_packets_length_checked = 0;
- }
- return -1;
- }
- if (len + data < buf + bufix + buflen &&
- len + data != buf + bufix + buflen && !ignore)
- log_debug ("accepting packet with data after udp payload.");
- if (len + data > buf + bufix + buflen) {
- log_debug ("dropping packet with bogus uh_ulen %ld",
- (long)(len + sizeof *udp));
- return -1;
+ data = buf + bufix + ip_len + sizeof *udp;
+ len = ulen - sizeof *udp;
+ ++udp_packets_length_checked;
+ if (len + data > buf + bufix + buflen) {
+ ++udp_packets_length_overflow;
+ if (udp_packets_length_checked > 4 &&
+ (udp_packets_length_checked /
+ udp_packets_length_overflow) < 2) {
+ log_info ("%d udp packets in %d too long - dropped",
+ udp_packets_length_overflow,
+ udp_packets_length_checked);
+ udp_packets_length_overflow =
+ udp_packets_length_checked = 0;
}
+ return -1;
+ }
+ if (len + data < buf + bufix + buflen &&
+ len + data != buf + bufix + buflen && !ignore)
+ log_debug ("accepting packet with data after udp payload.");
+ if (len + data > buf + bufix + buflen) {
+ log_debug ("dropping packet with bogus uh_ulen %ld",
+ (long)(len + sizeof *udp));
+ return -1;
}
usum = udp -> uh_sum;
diff --git a/common/tree.c b/common/tree.c
index daa1411a..f44bffe5 100644
--- a/common/tree.c
+++ b/common/tree.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: tree.c,v 1.101.2.10 2004/09/29 19:25:29 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: tree.c,v 1.101.2.11 2004/11/24 17:39:16 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -702,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)
@@ -1713,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;
diff --git a/common/upf.c b/common/upf.c
index 72e1b29d..cb18362b 100644
--- a/common/upf.c
+++ b/common/upf.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: upf.c,v 1.21.2.4 2004/06/17 20:54:39 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: upf.c,v 1.21.2.5 2004/11/24 17:39:16 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -321,7 +321,7 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
/* Decode the IP and UDP headers... */
offset = decode_udp_ip_header (interface, ibuf, bufix,
- from, (unsigned char *)0, length);
+ from, length);
/* If the IP or UDP checksum was bad, skip the packet... */
if (offset < 0)
diff --git a/includes/dhcpd.h b/includes/dhcpd.h
index 4a5bbe95..37dba4c7 100644
--- a/includes/dhcpd.h
+++ b/includes/dhcpd.h
@@ -1930,7 +1930,7 @@ ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
unsigned, struct hardware *));
ssize_t decode_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
unsigned, struct sockaddr_in *,
- unsigned char *, unsigned));
+ unsigned));
/* ethernet.c */
void assemble_ethernet_header PROTO ((struct interface_info *, unsigned char *,
diff --git a/omapip/alloc.c b/omapip/alloc.c
index 01db1e88..289ebbf5 100644
--- a/omapip/alloc.c
+++ b/omapip/alloc.c
@@ -512,8 +512,11 @@ isc_result_t omapi_object_allocate (omapi_object_t **o,
foo = (omapi_object_t *)0;
status = (*type -> allocator) (&foo, file, line);
tsize = type -> size;
- } else
+ } else {
status = ISC_R_NOMEMORY;
+ tsize = 0;
+ }
+
if (status == ISC_R_NOMEMORY) {
if (type -> sizer)
tsize = (*type -> sizer) (size);
@@ -784,11 +787,11 @@ isc_result_t omapi_typed_data_new (const char *file, int line,
va_list l;
omapi_typed_data_t *new;
unsigned len;
- unsigned val;
- int intval;
- char *s;
+ unsigned val = 0;
+ int intval = 0;
+ char *s = NULL;
isc_result_t status;
- omapi_object_t *obj;
+ omapi_object_t *obj = NULL;
va_start (l, type);
diff --git a/omapip/connection.c b/omapip/connection.c
index d90d9476..598fb86e 100644
--- a/omapip/connection.c
+++ b/omapip/connection.c
@@ -708,8 +708,8 @@ static isc_result_t make_dst_key (DST_KEY **dst_key, omapi_object_t *a) {
omapi_value_t *name = (omapi_value_t *)0;
omapi_value_t *algorithm = (omapi_value_t *)0;
omapi_value_t *key = (omapi_value_t *)0;
- int algorithm_id;
- char *name_str;
+ int algorithm_id = UNKNOWN_KEYALG;
+ char *name_str = NULL;
isc_result_t status = ISC_R_SUCCESS;
if (status == ISC_R_SUCCESS)
diff --git a/omapip/convert.c b/omapip/convert.c
index 1fd6ab9c..90e2e60a 100644
--- a/omapip/convert.c
+++ b/omapip/convert.c
@@ -35,7 +35,7 @@
#ifndef lint
static char copyright[] =
-"$Id: convert.c,v 1.1.2.2 2004/06/10 17:59:46 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: convert.c,v 1.1.2.3 2004/11/24 17:39:17 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include <omapip/omapip_p.h>
@@ -140,6 +140,8 @@ int converted_length (buf, base, width)
number = getUShort (buf);
else if (width == 4)
number = getULong (buf);
+ else
+ return 0;
do {
column = newcolumn;
@@ -174,6 +176,8 @@ int binary_to_ascii (outbuf, inbuf, base, width)
number = getUShort (inbuf);
else if (width == 4)
number = getULong (inbuf);
+ else
+ return 0;
for (i = power - 1 ; i >= 0; i--) {
outbuf [i] = h2a [number % base];
diff --git a/omapip/dispatch.c b/omapip/dispatch.c
index b90adda3..b6c667eb 100644
--- a/omapip/dispatch.c
+++ b/omapip/dispatch.c
@@ -211,7 +211,6 @@ isc_result_t omapi_one_dispatch (omapi_object_t *wo,
int desc;
struct timeval now, to;
omapi_io_object_t *io, *prev;
- isc_result_t status;
omapi_waiter_object_t *waiter;
omapi_object_t *tmp = (omapi_object_t *)0;
@@ -354,7 +353,7 @@ isc_result_t omapi_one_dispatch (omapi_object_t *wo,
if (len)
omapi_value_dereference (&ov, MDL);
}
- status = (*(io -> reaper)) (io -> inner);
+ (*(io -> reaper)) (io -> inner);
if (prev) {
omapi_io_dereference (&prev -> next, MDL);
if (io -> next)
@@ -406,8 +405,7 @@ isc_result_t omapi_one_dispatch (omapi_object_t *wo,
if (io -> readfd &&
(desc = (*(io -> readfd)) (tmp)) >= 0) {
if (FD_ISSET (desc, &r))
- status = ((*(io -> reader)) (tmp));
- /* XXX what to do with status? */
+ ((*(io -> reader)) (tmp));
}
/* Same deal for write descriptors. */
@@ -415,8 +413,7 @@ isc_result_t omapi_one_dispatch (omapi_object_t *wo,
(desc = (*(io -> writefd)) (tmp)) >= 0)
{
if (FD_ISSET (desc, &w))
- status = ((*(io -> writer)) (tmp));
- /* XXX what to do with status? */
+ ((*(io -> writer)) (tmp));
}
omapi_object_dereference (&tmp, MDL);
}
@@ -426,9 +423,9 @@ isc_result_t omapi_one_dispatch (omapi_object_t *wo,
prev = (omapi_io_object_t *)0;
for (io = omapi_io_states.next; io; io = io -> next) {
if (io -> reaper) {
- if (io -> inner)
- status = (*(io -> reaper)) (io -> inner);
- if (!io -> inner || status != ISC_R_SUCCESS) {
+ if (!io -> inner ||
+ ((*(io -> reaper)) (io -> inner) !=
+ ISC_R_SUCCESS)) {
omapi_io_object_t *tmp =
(omapi_io_object_t *)0;
/* Save a reference to the next
@@ -494,27 +491,44 @@ isc_result_t omapi_io_get_value (omapi_object_t *h,
return ISC_R_NOTFOUND;
}
+/* omapi_io_destroy (object, MDL);
+ *
+ * Find the requsted IO [object] and remove it from the list of io
+ * states, causing the cleanup functions to destroy it. Note that we must
+ * hold a reference on the object while moving its ->next reference and
+ * removing the reference in the chain to the target object...otherwise it
+ * may be cleaned up from under us.
+ */
isc_result_t omapi_io_destroy (omapi_object_t *h, const char *file, int line)
{
- omapi_io_object_t *obj, *p, *last;
+ omapi_io_object_t *obj = NULL, *p, *last = NULL, **holder;
if (h -> type != omapi_type_io_object)
return ISC_R_INVALIDARG;
- obj = (omapi_io_object_t *)h;
-
/* remove from the list of I/O states */
for (p = omapi_io_states.next; p; p = p -> next) {
- if (p == obj) {
- omapi_io_dereference (&last -> next, MDL);
- omapi_io_reference (&last -> next, p -> next, MDL);
- omapi_io_dereference (&p, MDL);
- break;
+ if (p == (omapi_io_object_t *)h) {
+ omapi_io_reference (&obj, p, MDL);
+
+ if (last)
+ holder = &last -> next;
+ else
+ holder = &omapi_io_states.next;
+
+ omapi_io_dereference (holder, MDL);
+
+ if (obj -> next) {
+ omapi_io_reference (holder, obj -> next, MDL);
+ omapi_io_dereference (&obj -> next, MDL);
+ }
+
+ return omapi_io_dereference (&obj, MDL);
}
last = p;
}
-
- return ISC_R_SUCCESS;
+
+ return ISC_R_NOTFOUND;
}
isc_result_t omapi_io_signal_handler (omapi_object_t *h,
diff --git a/omapip/message.c b/omapip/message.c
index 587b24de..53fac626 100644
--- a/omapip/message.c
+++ b/omapip/message.c
@@ -652,7 +652,8 @@ omapi_message_process_internal (omapi_object_t *mo, omapi_object_t *po)
case OMAPI_OP_UPDATE:
if (m && m -> object) {
- omapi_object_reference (&object, m -> object, MDL);
+ status = omapi_object_reference (&object, m -> object,
+ MDL);
} else {
status = omapi_handle_lookup (&object, message -> h);
if (status != ISC_R_SUCCESS) {
diff --git a/relay/dhcrelay.c b/relay/dhcrelay.c
index 13417f75..5d18ebd5 100644
--- a/relay/dhcrelay.c
+++ b/relay/dhcrelay.c
@@ -34,7 +34,7 @@
#ifndef lint
static char ocopyright[] =
-"$Id: dhcrelay.c,v 1.52.2.8 2004/10/04 20:39:44 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dhcrelay.c,v 1.52.2.9 2004/11/24 17:39:18 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -654,7 +654,7 @@ int find_interface_by_agent_option (packet, out, buf, len)
{
int i = 0;
u_int8_t *circuit_id = 0;
- unsigned circuit_id_len;
+ unsigned circuit_id_len = 0;
struct interface_info *ip;
while (i < len) {
diff --git a/server/confpars.c b/server/confpars.c
index a7f14fc6..a6a67e96 100644
--- a/server/confpars.c
+++ b/server/confpars.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: confpars.c,v 1.143.2.23 2004/09/30 17:31:18 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: confpars.c,v 1.143.2.24 2004/11/24 17:39:18 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -154,6 +154,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
if (result != ulen)
log_fatal ("%s: short read of %d bytes instead of %d.",
filename, ulen, result);
+ close (file);
memfile:
/* If we're recording, write out the filename and file contents. */
if (trace_record ())
@@ -161,6 +162,7 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
new_parse (&cfile, -1, fbuf, ulen, filename, 0); /* XXX */
#else
new_parse (&cfile, file, (char *)0, 0, filename, 0);
+ close (file);
#endif
if (leasep)
status = lease_file_subparse (cfile);
@@ -170,7 +172,6 @@ isc_result_t read_conf_file (const char *filename, struct group *group,
#if defined (TRACING)
dfree (dbuf, MDL);
#endif
- close (file);
return status;
}
@@ -1822,7 +1823,7 @@ int parse_class_declaration (cp, cfile, group, type)
struct executable_statement *stmt = (struct executable_statement *)0;
struct expression *expr;
int new = 1;
- isc_result_t status;
+ isc_result_t status = ISC_R_FAILURE;
token = next_token (&val, (unsigned *)0, cfile);
if (token != STRING) {
@@ -2607,7 +2608,8 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
break;
default: /* for gcc, we'll never get here. */
- break;
+ log_fatal ("Impossible error at %s:%d.", MDL);
+ return 0;
}
break;
@@ -2748,7 +2750,7 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
"%s: expecting a binding state.",
val);
skip_to_semi (cfile);
- break;
+ return 0;
}
if (seenbit == 256) {
@@ -2922,11 +2924,13 @@ int parse_lease_declaration (struct lease **lp, struct parse *cfile)
"name");
strcpy (binding -> name, val);
newbinding = 1;
- } else if (binding -> value) {
- binding_value_dereference (&binding -> value,
+ } else {
+ if (binding -> value)
+ binding_value_dereference (&binding -> value,
MDL);
newbinding = 0;
}
+
if (!binding_value_allocate (&binding -> value, MDL))
log_fatal ("no memory for binding value.");
diff --git a/server/ddns.c b/server/ddns.c
index d5b46bb2..5254b49c 100644
--- a/server/ddns.c
+++ b/server/ddns.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: ddns.c,v 1.15.2.14 2004/06/17 20:54:40 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: ddns.c,v 1.15.2.15 2004/11/24 17:39:18 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -315,8 +315,6 @@ int ddns_updates (struct packet *packet,
/*
* Compute the name for the A record.
*/
- s1 = s2 = 0;
-
oc = lookup_option (&server_universe, state -> options,
SV_DDNS_HOST_NAME);
if (oc)
@@ -325,6 +323,8 @@ int ddns_updates (struct packet *packet,
packet -> options,
state -> options,
&lease -> scope, oc, MDL);
+ else
+ s1 = 0;
oc = lookup_option (&server_universe, state -> options,
SV_DDNS_DOMAIN_NAME);
@@ -334,6 +334,8 @@ int ddns_updates (struct packet *packet,
packet -> options,
state -> options,
&lease -> scope, oc, MDL);
+ else
+ s2 = 0;
if (s1 && s2) {
if (ddns_hostname.len + ddns_domainname.len > 253) {
@@ -481,8 +483,10 @@ int ddns_updates (struct packet *packet,
packet -> options,
state -> options,
&lease -> scope, oc, MDL);
+ else
+ s1 = 0;
- if (d1.len > 238) {
+ if (s1 && (d1.len > 238)) {
log_error ("ddns_update: Calculated rev domain name too long.");
s1 = 0;
data_string_forget (&d1, MDL);
diff --git a/server/dhcp.c b/server/dhcp.c
index 16d621f1..8e1a48cf 100644
--- a/server/dhcp.c
+++ b/server/dhcp.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: dhcp.c,v 1.192.2.43 2004/11/04 00:03:43 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dhcp.c,v 1.192.2.44 2004/11/24 17:39:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -1947,6 +1947,7 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
&lease -> scope, oc, MDL);
else
s1 = 0;
+
if (s1 && d1.len == sizeof (u_int32_t)) {
lease_time = getULong (d1.data);
data_string_forget (&d1, MDL);
@@ -1955,7 +1956,7 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
data_string_forget (&d1, MDL);
lease_time = default_lease_time;
}
-
+
/* See if there's a maximum lease time. */
max_lease_time = DEFAULT_MAX_LEASE_TIME;
if ((oc = lookup_option (&server_universe, state -> options,
@@ -2201,6 +2202,9 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
packet -> options,
(struct option_state *)0,
&global_scope, oc, MDL);
+ else
+ s1 = 0;
+
if (oc && s1 &&
lease -> client_hostname &&
strlen (lease -> client_hostname) == d1.len &&
@@ -2675,20 +2679,19 @@ void ack_lease (packet, lease, offer, when, msg, ms_nulltp)
/* Determine wether to use configured or default ping timeout.
*/
if ((oc = lookup_option (&server_universe, state -> options,
- SV_PING_TIMEOUT))) {
- if (evaluate_option_cache (&d1, packet, lease,
- (struct client_state *)0,
+ SV_PING_TIMEOUT)) &&
+ evaluate_option_cache (&d1, packet, lease, NULL,
packet -> options,
state -> options,
&lease -> scope, oc, MDL)) {
- if (d1.len == sizeof (u_int32_t))
- ping_timeout =
- getULong (d1.data);
- data_string_forget (&d1, MDL);
- }
- } else {
+ if (d1.len == sizeof (u_int32_t))
+ ping_timeout = getULong (d1.data);
+ else
+ ping_timeout = DEFAULT_PING_TIMEOUT;
+
+ data_string_forget (&d1, MDL);
+ } else
ping_timeout = DEFAULT_PING_TIMEOUT;
- }
#ifdef DEBUG
log_debug ("Ping timeout: %ld", (long)ping_timeout);
diff --git a/server/failover.c b/server/failover.c
index 2d2c3b87..8b3db614 100644
--- a/server/failover.c
+++ b/server/failover.c
@@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
-"$Id: failover.c,v 1.53.2.34 2004/09/29 16:21:01 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: failover.c,v 1.53.2.35 2004/11/24 17:39:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -3454,9 +3454,9 @@ failover_option_t *dhcp_failover_make_option (unsigned code,
unsigned size, count;
unsigned val;
u_int8_t *iaddr;
- unsigned ilen;
+ unsigned ilen = 0;
u_int8_t *bval;
- char *txt;
+ char *txt = NULL;
#if defined (DEBUG_FAILOVER_MESSAGES)
char tbuf [256];
#endif
@@ -3519,7 +3519,7 @@ failover_option_t *dhcp_failover_make_option (unsigned code,
/* shouldn't get here. */
log_fatal ("bogus type in failover_make_option: %d",
info -> type);
- break;
+ return &null_failover_option;
}
}
@@ -5029,6 +5029,10 @@ normal_binding_state_transition_check (struct lease *lease,
case FTS_FREE: /* for compiler */
new_state = binding_state;
goto out;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
case FTS_ACTIVE:
/* The secondary can't change the state of an active
@@ -5071,6 +5075,9 @@ normal_binding_state_transition_check (struct lease *lease,
case FTS_ACTIVE:
return binding_state;
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
break;
case FTS_EXPIRED:
@@ -5091,6 +5098,10 @@ normal_binding_state_transition_check (struct lease *lease,
case FTS_RESET:
case FTS_EXPIRED:
return binding_state;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
case FTS_RELEASED:
switch (binding_state) {
@@ -5105,6 +5116,10 @@ normal_binding_state_transition_check (struct lease *lease,
case FTS_ACTIVE:
case FTS_RELEASED:
return binding_state;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
case FTS_RESET:
switch (binding_state) {
@@ -5124,6 +5139,10 @@ normal_binding_state_transition_check (struct lease *lease,
case FTS_ABANDONED:
case FTS_RESET:
return binding_state;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
case FTS_BACKUP:
switch (binding_state) {
@@ -5147,7 +5166,15 @@ normal_binding_state_transition_check (struct lease *lease,
case FTS_BACKUP:
new_state = lease -> binding_state;
goto out;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
out:
return new_state;
@@ -5204,8 +5231,16 @@ conflict_binding_state_transition_check (struct lease *lease,
case FTS_ACTIVE:
new_state = binding_state;
break;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
break;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return FTS_RESET;
}
}
return new_state;
diff --git a/server/omapi.c b/server/omapi.c
index 72568321..06d0519e 100644
--- a/server/omapi.c
+++ b/server/omapi.c
@@ -41,7 +41,7 @@
#ifndef lint
static char copyright[] =
-"$Id: omapi.c,v 1.46.2.18 2004/09/30 20:23:07 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
+"$Id: omapi.c,v 1.46.2.19 2004/11/24 17:39:19 dhankins Exp $ Copyright (c) 2004 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@@ -2142,6 +2142,10 @@ isc_result_t binding_scope_get_value (omapi_value_t **value,
case binding_dns:
case binding_function:
return ISC_R_INVALIDARG;
+
+ default:
+ log_fatal ("Impossible case at %s:%d.", MDL);
+ return ISC_R_FAILURE;
}
if (status != ISC_R_SUCCESS)