2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-01 14:55:30 +00:00

Don't trust client to provide a valid hostname. Be lenient in parsing client hostnames from lease file

This commit is contained in:
Ted Lemon
1997-06-10 05:49:15 +00:00
parent 0da2916933
commit 200d216c29
2 changed files with 11 additions and 9 deletions

View File

@@ -42,7 +42,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: confpars.c,v 1.42 1997/06/03 01:06:10 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; "$Id: confpars.c,v 1.43 1997/06/10 05:49:14 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -1231,12 +1231,14 @@ struct lease *parse_lease_declaration (cfile)
case CLIENT_HOSTNAME: case CLIENT_HOSTNAME:
seenbit = 1024; seenbit = 1024;
lease.client_hostname = token = peek_token (&val, cfile);
parse_host_name (cfile); if (token == STRING)
if (!lease.client_hostname) { lease.client_hostname =
seenbit = 0; parse_string (cfile);
return (struct lease *)0; else
} lease.client_hostname =
parse_host_name (cfile);
token = CLIENT_HOSTNAME;
break; break;
default: default:

View File

@@ -42,7 +42,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: db.c,v 1.12 1997/06/08 03:08:29 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n"; "$Id: db.c,v 1.13 1997/06/10 05:49:15 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#include "dhcpd.h" #include "dhcpd.h"
@@ -135,7 +135,7 @@ int write_lease (lease)
} }
if (lease -> client_hostname) { if (lease -> client_hostname) {
errno = 0; errno = 0;
fprintf (db_file, "\n\tclient-hostname %s;", fprintf (db_file, "\n\tclient-hostname \"%s\";",
lease -> client_hostname); lease -> client_hostname);
if (errno) { if (errno) {
++errors; ++errors;