2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-08-30 13:57:50 +00:00

- Remove NUL from end of host-name option after checking it, so that

host-name can reliably be used in concat expressions.

  (From Brian Murrell)
This commit is contained in:
Ted Lemon
1999-07-21 14:30:28 +00:00
parent 4f4d982cbd
commit 9e0e9ed858

View File

@@ -22,7 +22,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: dhcp.c,v 1.103 1999/07/19 01:15:22 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; "$Id: dhcp.c,v 1.104 1999/07/21 14:30:28 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -1247,6 +1247,19 @@ void ack_lease (packet, lease, offer, when, msg)
lt.subnet = lease -> subnet; lt.subnet = lease -> subnet;
lt.billing_class = lease -> billing_class; lt.billing_class = lease -> billing_class;
/* Set a flag if this client is a broken client that NUL
terminates string options and expects us to do likewise. */
lease -> flags &= ~MS_NULL_TERMINATION;
if ((oc = lookup_option (&dhcp_universe, packet -> options,
DHO_HOST_NAME))) {
if (!oc -> expression)
if (oc -> data.len &&
oc -> data.data [oc -> data.len - 1] == 0) {
lease -> flags |= MS_NULL_TERMINATION;
oc -> data.len--;
}
}
/* Do the DDNS update. It needs to be done here so that the lease /* Do the DDNS update. It needs to be done here so that the lease
structure values for the forward and reverse names are in place for structure values for the forward and reverse names are in place for
supercede()->write_lease() to be able to write into the dhcpd.leases supercede()->write_lease() to be able to write into the dhcpd.leases
@@ -1302,19 +1315,6 @@ void ack_lease (packet, lease, offer, when, msg)
/* Remember the interface on which the packet arrived. */ /* Remember the interface on which the packet arrived. */
state -> ip = packet -> interface; state -> ip = packet -> interface;
/* Set a flag if this client is a broken client that NUL
terminates string options and expects us to do likewise. */
lease -> flags &= ~MS_NULL_TERMINATION;
if ((oc = lookup_option (&dhcp_universe, packet -> options,
DHO_HOST_NAME))) {
if (evaluate_option_cache (&d1, packet,
packet -> options, lease, oc)) {
if (d1.data [d1.len - 1] == '\0')
lease -> flags |= MS_NULL_TERMINATION;
data_string_forget (&d1, "ack_lease");
}
}
/* Remember the giaddr, xid, secs, flags and hops. */ /* Remember the giaddr, xid, secs, flags and hops. */
state -> giaddr = packet -> raw -> giaddr; state -> giaddr = packet -> raw -> giaddr;
state -> ciaddr = packet -> raw -> ciaddr; state -> ciaddr = packet -> raw -> ciaddr;