diff options
author | Ted Lemon <source@isc.org> | 2002-02-20 05:46:46 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 2002-02-20 05:46:46 +0000 |
commit | 237c81afae3df8ae53662ad01ea36bd8560d6fa7 (patch) | |
tree | dfb85a094d420332e6eeb2064e4f8f8e456c7e55 | |
parent | 555a9afc3c3b879a0c227026c2aa953d018124a2 (diff) | |
download | isc-dhcp-237c81afae3df8ae53662ad01ea36bd8560d6fa7.tar.gz |
- Fix a null pointer bug in new_address_range.
- Add a debugging flag to write all leases into the lease file, even if
they've never been used.
-rw-r--r-- | server/mdb.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/server/mdb.c b/server/mdb.c index 06dda56a..805924f6 100644 --- a/server/mdb.c +++ b/server/mdb.c @@ -3,7 +3,7 @@ Server-specific in-memory database support. */ /* - * Copyright (c) 1996-2001 Internet Software Consortium. + * Copyright (c) 1996-2002 Internet Software Consortium. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: mdb.c,v 1.67.2.15 2002/02/19 21:00:44 mellon Exp $ Copyright (c) 1996-2001 The Internet Software Consortium. All rights reserved.\n"; +"$Id: mdb.c,v 1.67.2.16 2002/02/20 05:46:46 mellon Exp $ Copyright (c) 1996-2002 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -571,8 +571,10 @@ void new_address_range (low, high, subnet, pool, lpchain) lp -> ip_addr.len, lp, MDL); /* Put the lease on the chain for the caller. */ if (lpchain) { - lease_reference (&lp -> next, *lpchain, MDL); - lease_dereference (lpchain, MDL); + if (*lpchain) { + lease_reference (&lp -> next, *lpchain, MDL); + lease_dereference (lpchain, MDL); + } lease_reference (lpchain, lp, MDL); } lease_dereference (&lp, MDL); @@ -1816,9 +1818,12 @@ int write_leases () for (i = FREE_LEASES; i <= BACKUP_LEASES; i++) { for (l = *(lptr [i]); l; l = l -> next) { +#if !defined (DEBUG_DUMP_ALL_LEASES) if (l -> hardware_addr.hlen || l -> uid_len || - (l -> binding_state != FTS_FREE)) { + (l -> binding_state != FTS_FREE)) +#endif + { if (!write_lease (l)) return 0; num_written++; |