From: Ted Lemon Date: Mon, 12 Feb 2001 21:09:21 +0000 (+0000) Subject: - Get rid of lease -> hostname, which doesn't do anything. X-Git-Tag: V3-BETA-2-PATCH-18~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=25f11933ac1df3c8741168f236b52a5e0247b09f;p=thirdparty%2Fdhcp.git - Get rid of lease -> hostname, which doesn't do anything. - Fix a bug in uid handling that could cause core dumps with long uids. --- diff --git a/server/mdb.c b/server/mdb.c index e076e47b2..eb6414f0d 100644 --- a/server/mdb.c +++ b/server/mdb.c @@ -43,7 +43,7 @@ #ifndef lint static char copyright[] = -"$Id: mdb.c,v 1.51 2001/01/25 08:36:36 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; +"$Id: mdb.c,v 1.52 2001/02/12 21:09:21 mellon Exp $ Copyright (c) 1996-2000 The Internet Software Consortium. All rights reserved.\n"; #endif /* not lint */ #include "dhcpd.h" @@ -851,19 +851,21 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate) lease -> uid, lease -> uid_len); comp -> uid = &comp -> uid_buf [0]; comp -> uid_max = sizeof comp -> uid_buf; + comp -> uid_len = lease -> uid_len; } else if (lease -> uid != &lease -> uid_buf [0]) { comp -> uid = lease -> uid; comp -> uid_max = lease -> uid_max; lease -> uid = (unsigned char *)0; lease -> uid_max = 0; + comp -> uid_len = lease -> uid_len; + lease -> uid_len = 0; } else { log_fatal ("corrupt lease uid."); /* XXX */ } } else { comp -> uid = (unsigned char *)0; - comp -> uid_max = 0; + comp -> uid_len = comp -> uid_max = 0; } - comp -> uid_len = lease -> uid_len; if (comp -> host) host_dereference (&comp -> host, MDL); host_reference (&comp -> host, lease -> host, MDL); @@ -893,10 +895,6 @@ int supersede_lease (comp, lease, commit, propogate, pimmediate) } /* Record the hostname information in the lease. */ - if (comp -> hostname) - dfree (comp -> hostname, MDL); - comp -> hostname = lease -> hostname; - lease -> hostname = (char *)0; if (comp -> client_hostname) dfree (comp -> client_hostname, MDL); comp -> client_hostname = lease -> client_hostname; @@ -1186,14 +1184,6 @@ int lease_copy (struct lease **lp, } memcpy (lt -> uid, lease -> uid, lease -> uid_max); } - if (lease -> hostname) { - lt -> hostname = dmalloc (strlen (lease -> hostname) + 1, MDL); - if (!lt -> hostname) { - lease_dereference (<, MDL); - return 0; - } - strcpy (lt -> hostname, lease -> hostname); - } if (lease -> client_hostname) { lt -> client_hostname = dmalloc (strlen (lease -> client_hostname) + 1, MDL);