2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-22 01:49:35 +00:00

- Attempting to write a new lease file to replace a corrupt (due to

encountering non-retryable errors during writing) lease file should
  no longer result in an infinite recursion. [ISC-Bugs #16265]
This commit is contained in:
David Hankins 2006-07-19 16:44:47 +00:00
parent 8757898765
commit e77c575fc4
2 changed files with 14 additions and 3 deletions

View File

@ -168,6 +168,10 @@ and for prodding me into improving it.
- Abandoned or dissociated (err condition) leases now remove any related
dynamic dns bindings. Thanks to a patch from Patrick Schoo.
- Attempting to write a new lease file to replace a corrupt (due to
encountering non-retryable errors during writing) lease file should
no longer result in an infinite recursion.
Changes since 3.0.4rc1
- The dhcp-options.5 manpage was updated to correct indentation errors

View File

@ -34,7 +34,7 @@
#ifndef lint
static char copyright[] =
"$Id: db.c,v 1.73 2006/06/06 16:35:18 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n";
"$Id: db.c,v 1.74 2006/07/19 16:44:47 dhankins Exp $ Copyright (c) 2004-2006 Internet Systems Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
@ -794,11 +794,14 @@ int new_lease_file ()
char backfname [512];
TIME t;
int db_fd;
int db_validity;
FILE *new_db_file;
/* Make a temporary lease file... */
GET_TIME (&t);
db_validity = lease_file_is_corrupt;
/* %Audit% Truncated filename causes panic. %2004.06.17,Safe%
* This should never happen since the path is a configuration
* variable from build-time or command-line. But if it should,
@ -835,6 +838,11 @@ int new_lease_file ()
if (errno != 0)
goto fail;
/* At this point we have a new lease file that, so far, could not
* be described as either corrupt nor valid.
*/
lease_file_is_corrupt = 0;
/* Write out all the leases that we know of... */
counting = 0;
if (!write_leases ())
@ -881,11 +889,10 @@ int new_lease_file ()
}
counting = 1;
lease_file_is_corrupt = 0;
return 1;
fail:
lease_file_is_corrupt = 1;
lease_file_is_corrupt = db_validity;
fdfail:
unlink (newfname);
return 0;