mirror of
https://gitlab.isc.org/isc-projects/dhcp
synced 2025-09-03 15:56:00 +00:00
- Check client identifier on hw_lease before giving it to the client.
- Don't try to reference host to lease if there's no host.
This commit is contained in:
@@ -43,7 +43,7 @@
|
|||||||
|
|
||||||
#ifndef lint
|
#ifndef lint
|
||||||
static char copyright[] =
|
static char copyright[] =
|
||||||
"$Id: dhcp.c,v 1.184 2001/03/15 23:22:08 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
"$Id: dhcp.c,v 1.185 2001/03/16 01:55:38 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
#include "dhcpd.h"
|
#include "dhcpd.h"
|
||||||
@@ -2759,10 +2759,11 @@ int find_lease (struct lease **lp,
|
|||||||
piaddr (fixed_lease -> ip_addr));
|
piaddr (fixed_lease -> ip_addr));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (!fixed_lease) /* Save the host if we found one. */
|
if (hp) {
|
||||||
host_reference (&host, hp, MDL);
|
if (!fixed_lease) /* Save the host if we found one. */
|
||||||
if (hp)
|
host_reference (&host, hp, MDL);
|
||||||
host_dereference (&hp, MDL);
|
host_dereference (&hp, MDL);
|
||||||
|
}
|
||||||
|
|
||||||
find_lease_by_uid (&uid_lease, client_identifier.data,
|
find_lease_by_uid (&uid_lease, client_identifier.data,
|
||||||
client_identifier.len, MDL);
|
client_identifier.len, MDL);
|
||||||
@@ -3207,12 +3208,30 @@ int find_lease (struct lease **lp,
|
|||||||
log_info ("not choosing hardware lease.");
|
log_info ("not choosing hardware lease.");
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
lease_reference (&lease, hw_lease, MDL);
|
/* We're a little lax here - if the client didn't
|
||||||
if (lease -> host)
|
send a client identifier and it's a bootp client,
|
||||||
host_dereference (&lease -> host, MDL);
|
but the lease has a client identifier, we still
|
||||||
|
let the client have a lease. */
|
||||||
|
if (!hw_lease -> uid_len ||
|
||||||
|
(have_client_identifier
|
||||||
|
? (hw_lease -> uid_len ==
|
||||||
|
client_identifier.len &&
|
||||||
|
!memcmp (hw_lease -> uid,
|
||||||
|
client_identifier.data,
|
||||||
|
client_identifier.len))
|
||||||
|
: packet -> packet_type == 0)) {
|
||||||
|
lease_reference (&lease, hw_lease, MDL);
|
||||||
|
if (lease -> host)
|
||||||
|
host_dereference (&lease -> host, MDL);
|
||||||
#if defined (DEBUG_FIND_LEASE)
|
#if defined (DEBUG_FIND_LEASE)
|
||||||
log_info ("choosing hardware lease.");
|
log_info ("choosing hardware lease.");
|
||||||
#endif
|
#endif
|
||||||
|
} else {
|
||||||
|
#if defined (DEBUG_FIND_LEASE)
|
||||||
|
log_info ("not choosing hardware lease: %s.",
|
||||||
|
"uid mismatch");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
lease_dereference (&hw_lease, MDL);
|
lease_dereference (&hw_lease, MDL);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user