move leases to RESET, and primaries refuse to accept that state
transition (properly).
+- The memset-after-dmalloc() changes made in 3.0.4b1 have been backed out.
+
Changes since 3.0.4b1
- Command line parsing in omshell was repaired - it no longer closes
Parser for dhclient config and lease files... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: clparse.c,v 1.62.2.10 2005/10/14 15:34:52 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: clparse.c,v 1.62.2.11 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
dmalloc (sizeof (struct client_state), MDL);
if (!ip -> client)
log_fatal ("no memory for client state.");
+ memset (ip -> client, 0, sizeof *(ip -> client));
ip -> client -> interface = ip;
}
ix = 0;
for (q = p; q; q = q -> cdr)
(*list) [ix++] = (u_int32_t)(long)q -> car;
+ (*list) [ix] = 0;
}
while (p) {
q = p -> cdr;
*state = ((struct client_state *)dmalloc (sizeof **state, MDL));
if (!*state)
log_fatal ("no memory for client state\n");
+ memset (*state, 0, sizeof **state);
}
void make_client_config (client, config)
dmalloc (sizeof (struct client_lease), MDL));
if (!lease)
log_fatal ("no memory for lease.\n");
+ memset (lease, 0, sizeof *lease);
lease -> is_static = is_static;
if (!option_state_allocate (&lease -> options, MDL))
log_fatal ("no memory for lease options.\n");
#ifndef lint
static char ocopyright[] =
-"$Id: dhclient.c,v 1.129.2.29 2005/10/10 16:45:38 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dhclient.c,v 1.129.2.30 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
log_error ("dhcpoffer: no memory for server name.\n");
destroy_client_lease (lease);
return (struct client_lease *)0;
- } else
+ } else {
memcpy (lease -> server_name,
packet -> raw -> sname, len);
+ lease -> server_name [len] = 0;
+ }
}
/* Ditto for the filename. */
log_error ("dhcpoffer: no memory for filename.\n");
destroy_client_lease (lease);
return (struct client_lease *)0;
- } else
+ } else {
memcpy (lease -> filename,
packet -> raw -> file, len);
+ lease -> filename [len] = 0;
+ }
}
execute_statements_in_scope ((struct binding_value **)0,
}
/* Set $PATH. */
envp [i++] = client_path;
+ envp [i] = (char *)0;
argv [0] = scriptName;
argv [1] = (char *)0;
Memory allocation... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: alloc.c,v 1.53.2.11 2005/08/26 22:45:44 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: alloc.c,v 1.53.2.12 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
}
h = dmalloc (sizeof *h, file, line);
- if (h)
+ if (h) {
+ memset (h, 0, sizeof *h);
return option_chain_head_reference (ptr, h, file, line);
+ }
return 0;
}
}
g = dmalloc (sizeof *g, file, line);
- if (g)
+ if (g) {
+ memset (g, 0, sizeof *g);
return group_reference (ptr, g, file, line);
+ }
return 0;
}
{
struct option *rval =
dmalloc (sizeof (struct option), file, line);
+ if (rval)
+ memset (rval, 0, sizeof *rval);
return rval;
}
foo = dmalloc (sizeof *foo, file, line);
if (!foo)
return foo;
+ memset (foo, 0, sizeof *foo);
return foo;
}
rval = free_expressions;
free_expressions = rval -> data.not;
dmalloc_reuse (rval, file, line, 1);
- memset(rval, 0, sizeof(struct expression));
} else {
rval = dmalloc (sizeof (struct expression), file, line);
if (!rval)
return 0;
}
+ memset (rval, 0, sizeof *rval);
return expression_reference (cptr, rval, file, line);
}
rval = free_binding_values;
free_binding_values = rval -> value.bv;
dmalloc_reuse (rval, file, line, 1);
- memset(rval, 0, sizeof(struct binding_value));
} else {
rval = dmalloc (sizeof (struct binding_value), file, line);
if (!rval)
return 0;
}
+ memset (rval, 0, sizeof *rval);
return binding_value_reference (cptr, rval, file, line);
}
rval = dmalloc (sizeof (struct fundef), file, line);
if (!rval)
return 0;
+ memset (rval, 0, sizeof *rval);
return fundef_reference (cptr, rval, file, line);
}
free_option_caches =
(struct option_cache *)(rval -> expression);
dmalloc_reuse (rval, file, line, 0);
- memset(rval, 0, sizeof(struct option_cache));
} else {
rval = dmalloc (sizeof (struct option_cache), file, line);
if (!rval)
return 0;
}
+ memset (rval, 0, sizeof *rval);
return option_cache_reference (cptr, rval, file, line);
}
bp = dmalloc (len + sizeof *bp, file, line);
if (!bp)
return 0;
+ memset (bp, 0, sizeof *bp);
+ bp -> refcnt = 0;
return buffer_reference (ptr, bp, file, line);
}
bp = dmalloc (strlen (hostname) + sizeof *bp, file, line);
if (!bp)
return 0;
+ memset (bp, 0, sizeof *bp);
+ bp -> refcnt = 0;
strcpy (bp -> hostname, hostname);
return dns_host_entry_reference (ptr, bp, file, line);
}
size = sizeof **ptr + (universe_count - 1) * sizeof (VOIDPTR);
*ptr = dmalloc (size, file, line);
if (*ptr) {
+ memset (*ptr, 0, size);
(*ptr) -> universe_count = universe_count;
(*ptr) -> refcnt = 1;
rc_register (file, line,
bp = dmalloc (sizeof *bp, file, line);
if (!bp)
return 0;
+ memset (bp, 0, sizeof *bp);
return executable_statement_reference (ptr, bp, file, line);
}
p = free_packets;
free_packets = (struct packet *)(p -> raw);
dmalloc_reuse (p, file, line, 1);
- memset(p, 0, sizeof(struct packet));
} else {
- p = dmalloc(sizeof(struct packet), file, line);
+ p = dmalloc (sizeof *p, file, line);
}
- if (p)
+ if (p) {
+ memset (p, 0, sizeof *p);
return packet_reference (ptr, p, file, line);
+ }
return 0;
}
}
d = dmalloc (sizeof *d, file, line);
- if (d)
+ if (d) {
+ memset (d, 0, sizeof *d);
return dns_zone_reference (ptr, d, file, line);
+ }
return 0;
}
bp = dmalloc (sizeof *bp, file, line);
if (!bp)
return 0;
+ memset (bp, 0, sizeof *bp);
binding_scope_reference (ptr, bp, file, line);
return 1;
}
OMAPI object interfaces for the DHCP server. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: comapi.c,v 1.9.2.8 2005/08/26 22:45:44 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: comapi.c,v 1.9.2.9 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
memcpy (group -> name,
value -> u.buffer.value,
value -> u.buffer.len);
+ group -> name [value -> u.buffer.len] = 0;
} else
return ISC_R_INVALIDARG;
return ISC_R_SUCCESS;
#ifndef lint
static char copyright[] =
-"$Id: conflex.c,v 1.92.2.17 2005/10/14 15:34:52 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: conflex.c,v 1.92.2.18 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
tmp = dmalloc (sizeof (struct parse), MDL);
if (!tmp)
return ISC_R_NOMEMORY;
+ memset (tmp, 0, sizeof *tmp);
+ tmp -> token = 0;
tmp -> tlname = name;
tmp -> lpos = tmp -> line = 1;
tmp -> cur_line = tmp -> line1;
tmp -> prev_line = tmp -> line2;
tmp -> token_line = tmp -> cur_line;
+ tmp -> cur_line [0] = tmp -> prev_line [0] = 0;
+ tmp -> warnings_occurred = 0;
tmp -> file = file;
tmp -> eol_token = eolp;
+ tmp -> bufix = 0;
tmp -> buflen = buflen;
if (inbuf) {
+ tmp -> bufsiz = 0;
tmp -> inbuf = inbuf;
} else {
tmp -> inbuf = dmalloc (8192, MDL);
#ifndef lint
static char copyright[] =
-"$Id: discover.c,v 1.42.2.19 2005/09/28 18:58:27 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: discover.c,v 1.42.2.20 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
MDL);
if (!tif)
log_fatal ("no space to remember ifp.");
+ memset (tif, 0, sizeof (struct ifreq));
strcpy (tif -> ifr_name, tmp -> name);
tmp -> ifp = tif;
}
sizeof (struct interface_info *), MDL);
if (!vec)
return;
+ memset (&vec [interface_max], 0,
+ (sizeof (struct interface_info *)) * delta);
interface_max += delta;
if (interface_vector) {
memcpy (vec, interface_vector,
Network input dispatcher... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: dispatch.c,v 1.63.2.6 2005/10/10 16:45:39 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dispatch.c,v 1.63.2.7 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
if (free_timeouts) {
q = free_timeouts;
free_timeouts = q -> next;
- memset(q, 0, sizeof(struct timeout));
} else {
q = ((struct timeout *)
dmalloc (sizeof (struct timeout), MDL));
if (!q)
log_fatal ("add_timeout: no memory!");
}
+ memset (q, 0, sizeof *q);
q -> func = where;
q -> ref = ref;
q -> unref = unref;
Domain Name Service subroutines. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2001-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: dns.c,v 1.35.2.19 2005/09/07 15:11:00 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dns.c,v 1.35.2.20 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
nomem:
return ISC_R_NOMEMORY;
}
+ memset (tkey, 0, sizeof *tkey);
tkey -> data = dmalloc (zone -> key -> key -> len, MDL);
if (!tkey -> data) {
dfree (tkey, MDL);
return ISC_R_NOMEMORY;;
strcpy (tname, name);
tname [len] = '.';
+ tname [len + 1] = 0;
name = tname;
}
if (!dns_zone_hash_lookup (zone, dns_zone_hash, name, 0, MDL))
if (!zone -> name) {
zone -> name =
- dmalloc (strlen (zname) + 1 + (ix ? 1 : 0), MDL);
+ dmalloc (strlen (zname) + 1 + (ix != 0), MDL);
if (!zone -> name) {
dns_zone_dereference (&zone, MDL);
return;
}
strcpy (zone -> name, zname);
/* Add a trailing '.' if it was missing. */
- if (ix)
+ if (ix) {
zone -> name [ix] = '.';
+ zone -> name [ix + 1] = 0;
+ }
}
/* XXX Need to get the lower-level code to push the actual zone
Support for executable statements. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1998-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: execute.c,v 1.44.2.13 2005/08/26 22:45:45 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: execute.c,v 1.44.2.14 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
if (!binding) {
binding = dmalloc (sizeof *binding, MDL);
if (binding) {
+ memset (binding, 0, sizeof *binding);
binding -> name =
dmalloc (strlen
(r -> data.set.name) + 1,
next_let:
if (ns) {
binding = dmalloc (sizeof *binding, MDL);
+ memset (binding, 0, sizeof *binding);
if (!binding) {
blb:
binding_scope_dereference (&ns, MDL);
DHCP options parsing and reassembly. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: options.c,v 1.85.2.32 2005/11/01 23:19:03 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: options.c,v 1.85.2.33 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
universe -> name, oc -> option -> name);
return;
}
+ memset (hash, 0, OPTION_HASH_SIZE * sizeof *hash);
options -> universes [universe -> index] = (VOIDPTR)hash;
} else {
/* Try to find an existing option matching the new one. */
#ifndef lint
static char copyright[] =
-"$Id: parse.c,v 1.104.2.25 2005/10/10 16:45:39 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: parse.c,v 1.104.2.26 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
tokix += has_encapsulation;
if (arrayp)
s [tokix++] = (arrayp > recordp) ? 'a' : 'A';
+ s [tokix] = 0;
option -> format = s;
if (option -> universe -> options [option -> code]) {
/* XXX Free the option, but we can't do that now because they
t = dmalloc (l + sizeof *t, MDL);
if (!t)
log_fatal ("no memory for base64 buffer.");
+ memset (t, 0, (sizeof *t) - 1);
memcpy (t -> string, val, l + 1);
cc += l;
if (last)
strlen (val), MDL));
if (!new)
log_fatal ("can't allocate string.");
+ memset (new, 0, sizeof *new);
strcpy (new -> string, val);
if (cur) {
cur -> next = new;
}
strcpy (s, zone -> name);
s [i] = '.';
+ s [i + 1] = 0;
dfree (zone -> name, MDL);
zone -> name = s;
}
Turn data structures into printable text. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: print.c,v 1.53.2.12 2005/08/26 22:45:46 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: print.c,v 1.53.2.13 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
} else
*nsp++ = *sp;
}
+ *nsp++ = 0;
}
return buf;
}
} else
*nsp++ = s [i];
}
+ *nsp++ = 0;
}
return buf;
}
}
if (!len)
*s++ = '=';
+ *s++ = 0;
if (s > b + bl + 1)
abort ();
return b;
buf [0] = '"';
memcpy (buf + 1, data -> data, data -> len);
buf [data -> len + 1] = '"';
+ buf [data -> len + 2] = 0;
i = token_print_indent (file, col, indent,
prefix, suffix, buf);
dfree (buf, MDL);
Tables of information... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: tables.c,v 1.51.2.11 2005/11/01 23:19:03 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: tables.c,v 1.51.2.12 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
dmalloc (universe_max * sizeof (struct universe *), MDL));
if (!universes)
log_fatal ("Can't allocate option space table.");
+ memset (universes, 0, universe_max * sizeof (struct universe *));
/* Set up the DHCP option universe... */
dhcp_universe.name = "dhcp";
Routines for manipulating parse trees... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: tree.c,v 1.101.2.12 2005/08/26 22:45:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: tree.c,v 1.101.2.13 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
binding_scope_dereference (&ns, MDL);
return 0;
} else {
+ memset (nb, 0, sizeof *nb);
nb -> name = dmalloc (strlen (s -> string) + 1,
MDL);
if (nb -> name)
data_string_forget (&name, MDL);
} else {
memcpy (tname, name.data, name.len);
+ tname [name.len] = 0;
memset (&data, 0, sizeof data);
r2 = evaluate_data_expression
(&data, packet, lease, client_state,
if (!binding)
return (struct binding *)0;
+ memset (binding, 0, sizeof *binding);
binding -> name = dmalloc (strlen (name) + 1, MDL);
if (!binding -> name) {
dfree (binding, MDL);
protocol... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: alloc.c,v 1.22.2.11 2005/08/26 22:45:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium, Inc. All rights reserved.\n";
+"$Id: alloc.c,v 1.22.2.12 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium, Inc. All rights reserved.\n";
#endif /* not lint */
#include <omapip/omapip_p.h>
size_t usize, size_t psize,
const char *file, int line)
{
- /* We don't know if we got this buffer from dmalloc() or an allocator
- * that might not initialize the buffer. This memset() is required.
- */
memset (o, 0, psize);
o -> type = type;
if (type -> initialize)
t = (omapi_buffer_t *)dmalloc (sizeof *t, file, line);
if (!t)
return ISC_R_NOMEMORY;
+ memset (t, 0, sizeof *t);
status = omapi_buffer_reference (h, t, file, line);
if (status != ISC_R_SUCCESS)
dfree (t, file, line);
new = dmalloc (len, file, line);
if (!new)
return ISC_R_NOMEMORY;
+ memset (new, 0, len);
switch (type) {
case omapi_datatype_int:
new = dmalloc (nlen, file, line);
if (!new)
return ISC_R_NOMEMORY;
+ memset (new, 0, OMAPI_DATA_STRING_EMPTY_SIZE);
new -> len = len;
return omapi_data_string_reference (d, new, file, line);
}
new = dmalloc (sizeof *new, file, line);
if (!new)
return ISC_R_NOMEMORY;
+ memset (new, 0, sizeof *new);
return omapi_value_reference (d, new, file, line);
}
sizeof (omapi_addr_list_t), file, line);
if (!new)
return ISC_R_NOMEMORY;
+ memset (new, 0, ((count * sizeof (omapi_addr_t)) +
+ sizeof (omapi_addr_list_t)));
new -> count = count;
new -> addresses = (omapi_addr_t *)(new + 1);
return omapi_addr_list_reference (d, new, file, line);
Subroutines that support the omapi extensible array type. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2001-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char ocopyright[] =
-"$Id: array.c,v 1.1.2.3 2005/08/26 22:45:47 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
+"$Id: array.c,v 1.1.2.4 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
#endif
#include <omapip/omapip_p.h>
file, line);
if (!newbuf)
return ISC_R_NOMEMORY;
+ /* Zero the new elements. */
+ memset (&newbuf [array -> max], 0, (sizeof (char *)) * delta);
array -> max += delta;
/* Copy the old array data into the new buffer. */
if (array -> data) {
Subroutines that support the generic object. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char ocopyright[] =
-"$Id: generic.c,v 1.9.2.5 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
+"$Id: generic.c,v 1.9.2.6 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
#endif
#include <omapip/omapip_p.h>
memcpy (ca, g -> changed,
g -> va_max * sizeof *ca);
}
+ memset (va + g -> va_max, 0,
+ (vm_new - g -> va_max) * sizeof *va);
+ memset (ca + g -> va_max, 0,
+ (vm_new - g -> va_max) * sizeof *ca);
if (g -> values)
dfree (g -> values, MDL);
if (g -> changed)
Functions for maintaining handles on objects. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char ocopyright[] =
-"$Id: handle.c,v 1.6.2.2 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
+"$Id: handle.c,v 1.6.2.3 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
#endif
#include <omapip/omapip_p.h>
omapi_handle_table = dmalloc (sizeof *omapi_handle_table, MDL);
if (!omapi_handle_table)
return ISC_R_NOMEMORY;
+ memset (omapi_handle_table, 0, sizeof *omapi_handle_table);
+ omapi_handle_table -> first = 0;
omapi_handle_table -> limit = OMAPI_HANDLE_TABLE_SIZE;
omapi_handle_table -> leafp = 1;
}
new = dmalloc (sizeof *new, MDL);
if (!new)
return ISC_R_NOMEMORY;
+ memset (new, 0, sizeof *new);
+ new -> first = 0;
new -> limit = (omapi_handle_table -> limit *
OMAPI_HANDLE_TABLE_SIZE);
+ new -> leafp = 0;
new -> children [0].table = omapi_handle_table;
omapi_handle_table = new;
}
inner = dmalloc (sizeof *inner, MDL);
if (!inner)
return ISC_R_NOMEMORY;
+ memset (inner, 0, sizeof *inner);
inner -> first = index * scale + table -> first;
inner -> limit = inner -> first + scale;
if (scale == OMAPI_HANDLE_TABLE_SIZE)
new = dmalloc (sizeof *new, MDL);
if (!new)
return ISC_R_NOMEMORY;
+ memset (new, 0, sizeof *new);
new -> first = base;
new -> limit = base + scale;
+ if (scale == OMAPI_HANDLE_TABLE_SIZE)
+ new -> leafp = 0;
new -> children [index].table = inner;
*table = new;
return ISC_R_SUCCESS;
Routines for manipulating hash tables... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: hash.c,v 1.1.2.7 2005/08/26 22:45:48 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: hash.c,v 1.1.2.8 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include <omapip/omapip_p.h>
# if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
rval -> next = hash_bucket_hunks;
hash_bucket_hunks = rval;
+ hash_bucket_hunks -> len = 0;
i++;
rval++;
#endif
{
if (!new_hash_table (rp, DEFAULT_HASH_SIZE, file, line))
return 0;
+ memset (&(*rp) -> buckets [0], 0,
+ DEFAULT_HASH_SIZE * sizeof (struct hash_bucket *));
(*rp) -> referencer = referencer;
(*rp) -> dereferencer = dereferencer;
if (casep) {
Functions supporting the object management protocol... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char ocopyright[] =
-"$Id: protocol.c,v 1.25.2.9 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
+"$Id: protocol.c,v 1.25.2.10 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
#endif
#include <omapip/omapip_p.h>
return ISC_R_NOMEMORY;
}
+ obj -> default_auth -> next = (omapi_remote_auth_t *)0;
status = omapi_object_reference (&obj -> default_auth -> a,
a, MDL);
if (status != ISC_R_SUCCESS) {
Subroutines providing general support for objects. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char ocopyright[] =
-"$Id: support.c,v 1.24.2.5 2005/08/26 22:45:48 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
+"$Id: support.c,v 1.24.2.6 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
#endif
#include <omapip/omapip_p.h>
t = dmalloc (sizeof *t, MDL);
if (!t)
return ISC_R_NOMEMORY;
+ memset (t, 0, sizeof *t);
t -> name = name;
t -> set_value = set_value;
transactions... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 2001-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char ocopyright[] =
-"$Id: trace.c,v 1.9.2.6 2005/10/10 16:48:03 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
+"$Id: trace.c,v 1.9.2.7 2006/02/15 23:00:08 dhankins Exp $ Copyright 2004-2005 Internet Systems Consortium.";
#endif
#include <omapip/omapip_p.h>
sizeof (trace_type_t *)), MDL);
if (!vec)
return;
+ memset (&vec [trace_type_max], 0,
+ (sizeof (trace_type_t *)) * delta);
trace_type_max += delta;
if (trace_types) {
memcpy (vec, trace_types,
return ttmp;
}
-
+
static isc_result_t trace_type_record (trace_type_t *ttmp, unsigned slen,
const char *file, int line)
{
Parser for dhcpd config file... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1995-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: confpars.c,v 1.143.2.28 2005/10/14 15:34:52 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: confpars.c,v 1.143.2.29 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
sizeof (struct lease *), MDL);
if (!class -> billed_leases)
log_fatal ("no memory for billing");
+ memset (class -> billed_leases, 0,
+ (class -> lease_limit *
+ sizeof class -> billed_leases));
}
data_string_copy (&class -> hash_string, &data, MDL);
if (!pc -> hash &&
sizeof (struct lease *), MDL);
if (!class -> billed_leases)
log_fatal ("no memory for billed leases.");
+ memset (class -> billed_leases, 0,
+ (class -> lease_limit *
+ sizeof class -> billed_leases));
have_billing_classes = 1;
parse_semi (cfile);
} else {
if (!name)
log_fatal ("no memory for group decl name %s", val);
strcpy (name, val);
- }
+ }
if (!parse_lbrace (cfile)) {
group_dereference (&g, MDL);
if (!binding)
log_fatal ("No memory for lease %s.",
"binding");
+ memset (binding, 0, sizeof *binding);
binding -> name =
dmalloc (strlen (val) + 1, MDL);
if (!binding -> name)
"name");
strcpy (binding -> name, val);
newbinding = 1;
- } else {
+ } else {
if (binding -> value)
binding_value_dereference (&binding -> value,
MDL);
#ifndef lint
static char copyright[] =
-"$Id: dhcp.c,v 1.192.2.59 2006/01/06 22:09:23 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: dhcp.c,v 1.192.2.60 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
lt -> client_hostname = dmalloc (d1.len + 1, MDL);
if (!lt -> client_hostname)
log_error ("no memory for client hostname.");
- else
+ else {
memcpy (lt -> client_hostname, d1.data, d1.len);
+ lt -> client_hostname [d1.len] = 0;
+ }
data_string_forget (&d1, MDL);
}
#ifndef lint
static char copyright[] =
-"$Id: failover.c,v 1.53.2.43 2005/10/10 16:56:47 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: failover.c,v 1.53.2.44 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
XXX or will disconnect blow it away? */
return ISC_R_UNEXPECTED;
}
+ memset (link -> imsg, 0, sizeof (failover_message_t));
link -> imsg -> refcnt = 1;
/* Get the length: */
omapi_connection_get_uint16 (c, &link -> imsg_len);
link -> imsg_count = 0; /* Bytes read. */
-
+
/* Maximum of 2048 bytes in any failover message. */
if (link -> imsg_len > DHCP_FAILOVER_MAX_MESSAGE_SIZE) {
status = ISC_R_UNEXPECTED;
OMAPI object interfaces for the DHCP server. */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1999-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: omapi.c,v 1.46.2.22 2005/10/07 15:33:57 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: omapi.c,v 1.46.2.23 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
memcpy (host -> name,
value -> u.buffer.value,
value -> u.buffer.len);
+ host -> name [value -> u.buffer.len] = 0;
} else
return ISC_R_INVALIDARG;
return ISC_R_SUCCESS;
if (!nname)
return ISC_R_NOMEMORY;
memcpy (nname, name -> value, name -> len);
+ nname [name -> len] = 0;
bp = find_binding (scope, nname);
if (!bp && !createp) {
dfree (nname, MDL);
dfree (nname, MDL);
return ISC_R_NOMEMORY;
}
+ memset (bp, 0, sizeof *bp);
bp -> name = nname;
nname = (char *)0;
bp -> next = scope -> bindings;
if (!nname)
return ISC_R_NOMEMORY;
memcpy (nname, name -> value, name -> len);
+ nname [name -> len] = 0;
bp = find_binding (scope, nname);
dfree (nname, MDL);
if (!bp)
Memory allocation for the DHCP server... */
/*
- * Copyright (c) 2004-2005 by Internet Systems Consortium, Inc. ("ISC")
+ * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
* Copyright (c) 1996-2003 by Internet Software Consortium
*
* Permission to use, copy, modify, and distribute this software for any
#ifndef lint
static char copyright[] =
-"$Id: salloc.c,v 1.2.2.6 2005/08/26 22:45:51 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
+"$Id: salloc.c,v 1.2.2.7 2006/02/15 23:00:08 dhankins Exp $ Copyright (c) 2004-2005 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
struct lease *rval;
#if defined (DEBUG_MEMORY_LEAKAGE_ON_EXIT)
rval = dmalloc ((n + 1) * sizeof (struct lease), file, line);
+ memset (rval, 0, sizeof (struct lease));
rval -> starts = n;
rval -> next = lease_hunks;
lease_hunks = rval;
free_lease_states =
(struct lease_state *)(free_lease_states -> next);
dmalloc_reuse (rval, file, line, 0);
- memset(rval, 0, sizeof(struct lease_state));
} else {
rval = dmalloc (sizeof (struct lease_state), file, line);
if (!rval)
return rval;
}
-
+ memset (rval, 0, sizeof *rval);
if (!option_state_allocate (&rval -> options, file, line)) {
free_lease_state (rval, file, line);
return (struct lease_state *)0;
dmalloc (sizeof (struct permit), file, line));
if (!permit)
return permit;
+ memset (permit, 0, sizeof *permit);
return permit;
}