]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
- Remove NUL from end of host-name option after checking it, so that
authorTed Lemon <source@isc.org>
Wed, 21 Jul 1999 14:30:28 +0000 (14:30 +0000)
committerTed Lemon <source@isc.org>
Wed, 21 Jul 1999 14:30:28 +0000 (14:30 +0000)
  host-name can reliably be used in concat expressions.

  (From Brian Murrell)

server/dhcp.c

index dfe82bbe21ecde38996c22d5768e724d2350f5b3..c4951a2bfe84bda5dba4ca522617a3185c84edbf 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 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 */
 
 #include "dhcpd.h"
@@ -1247,6 +1247,19 @@ void ack_lease (packet, lease, offer, when, msg)
        lt.subnet = lease -> subnet;
        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
           structure values for the forward and reverse names are in place for
           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. */
        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. */
        state -> giaddr = packet -> raw -> giaddr;
        state -> ciaddr = packet -> raw -> ciaddr;