]> git.ipfire.org Git - thirdparty/dhcp.git/commitdiff
Don't trust client to provide a valid hostname. Be lenient in parsing client hostnam...
authorTed Lemon <source@isc.org>
Tue, 10 Jun 1997 05:49:15 +0000 (05:49 +0000)
committerTed Lemon <source@isc.org>
Tue, 10 Jun 1997 05:49:15 +0000 (05:49 +0000)
server/confpars.c
server/db.c

index d192fa1f7f856b4e1ee03a58f24ed3a28c6993bf..9ee5ec1067f77653c94d434fd8042267fcca536d 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 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 */
 
 #include "dhcpd.h"
@@ -1231,12 +1231,14 @@ struct lease *parse_lease_declaration (cfile)
 
                              case CLIENT_HOSTNAME:
                                seenbit = 1024;
-                               lease.client_hostname =
-                                       parse_host_name (cfile);
-                               if (!lease.client_hostname) {
-                                       seenbit = 0;
-                                       return (struct lease *)0;
-                               }
+                               token = peek_token (&val, cfile);
+                               if (token == STRING)
+                                       lease.client_hostname =
+                                               parse_string (cfile);
+                               else
+                                       lease.client_hostname =
+                                               parse_host_name (cfile);
+                               token = CLIENT_HOSTNAME;
                                break;
 
                              default:
index 6fb35dd5b0bb0202705d1ec94624674aeb2a78d1..c3c0a2682655b8ed09e1c18a16068cd6b865c977 100644 (file)
@@ -42,7 +42,7 @@
 
 #ifndef lint
 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 */
 
 #include "dhcpd.h"
@@ -135,7 +135,7 @@ int write_lease (lease)
        }
        if (lease -> client_hostname) {
                errno = 0;
-               fprintf (db_file, "\n\tclient-hostname %s;",
+               fprintf (db_file, "\n\tclient-hostname \"%s\";",
                         lease -> client_hostname);
                if (errno) {
                        ++errors;