diff options
author | Ted Lemon <source@isc.org> | 2000-01-31 23:43:11 +0000 |
---|---|---|
committer | Ted Lemon <source@isc.org> | 2000-01-31 23:43:11 +0000 |
commit | fb6297b12be9c65634bd10f8effe1fe76bf07cba (patch) | |
tree | 60130c0cc356395cb51a263e0ff1f3066879dc5f | |
parent | 9d80b480d588660878be9cb96e523673e27c41ef (diff) | |
download | isc-dhcp-fb6297b12be9c65634bd10f8effe1fe76bf07cba.tar.gz |
- In order to satisfy the HP C compiler, make a (possibly malloc'd) copy
of the host UID when mocking up a lease.
-rw-r--r-- | server/dhcp.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/server/dhcp.c b/server/dhcp.c index 0c6f1a0b..a18f2b9d 100644 --- a/server/dhcp.c +++ b/server/dhcp.c @@ -22,7 +22,7 @@ #ifndef lint static char copyright[] = -"$Id: dhcp.c,v 1.135 2000/01/27 22:21:32 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; +"$Id: dhcp.c,v 1.136 2000/01/31 23:43:11 mellon Exp $ Copyright (c) 1995, 1996, 1997, 1998, 1999 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -641,7 +641,7 @@ void dhcpinform (packet) oc = (struct option_cache *)0; if (option_cache_allocate (&oc, MDL)) { memset (&d1, 0, sizeof d1); - d1.data = "nwip"; + d1.data = (const unsigned char *)"nwip"; d1.len = 4; if (make_encapsulation (&oc -> expression, &d1)) { oc -> option = dhcp_universe.options [i]; @@ -1843,7 +1843,7 @@ void ack_lease (packet, lease, offer, when, msg) oc = (struct option_cache *)0; if (option_cache_allocate (&oc, MDL)) { memset (&d1, 0, sizeof d1); - d1.data = "nwip"; + d1.data = (const unsigned char *)"nwip"; d1.len = 4; if (make_encapsulation (&oc -> expression, &d1)) { oc -> option = dhcp_universe.options [i]; @@ -2652,13 +2652,21 @@ struct lease *mockup_lease (packet, share, hp) struct host_decl *hp; { static struct lease mock; + const unsigned char **s; mock.subnet = find_host_for_network (&hp, &mock.ip_addr, share); if (!mock.subnet) return (struct lease *)0; mock.next = mock.prev = (struct lease *)0; mock.host = hp; - (const unsigned char *)mock.uid = hp -> client_identifier.data; + if (hp -> client_identifier.len > sizeof mock.uid_buf) + mock.uid = dmalloc (hp -> client_identifier.len, MDL); + else + mock.uid = mock.uid_buf; + if (!mock.uid) + return (struct lease *)0; + memcpy (mock.uid, hp -> client_identifier.data, + hp -> client_identifier.len); mock.uid_len = hp -> client_identifier.len; mock.hardware_addr = hp -> interface; mock.starts = mock.timestamp = mock.ends = MIN_TIME; @@ -2689,6 +2697,10 @@ void static_lease_dereference (lease, file, line) file, line); if (&lease -> scope) free_bindings (&lease -> scope, file, line); + if (lease -> uid != lease -> uid_buf) { + dfree (lease -> uid, file, line); + lease -> uid = (unsigned char *)0; + } } /* Look through all the pools in a list starting with the specified pool |